mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Compare commits
226 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 761d7e7c4e | |||
| d7ae90a790 | |||
| 41a19ed49c | |||
| 949275bbed | |||
| cab41529da | |||
| 318e08d914 | |||
| 560304e0f4 | |||
| 9ecacf1d7f | |||
| ee45b58647 | |||
| 215a05af3d | |||
| a41a58a95e | |||
| e65de2941c | |||
| 2c8e0512dd | |||
| 44b5d06583 | |||
| 350ba73267 | |||
| 9516df52a4 | |||
| 72366ac9a9 | |||
| 6aca3e99f0 | |||
| 4381b86b6b | |||
| 27d19d06ca | |||
| 4b8ac11aa3 | |||
| a0a5cc57df | |||
| 0c27ed1d0e | |||
| d1ae7bac60 | |||
| 40c7e471e3 | |||
| 76406c7894 | |||
| d973acc123 | |||
| 46c7c1cdff | |||
| 13479ed27d | |||
| a5e5b782c7 | |||
| 65cfe743af | |||
| d862d56acb | |||
| 190673e779 | |||
| 789a2bcb39 | |||
| 5f1631cb0e | |||
| a491b0698c | |||
| 562c17d131 | |||
| 7da87aaae7 | |||
| 15d91801b7 | |||
| c5cb4a253a | |||
| 9372ba95fa | |||
| aa5e313561 | |||
| fe57e3c292 | |||
| 6b01affd89 | |||
| bf292f0083 | |||
| 781fbbadb0 | |||
| 5dd207048c | |||
| a3d28ef52c | |||
| 8149a5fc00 | |||
| 74a46dfa0c | |||
| 4ec7daf3e9 | |||
| c3ca88055f | |||
| 54e8e0b092 | |||
| b4a8eb9b19 | |||
| 28773a069e | |||
| 73a8ebb691 | |||
| 4e70c95aa3 | |||
| 9db156421f | |||
| 0b652a44d2 | |||
| 9b6d68ec70 | |||
| 4837b78ffe | |||
| bc3be40f21 | |||
| da3f20d860 | |||
| fb0028c766 | |||
| 994c3b4e48 | |||
| 18307467b4 | |||
| 49c5d837b4 | |||
| 8a5fd0c5a4 | |||
| a5ed740d9d | |||
| a264d32987 | |||
| 081484ed34 | |||
| 506a6aafde | |||
| a875a536b7 | |||
| 2551829f75 | |||
| 7e03bce138 | |||
| ac30ef3e0c | |||
| a43f545677 | |||
| 59055d585f | |||
| 8a1f4940fc | |||
| 5f4a6f689a | |||
| c016b26852 | |||
| db76abb63c | |||
| c194193797 | |||
| 9dc365f192 | |||
| c81def70be | |||
| 197193ac0b | |||
| 135d87aa3c | |||
| 2fb336268f | |||
| 9486ec0c02 | |||
| dff6253ca7 | |||
| bc7b19cbd1 | |||
| ce9d124243 | |||
| f6d44cedfd | |||
| d74c18117d | |||
| 92c70b2a83 | |||
| 7dd14a4b20 | |||
| fa60269245 | |||
| 6e6805000a | |||
| b3544ca43e | |||
| 382943f2b0 | |||
| ef6189f348 | |||
| 7dbdd2e6a5 | |||
| 80fde12fda | |||
| a80788c17f | |||
| a9f674e719 | |||
| b5d4f24f74 | |||
| d861d7bffe | |||
| c42d8f3e5b | |||
| 50a6270e55 | |||
| b804379463 | |||
| 359758bb53 | |||
| e96dc5d219 | |||
| 2c519709be | |||
| bd452016be | |||
| bac15f9449 | |||
| c819f27ce3 | |||
| 94cb0347ab | |||
| 953a1c3f8b | |||
| 70a3104c49 | |||
| bc5523e994 | |||
| 8e288dc94c | |||
| de23429455 | |||
| 08f01c31a0 | |||
| 20e522cdf4 | |||
| c5f1ca3e41 | |||
| b69fb99031 | |||
| c88ee1c9d3 | |||
| 28d8507700 | |||
| 75294462b3 | |||
| 5fc4c01302 | |||
| 33683ec60e | |||
| 04f7f55f07 | |||
| 4d0ae4ffa7 | |||
| 82978bb3af | |||
| 376897a344 | |||
| 36c547875c | |||
| 692754a2c5 | |||
| 3a37a08998 | |||
| 7749aac50d | |||
| 1e20218b3d | |||
| 545f409592 | |||
| 8f852e0833 | |||
| f71b55f83d | |||
| d25248343e | |||
| 1bd0a55aa7 | |||
| 3d2540c373 | |||
| 3ec8f4a7f5 | |||
| 243b1bc292 | |||
| 7105ff2dfd | |||
| 7f02898264 | |||
| aa8e8ab960 | |||
| 26aac53e1d | |||
| 2777f6a754 | |||
| cbf23e5615 | |||
| 56ca0cb3b3 | |||
| 4cc5d2e623 | |||
| f764836e58 | |||
| 2c7ef5b480 | |||
| 711b9694a1 | |||
| efda4afb49 | |||
| 65748fb8f3 | |||
| 6abad2efd2 | |||
| eecf83c5d0 | |||
| 2e039d9275 | |||
| b430bc4935 | |||
| 062a1c22b5 | |||
| a4d910b4a7 | |||
| 4f0b8b0dda | |||
| 7bd0af3089 | |||
| 84b13113ed | |||
| 62b7fe8311 | |||
| 773f4495f0 | |||
| 5bea122211 | |||
| d232bcfcdd | |||
| 36f90800d8 | |||
| c6b95e3b07 | |||
| e463e85bba | |||
| 3a5e99e59a | |||
| 3262c29440 | |||
| 1d62157268 | |||
| 1f508530f0 | |||
| fad9896d38 | |||
| 0c6b505619 | |||
| 2db3b9688d | |||
| d834f01ca4 | |||
| 537ea4ccf1 | |||
| 51bb76c7c3 | |||
| 71e6ff386d | |||
| 98dde03ce1 | |||
| e1d9e2ba73 | |||
| 84ec99bb01 | |||
| d0c3fa900a | |||
| 267e06a41e | |||
| bb6945a18a | |||
| 22a6c02a4c | |||
| 3fd4e79adb | |||
| 56aad76b16 | |||
| feaa532886 | |||
| e91d0fc499 | |||
| 3cf7645b96 | |||
| e4aba7feaa | |||
| a639d6e635 | |||
| d44bfe0264 | |||
| f61d0916fd | |||
| c415c71947 | |||
| 144c98bcb3 | |||
| fa025d8f80 | |||
| 700d1f28d8 | |||
| 0b01d850ed | |||
| 57bf6b2f75 | |||
| ceb16cb5f1 | |||
| 0ccb690853 | |||
| 535491c4f3 | |||
| 7dc36dd7da | |||
| c0eabc594f | |||
| 8ee589e43b | |||
| cd290f767f | |||
| a255e7ace6 | |||
| 5c5963f1c0 | |||
| 090b16bfae | |||
| 42a3e4434f | |||
| 15af302f77 | |||
| be71147ad5 | |||
| ff7d42a55e | |||
| 599fb3de34 | |||
| a337c56848 |
+16
-3
@@ -1,10 +1,10 @@
|
|||||||
image:
|
image:
|
||||||
- Visual Studio 2015
|
- Visual Studio 2015
|
||||||
|
- Visual Studio 2019
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- ci
|
- ci
|
||||||
- master
|
- master
|
||||||
- latest
|
|
||||||
- 3.3-stable
|
- 3.3-stable
|
||||||
skip_tags: true
|
skip_tags: true
|
||||||
environment:
|
environment:
|
||||||
@@ -21,13 +21,26 @@ environment:
|
|||||||
- GENERATOR: Visual Studio 10 2010
|
- GENERATOR: Visual Studio 10 2010
|
||||||
BUILD_SHARED_LIBS: OFF
|
BUILD_SHARED_LIBS: OFF
|
||||||
CFLAGS: /WX
|
CFLAGS: /WX
|
||||||
|
- GENERATOR: Visual Studio 16 2019
|
||||||
|
BUILD_SHARED_LIBS: ON
|
||||||
|
CFLAGS: /WX
|
||||||
|
- GENERATOR: Visual Studio 16 2019
|
||||||
|
BUILD_SHARED_LIBS: OFF
|
||||||
|
CFLAGS: /WX
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
exclude:
|
||||||
|
- image: Visual Studio 2015
|
||||||
|
GENERATOR: Visual Studio 16 2019
|
||||||
|
- image: Visual Studio 2019
|
||||||
|
GENERATOR: Visual Studio 10 2010
|
||||||
|
- image: Visual Studio 2019
|
||||||
|
GENERATOR: MinGW Makefiles
|
||||||
for:
|
for:
|
||||||
-
|
-
|
||||||
matrix:
|
matrix:
|
||||||
only:
|
except:
|
||||||
- GENERATOR: MinGW Makefiles
|
- GENERATOR: Visual Studio 10 2010
|
||||||
build_script:
|
build_script:
|
||||||
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
|
- 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 -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
name: Build
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches: [ ci, master, latest, 3.3-stable ]
|
|
||||||
permissions:
|
|
||||||
statuses: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-linux-x11-clang:
|
|
||||||
name: X11 (Linux, Clang)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
CC: clang
|
|
||||||
CFLAGS: -Werror
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
|
|
||||||
|
|
||||||
- name: Configure static library
|
|
||||||
run: cmake -S . -B build-static
|
|
||||||
- name: Build static library
|
|
||||||
run: cmake --build build-static --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
|
|
||||||
|
|
||||||
build-linux-wayland-clang:
|
|
||||||
name: Wayland (Linux, Clang)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
CC: clang
|
|
||||||
CFLAGS: -Werror
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev extra-cmake-modules
|
|
||||||
|
|
||||||
- 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 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
|
|
||||||
|
|
||||||
build-linux-null-clang:
|
|
||||||
name: Null (Linux, Clang)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
CC: clang
|
|
||||||
CFLAGS: -Werror
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- 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)
|
|
||||||
runs-on: macos-latest
|
|
||||||
env:
|
|
||||||
CFLAGS: -Werror
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.8
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Configure static library
|
|
||||||
run: cmake -S . -B build-static
|
|
||||||
- name: Build static library
|
|
||||||
run: cmake --build build-static --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
|
|
||||||
|
|
||||||
build-windows-win32-vs2022:
|
|
||||||
name: Win32 (Windows, VS2022)
|
|
||||||
runs-on: windows-latest
|
|
||||||
env:
|
|
||||||
CFLAGS: /WX
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- 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 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
|
|
||||||
|
|
||||||
+3
-3
@@ -60,11 +60,11 @@ src/wayland-relative-pointer-unstable-v1-protocol.c
|
|||||||
# Compiled binaries
|
# Compiled binaries
|
||||||
src/libglfw.so
|
src/libglfw.so
|
||||||
src/libglfw.so.3
|
src/libglfw.so.3
|
||||||
src/libglfw.so.3.3
|
src/libglfw.so.3.4
|
||||||
src/libglfw.dylib
|
src/libglfw.dylib
|
||||||
src/libglfw.dylib
|
src/libglfw.dylib
|
||||||
src/libglfw.3.dylib
|
src/libglfw.3.dylib
|
||||||
src/libglfw.3.3.dylib
|
src/libglfw.3.4.dylib
|
||||||
src/libglfw3.a
|
src/libglfw3.a
|
||||||
src/glfw3.lib
|
src/glfw3.lib
|
||||||
src/glfw3.dll
|
src/glfw3.dll
|
||||||
@@ -79,7 +79,7 @@ examples/offscreen
|
|||||||
examples/particles
|
examples/particles
|
||||||
examples/splitview
|
examples/splitview
|
||||||
examples/sharing
|
examples/sharing
|
||||||
examples/simple
|
examples/triangle-opengl
|
||||||
examples/wave
|
examples/wave
|
||||||
tests/*.app
|
tests/*.app
|
||||||
tests/*.exe
|
tests/*.exe
|
||||||
|
|||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
language: c
|
||||||
|
compiler: clang
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- ci
|
||||||
|
- master
|
||||||
|
- 3.3-stable
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
dist: xenial
|
||||||
|
sudo: false
|
||||||
|
name: "X11 shared library"
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libxrandr-dev
|
||||||
|
- libxinerama-dev
|
||||||
|
- libxcursor-dev
|
||||||
|
- libxi-dev
|
||||||
|
env:
|
||||||
|
- BUILD_SHARED_LIBS=ON
|
||||||
|
- CFLAGS=-Werror
|
||||||
|
- os: linux
|
||||||
|
dist: xenial
|
||||||
|
sudo: false
|
||||||
|
name: "X11 static library"
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libxrandr-dev
|
||||||
|
- libxinerama-dev
|
||||||
|
- libxcursor-dev
|
||||||
|
- libxi-dev
|
||||||
|
env:
|
||||||
|
- BUILD_SHARED_LIBS=OFF
|
||||||
|
- CFLAGS=-Werror
|
||||||
|
- os: linux
|
||||||
|
dist: xenial
|
||||||
|
sudo: required
|
||||||
|
name: "Wayland shared library"
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ppa:kubuntu-ppa/backports
|
||||||
|
packages:
|
||||||
|
- extra-cmake-modules
|
||||||
|
- libwayland-dev
|
||||||
|
- libxkbcommon-dev
|
||||||
|
- libegl1-mesa-dev
|
||||||
|
env:
|
||||||
|
- USE_WAYLAND=ON
|
||||||
|
- BUILD_SHARED_LIBS=ON
|
||||||
|
- CFLAGS=-Werror
|
||||||
|
- os: linux
|
||||||
|
dist: xenial
|
||||||
|
sudo: required
|
||||||
|
name: "Wayland static library"
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ppa:kubuntu-ppa/backports
|
||||||
|
packages:
|
||||||
|
- extra-cmake-modules
|
||||||
|
- libwayland-dev
|
||||||
|
- libxkbcommon-dev
|
||||||
|
- libegl1-mesa-dev
|
||||||
|
env:
|
||||||
|
- USE_WAYLAND=ON
|
||||||
|
- BUILD_SHARED_LIBS=OFF
|
||||||
|
- CFLAGS=-Werror
|
||||||
|
- os: osx
|
||||||
|
sudo: false
|
||||||
|
name: "Cocoa shared library"
|
||||||
|
env:
|
||||||
|
- BUILD_SHARED_LIBS=ON
|
||||||
|
- CFLAGS=-Werror
|
||||||
|
- MACOSX_DEPLOYMENT_TARGET=10.8
|
||||||
|
- os: osx
|
||||||
|
sudo: false
|
||||||
|
name: "Cocoa static library"
|
||||||
|
env:
|
||||||
|
- BUILD_SHARED_LIBS=OFF
|
||||||
|
- CFLAGS=-Werror
|
||||||
|
- MACOSX_DEPLOYMENT_TARGET=10.8
|
||||||
|
script:
|
||||||
|
- if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then
|
||||||
|
echo Trailing whitespace found, aborting;
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- if test -n "${USE_WAYLAND}"; then
|
||||||
|
git clone git://anongit.freedesktop.org/wayland/wayland-protocols;
|
||||||
|
pushd wayland-protocols;
|
||||||
|
git checkout 1.15 && ./autogen.sh --prefix=/usr && make && sudo make install;
|
||||||
|
popd;
|
||||||
|
fi
|
||||||
|
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} ..
|
||||||
|
- cmake --build .
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
recipients:
|
||||||
|
- ci@glfw.org
|
||||||
|
on_success: never
|
||||||
|
on_failure: always
|
||||||
@@ -23,23 +23,8 @@ endif()
|
|||||||
|
|
||||||
file(STRINGS "${source_path}" lines)
|
file(STRINGS "${source_path}" lines)
|
||||||
foreach(line ${lines})
|
foreach(line ${lines})
|
||||||
if (line MATCHES "^[0-9a-fA-F]")
|
if ("${line}" MATCHES "^[0-9a-fA-F].*$")
|
||||||
if (line MATCHES "platform:Windows")
|
set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n")
|
||||||
if (GLFW_WIN32_MAPPINGS)
|
|
||||||
set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\n")
|
|
||||||
endif()
|
|
||||||
set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\"${line}\",")
|
|
||||||
elseif (line MATCHES "platform:Mac OS X")
|
|
||||||
if (GLFW_COCOA_MAPPINGS)
|
|
||||||
set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\n")
|
|
||||||
endif()
|
|
||||||
set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\"${line}\",")
|
|
||||||
elseif (line MATCHES "platform:Linux")
|
|
||||||
if (GLFW_LINUX_MAPPINGS)
|
|
||||||
set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\n")
|
|
||||||
endif()
|
|
||||||
set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\"${line}\",")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt")
|
||||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"")
|
||||||
endif()
|
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}")
|
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
|
|
||||||
foreach (file ${files})
|
foreach (file ${files})
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(Threads)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
|
||||||
@@ -13,5 +13,5 @@ if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
|||||||
endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS)
|
find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS)
|
||||||
mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)
|
mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)
|
||||||
|
|||||||
+23
-41
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
project(GLFW VERSION 3.3.8 LANGUAGES C)
|
project(GLFW VERSION 3.4.0 LANGUAGES C)
|
||||||
|
|
||||||
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
||||||
|
|
||||||
@@ -8,19 +8,19 @@ if (POLICY CMP0054)
|
|||||||
cmake_policy(SET CMP0054 NEW)
|
cmake_policy(SET CMP0054 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (POLICY CMP0069)
|
|
||||||
cmake_policy(SET CMP0069 NEW)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (POLICY CMP0077)
|
if (POLICY CMP0077)
|
||||||
cmake_policy(SET CMP0077 NEW)
|
cmake_policy(SET CMP0077 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
set(GLFW_STANDALONE TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
|
||||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
|
||||||
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||||
option(GLFW_INSTALL "Generate installation target" ON)
|
option(GLFW_INSTALL "Generate installation target" ON)
|
||||||
option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
|
option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
|
||||||
@@ -37,10 +37,6 @@ cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
|
|||||||
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
|
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
|
||||||
"MSVC" OFF)
|
"MSVC" OFF)
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
|
||||||
set(_GLFW_BUILD_DLL 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS AND UNIX)
|
if (BUILD_SHARED_LIBS AND UNIX)
|
||||||
# On Unix-like systems, shared libraries can use the soname system.
|
# On Unix-like systems, shared libraries can use the soname system.
|
||||||
set(GLFW_LIB_NAME glfw)
|
set(GLFW_LIB_NAME glfw)
|
||||||
@@ -67,8 +63,7 @@ if (GLFW_BUILD_DOCS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Apply Microsoft C runtime library option
|
# Set compiler specific flags
|
||||||
# This is here because it also applies to tests and examples
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
if (MSVC90)
|
if (MSVC90)
|
||||||
@@ -81,26 +76,22 @@ if (MSVC)
|
|||||||
# Workaround for VS 2008 not shipping with stdint.h
|
# Workaround for VS 2008 not shipping with stdint.h
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
|
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||||
if (CMAKE_VERSION VERSION_LESS 3.15)
|
|
||||||
foreach (flag CMAKE_C_FLAGS
|
foreach (flag CMAKE_C_FLAGS
|
||||||
CMAKE_C_FLAGS_DEBUG
|
CMAKE_C_FLAGS_DEBUG
|
||||||
CMAKE_C_FLAGS_RELEASE
|
CMAKE_C_FLAGS_RELEASE
|
||||||
CMAKE_C_FLAGS_MINSIZEREL
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
|
||||||
if (flag MATCHES "/MD")
|
if (${flag} MATCHES "/MD")
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||||
endif()
|
endif()
|
||||||
if (flag MATCHES "/MDd")
|
if (${flag} MATCHES "/MDd")
|
||||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -137,9 +128,6 @@ if (MINGW)
|
|||||||
if (_GLFW_HAS_64ASLR)
|
if (_GLFW_HAS_64ASLR)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Clear flags again to avoid breaking later tests
|
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -207,11 +195,8 @@ if (_GLFW_X11)
|
|||||||
|
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
list(APPEND glfw_PKG_DEPS "x11")
|
|
||||||
|
|
||||||
# Set up library and include paths
|
# Set up library and include paths
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
|
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
|
||||||
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
|
|
||||||
|
|
||||||
# Check for XRandR (modern resolution switching and gamma control)
|
# Check for XRandR (modern resolution switching and gamma control)
|
||||||
if (NOT X11_Xrandr_INCLUDE_PATH)
|
if (NOT X11_Xrandr_INCLUDE_PATH)
|
||||||
@@ -237,12 +222,6 @@ if (_GLFW_X11)
|
|||||||
if (NOT X11_Xi_INCLUDE_PATH)
|
if (NOT X11_Xi_INCLUDE_PATH)
|
||||||
message(FATAL_ERROR "XInput headers not found; install libxi development package")
|
message(FATAL_ERROR "XInput headers not found; install libxi development package")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}"
|
|
||||||
"${X11_Xinerama_INCLUDE_PATH}"
|
|
||||||
"${X11_Xkb_INCLUDE_PATH}"
|
|
||||||
"${X11_Xcursor_INCLUDE_PATH}"
|
|
||||||
"${X11_Xi_INCLUDE_PATH}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -259,16 +238,17 @@ if (_GLFW_WAYLAND)
|
|||||||
list(APPEND glfw_PKG_DEPS "wayland-client")
|
list(APPEND glfw_PKG_DEPS "wayland-client")
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
|
list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
|
||||||
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
|
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}")
|
||||||
|
|
||||||
find_package(XKBCommon REQUIRED)
|
find_package(XKBCommon REQUIRED)
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
|
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
|
||||||
|
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H)
|
||||||
check_function_exists(memfd_create HAVE_MEMFD_CREATE)
|
check_function_exists(memfd_create HAVE_MEMFD_CREATE)
|
||||||
|
|
||||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"))
|
||||||
find_package(EpollShim)
|
find_package(EpollShim)
|
||||||
if (EPOLLSHIM_FOUND)
|
if (EPOLLSHIM_FOUND)
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}")
|
list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}")
|
||||||
@@ -282,7 +262,6 @@ endif()
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (_GLFW_OSMESA)
|
if (_GLFW_OSMESA)
|
||||||
find_package(OSMesa REQUIRED)
|
find_package(OSMesa REQUIRED)
|
||||||
list(APPEND glfw_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -323,7 +302,7 @@ include(CMakePackageConfigHelpers)
|
|||||||
|
|
||||||
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3")
|
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
|
src/glfw3Config.cmake
|
||||||
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
|
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
|
||||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||||
@@ -332,9 +311,7 @@ write_basic_package_version_file(src/glfw3ConfigVersion.cmake
|
|||||||
VERSION ${GLFW_VERSION}
|
VERSION ${GLFW_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY)
|
configure_file(CMake/glfw3.pc.in src/glfw3.pc @ONLY)
|
||||||
|
|
||||||
configure_file(src/glfw3.pc.in src/glfw3.pc @ONLY)
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Add subdirectories
|
# Add subdirectories
|
||||||
@@ -371,9 +348,14 @@ if (GLFW_INSTALL)
|
|||||||
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
|
|
||||||
|
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
|
||||||
|
install(DIRECTORY "${GLFW_BINARY_DIR}/docs/html"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Only generate this target if no higher-level project already has
|
# Only generate this target if no higher-level project already has
|
||||||
if (NOT TARGET uninstall)
|
if (NOT TARGET uninstall)
|
||||||
configure_file(cmake_uninstall.cmake.in
|
configure_file(CMake/cmake_uninstall.cmake.in
|
||||||
cmake_uninstall.cmake IMMEDIATE @ONLY)
|
cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||||
|
|
||||||
add_custom_target(uninstall
|
add_custom_target(uninstall
|
||||||
|
|||||||
-250
@@ -1,250 +0,0 @@
|
|||||||
# Acknowledgements
|
|
||||||
|
|
||||||
GLFW exists because people around the world donated their time and lent their
|
|
||||||
skills. This list only includes contributions to the main repository and
|
|
||||||
excludes other invaluable contributions like language bindings and text and
|
|
||||||
video tutorials.
|
|
||||||
|
|
||||||
- Bobyshev Alexander
|
|
||||||
- Laurent Aphecetche
|
|
||||||
- Matt Arsenault
|
|
||||||
- ashishgamedev
|
|
||||||
- David Avedissian
|
|
||||||
- Keith Bauer
|
|
||||||
- John Bartholomew
|
|
||||||
- Coşku Baş
|
|
||||||
- Niklas Behrens
|
|
||||||
- Andrew Belt
|
|
||||||
- Nevyn Bengtsson
|
|
||||||
- Niklas Bergström
|
|
||||||
- Denis Bernard
|
|
||||||
- BiBi
|
|
||||||
- Doug Binks
|
|
||||||
- blanco
|
|
||||||
- Waris Boonyasiriwat
|
|
||||||
- Kyle Brenneman
|
|
||||||
- Rok Breulj
|
|
||||||
- TheBrokenRail
|
|
||||||
- Kai Burjack
|
|
||||||
- Martin Capitanio
|
|
||||||
- Nicolas Caramelli
|
|
||||||
- David Carlier
|
|
||||||
- Arturo Castro
|
|
||||||
- Chi-kwan Chan
|
|
||||||
- TheChocolateOre
|
|
||||||
- Joseph Chua
|
|
||||||
- Ian Clarkson
|
|
||||||
- Michał Cichoń
|
|
||||||
- Lambert Clara
|
|
||||||
- Anna Clarke
|
|
||||||
- Josh Codd
|
|
||||||
- Yaron Cohen-Tal
|
|
||||||
- Omar Cornut
|
|
||||||
- Andrew Corrigan
|
|
||||||
- Bailey Cosier
|
|
||||||
- Noel Cower
|
|
||||||
- CuriouserThing
|
|
||||||
- Jason Daly
|
|
||||||
- danhambleton
|
|
||||||
- Jarrod Davis
|
|
||||||
- Olivier Delannoy
|
|
||||||
- Paul R. Deppe
|
|
||||||
- Michael Dickens
|
|
||||||
- Роман Донченко
|
|
||||||
- Mario Dorn
|
|
||||||
- Wolfgang Draxinger
|
|
||||||
- Jonathan Dummer
|
|
||||||
- Ralph Eastwood
|
|
||||||
- Fredrik Ehnbom
|
|
||||||
- Robin Eklind
|
|
||||||
- Jan Ekström
|
|
||||||
- Siavash Eliasi
|
|
||||||
- TheExileFox
|
|
||||||
- Nikita Fediuchin
|
|
||||||
- Felipe Ferreira
|
|
||||||
- Michael Fogleman
|
|
||||||
- Jason Francis
|
|
||||||
- Gerald Franz
|
|
||||||
- Mário Freitas
|
|
||||||
- GeO4d
|
|
||||||
- Marcus Geelnard
|
|
||||||
- ghuser404
|
|
||||||
- Charles Giessen
|
|
||||||
- Ryan C. Gordon
|
|
||||||
- Stephen Gowen
|
|
||||||
- Kovid Goyal
|
|
||||||
- Kevin Grandemange
|
|
||||||
- Eloi Marín Gratacós
|
|
||||||
- Stefan Gustavson
|
|
||||||
- Andrew Gutekanst
|
|
||||||
- Stephen Gutekanst
|
|
||||||
- Jonathan Hale
|
|
||||||
- hdf89shfdfs
|
|
||||||
- Sylvain Hellegouarch
|
|
||||||
- Matthew Henry
|
|
||||||
- heromyth
|
|
||||||
- Lucas Hinderberger
|
|
||||||
- Paul Holden
|
|
||||||
- Hajime Hoshi
|
|
||||||
- Warren Hu
|
|
||||||
- Charles Huber
|
|
||||||
- Brent Huisman
|
|
||||||
- illustris
|
|
||||||
- InKryption
|
|
||||||
- IntellectualKitty
|
|
||||||
- Aaron Jacobs
|
|
||||||
- JannikGM
|
|
||||||
- Erik S. V. Jansson
|
|
||||||
- jjYBdx4IL
|
|
||||||
- Toni Jovanoski
|
|
||||||
- Arseny Kapoulkine
|
|
||||||
- Cem Karan
|
|
||||||
- Osman Keskin
|
|
||||||
- Koray Kilinc
|
|
||||||
- Josh Kilmer
|
|
||||||
- Byunghoon Kim
|
|
||||||
- Cameron King
|
|
||||||
- Peter Knut
|
|
||||||
- Christoph Kubisch
|
|
||||||
- Yuri Kunde Schlesner
|
|
||||||
- Rokas Kupstys
|
|
||||||
- Konstantin Käfer
|
|
||||||
- Eric Larson
|
|
||||||
- Francis Lecavalier
|
|
||||||
- Jong Won Lee
|
|
||||||
- Robin Leffmann
|
|
||||||
- Glenn Lewis
|
|
||||||
- Shane Liesegang
|
|
||||||
- Anders Lindqvist
|
|
||||||
- Leon Linhart
|
|
||||||
- Marco Lizza
|
|
||||||
- Eyal Lotem
|
|
||||||
- Aaron Loucks
|
|
||||||
- Luflosi
|
|
||||||
- lukect
|
|
||||||
- Tristam MacDonald
|
|
||||||
- Hans Mackowiak
|
|
||||||
- Дмитри Малышев
|
|
||||||
- Zbigniew Mandziejewicz
|
|
||||||
- Adam Marcus
|
|
||||||
- Célestin Marot
|
|
||||||
- Kyle McDonald
|
|
||||||
- David V. McKay
|
|
||||||
- David Medlock
|
|
||||||
- Bryce Mehring
|
|
||||||
- Jonathan Mercier
|
|
||||||
- Marcel Metz
|
|
||||||
- Liam Middlebrook
|
|
||||||
- Ave Milia
|
|
||||||
- Jonathan Miller
|
|
||||||
- Kenneth Miller
|
|
||||||
- Bruce Mitchener
|
|
||||||
- Jack Moffitt
|
|
||||||
- Ravi Mohan
|
|
||||||
- Jeff Molofee
|
|
||||||
- Alexander Monakov
|
|
||||||
- Pierre Morel
|
|
||||||
- Jon Morton
|
|
||||||
- Pierre Moulon
|
|
||||||
- Martins Mozeiko
|
|
||||||
- James Murphy
|
|
||||||
- Julian Møller
|
|
||||||
- ndogxj
|
|
||||||
- F. Nedelec
|
|
||||||
- Kristian Nielsen
|
|
||||||
- Joel Niemelä
|
|
||||||
- Kamil Nowakowski
|
|
||||||
- onox
|
|
||||||
- Denis Ovod
|
|
||||||
- Ozzy
|
|
||||||
- Andri Pálsson
|
|
||||||
- Peoro
|
|
||||||
- Braden Pellett
|
|
||||||
- Christopher Pelloux
|
|
||||||
- Arturo J. Pérez
|
|
||||||
- Vladimir Perminov
|
|
||||||
- Olivier Perret
|
|
||||||
- Anthony Pesch
|
|
||||||
- Orson Peters
|
|
||||||
- Emmanuel Gil Peyrot
|
|
||||||
- Cyril Pichard
|
|
||||||
- Pilzschaf
|
|
||||||
- Keith Pitt
|
|
||||||
- Stanislav Podgorskiy
|
|
||||||
- Konstantin Podsvirov
|
|
||||||
- Nathan Poirier
|
|
||||||
- Alexandre Pretyman
|
|
||||||
- Pablo Prietz
|
|
||||||
- przemekmirek
|
|
||||||
- pthom
|
|
||||||
- Martin Pulec
|
|
||||||
- Guillaume Racicot
|
|
||||||
- Philip Rideout
|
|
||||||
- Eddie Ringle
|
|
||||||
- Max Risuhin
|
|
||||||
- Jorge Rodriguez
|
|
||||||
- Luca Rood
|
|
||||||
- Ed Ropple
|
|
||||||
- Aleksey Rybalkin
|
|
||||||
- Mikko Rytkönen
|
|
||||||
- Riku Salminen
|
|
||||||
- Brandon Schaefer
|
|
||||||
- Sebastian Schuberth
|
|
||||||
- Christian Sdunek
|
|
||||||
- Matt Sealey
|
|
||||||
- Steve Sexton
|
|
||||||
- Arkady Shapkin
|
|
||||||
- Ali Sherief
|
|
||||||
- Yoshiki Shibukawa
|
|
||||||
- Dmitri Shuralyov
|
|
||||||
- Joao da Silva
|
|
||||||
- Daniel Sieger
|
|
||||||
- Daniel Skorupski
|
|
||||||
- Slemmie
|
|
||||||
- Bradley Smith
|
|
||||||
- Cliff Smolinsky
|
|
||||||
- Patrick Snape
|
|
||||||
- Erlend Sogge Heggen
|
|
||||||
- Olivier Sohn
|
|
||||||
- Julian Squires
|
|
||||||
- Johannes Stein
|
|
||||||
- Pontus Stenetorp
|
|
||||||
- Michael Stocker
|
|
||||||
- Justin Stoecker
|
|
||||||
- Elviss Strazdins
|
|
||||||
- Paul Sultana
|
|
||||||
- Nathan Sweet
|
|
||||||
- TTK-Bandit
|
|
||||||
- Sergey Tikhomirov
|
|
||||||
- Arthur Tombs
|
|
||||||
- TronicLabs
|
|
||||||
- Ioannis Tsakpinis
|
|
||||||
- Samuli Tuomola
|
|
||||||
- Matthew Turner
|
|
||||||
- urraka
|
|
||||||
- Elias Vanderstuyft
|
|
||||||
- Stef Velzel
|
|
||||||
- Jari Vetoniemi
|
|
||||||
- Ricardo Vieira
|
|
||||||
- Nicholas Vitovitch
|
|
||||||
- Simon Voordouw
|
|
||||||
- Corentin Wallez
|
|
||||||
- Torsten Walluhn
|
|
||||||
- Patrick Walton
|
|
||||||
- Xo Wang
|
|
||||||
- Jay Weisskopf
|
|
||||||
- Frank Wille
|
|
||||||
- Richard A. Wilkes
|
|
||||||
- Tatsuya Yatagawa
|
|
||||||
- Ryogo Yoshimura
|
|
||||||
- Rácz Zalán
|
|
||||||
- Lukas Zanner
|
|
||||||
- Andrey Zholos
|
|
||||||
- Aihui Zhu
|
|
||||||
- Santi Zupancic
|
|
||||||
- Jonas Ådahl
|
|
||||||
- Lasse Öörni
|
|
||||||
- Leonard König
|
|
||||||
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
|
||||||
reports, patches, feedback, testing and encouragement
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# GLFW
|
# GLFW
|
||||||
|
|
||||||
[](https://github.com/glfw/glfw/actions)
|
[](https://travis-ci.org/glfw/glfw)
|
||||||
[](https://ci.appveyor.com/project/elmindreda/glfw)
|
[](https://ci.appveyor.com/project/elmindreda/glfw)
|
||||||
[](https://scan.coverity.com/projects/glfw-glfw)
|
[](https://scan.coverity.com/projects/glfw-glfw)
|
||||||
|
|
||||||
@@ -14,18 +14,18 @@ GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On
|
|||||||
Linux both X11 and Wayland are supported.
|
Linux both X11 and Wayland are supported.
|
||||||
|
|
||||||
GLFW is licensed under the [zlib/libpng
|
GLFW is licensed under the [zlib/libpng
|
||||||
license](https://www.glfw.org/license.html).
|
license](http://www.glfw.org/license.html).
|
||||||
|
|
||||||
You can [download](https://www.glfw.org/download.html) the latest stable release
|
You can [download](http://www.glfw.org/download.html) the latest stable release
|
||||||
as source or Windows binaries, or fetch the `latest` branch from GitHub. Each
|
as source or Windows binaries, or fetch the `latest` branch from GitHub. Each
|
||||||
release starting with 3.0 also has a corresponding [annotated
|
release starting with 3.0 also has a corresponding [annotated
|
||||||
tag](https://github.com/glfw/glfw/releases) with source and binary archives.
|
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
|
The [documentation](http://www.glfw.org/docs/latest/) is available online and is
|
||||||
included in all source and binary archives. See the [release
|
included in all source and binary archives. See the [release
|
||||||
notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and
|
notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and
|
||||||
deprecations in the latest release. For more details see the [version
|
deprecations in the latest release. For more details see the [version
|
||||||
history](https://www.glfw.org/changelog.html).
|
history](http://www.glfw.org/changelog.html).
|
||||||
|
|
||||||
The `master` branch is the stable integration branch and _should_ always compile
|
The `master` branch is the stable integration branch and _should_ always compile
|
||||||
and run on all supported platforms, although details of newly added features may
|
and run on all supported platforms, although details of newly added features may
|
||||||
@@ -34,16 +34,11 @@ fixes live in [other branches](https://github.com/glfw/glfw/branches/all) until
|
|||||||
they are stable enough to merge.
|
they are stable enough to merge.
|
||||||
|
|
||||||
If you are new to GLFW, you may find the
|
If you are new to GLFW, you may find the
|
||||||
[tutorial](https://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If
|
[tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If
|
||||||
you have used GLFW 2 in the past, there is a [transition
|
you have used GLFW 2 in the past, there is a [transition
|
||||||
guide](https://www.glfw.org/docs/latest/moving.html) for moving to the GLFW
|
guide](http://www.glfw.org/docs/latest/moving.html) for moving to the GLFW
|
||||||
3 API.
|
3 API.
|
||||||
|
|
||||||
GLFW exists because of the contributions of [many people](CONTRIBUTORS.md)
|
|
||||||
around the world, whether by reporting bugs, providing community support, adding
|
|
||||||
features, reviewing or testing code, debugging, proofreading docs, suggesting
|
|
||||||
features or fixing bugs.
|
|
||||||
|
|
||||||
|
|
||||||
## Compiling GLFW
|
## Compiling GLFW
|
||||||
|
|
||||||
@@ -57,16 +52,16 @@ 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
|
and Clang. It will likely compile in other environments as well, but this is
|
||||||
not regularly tested.
|
not regularly tested.
|
||||||
|
|
||||||
There are [pre-compiled Windows binaries](https://www.glfw.org/download.html)
|
There are [pre-compiled Windows binaries](http://www.glfw.org/download.html)
|
||||||
available for all supported compilers.
|
available for all supported compilers.
|
||||||
|
|
||||||
See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
|
See the [compilation guide](http://www.glfw.org/docs/latest/compile.html) for
|
||||||
more information about how to compile GLFW yourself.
|
more information about how to compile GLFW yourself.
|
||||||
|
|
||||||
|
|
||||||
## Using GLFW
|
## Using GLFW
|
||||||
|
|
||||||
See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides
|
See the [documentation](http://www.glfw.org/docs/latest/) for tutorials, guides
|
||||||
and the API reference.
|
and the API reference.
|
||||||
|
|
||||||
|
|
||||||
@@ -84,13 +79,14 @@ Unix-like systems running the X Window System are supported even without
|
|||||||
a desktop environment or modern extensions, although some features require
|
a desktop environment or modern extensions, although some features require
|
||||||
a running window or clipboard manager. The OSMesa backend requires Mesa 6.3.
|
a running window or clipboard manager. The OSMesa backend requires Mesa 6.3.
|
||||||
|
|
||||||
See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html)
|
See the [compatibility guide](http://www.glfw.org/docs/latest/compat.html)
|
||||||
in the documentation for more information.
|
in the documentation for more information.
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
GLFW itself depends only on the headers and libraries for your window system.
|
GLFW itself needs only CMake 3.1 or later and the headers and libraries for your
|
||||||
|
OS and window system.
|
||||||
|
|
||||||
The (experimental) Wayland backend also depends on the `extra-cmake-modules`
|
The (experimental) Wayland backend also depends on the `extra-cmake-modules`
|
||||||
package, which is used to generate Wayland protocol headers.
|
package, which is used to generate Wayland protocol headers.
|
||||||
@@ -106,10 +102,10 @@ located in the `deps/` directory.
|
|||||||
functions
|
functions
|
||||||
- [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in
|
- [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in
|
||||||
examples
|
examples
|
||||||
- [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI
|
- [Nuklear](https://github.com/vurtun/nuklear) for test and example UI
|
||||||
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
|
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
|
||||||
|
|
||||||
The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can
|
The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can
|
||||||
find that tool.
|
find that tool.
|
||||||
|
|
||||||
|
|
||||||
@@ -123,84 +119,89 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
|
- Added `glfwGetKeyboardLayoutName` for querying the name of the current
|
||||||
- Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization
|
keyboard layout (#1201)
|
||||||
- Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization
|
- Added `glfwSetKeyboardLayoutCallback` and `GLFWkeyboardlayoutfun` for
|
||||||
- Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092)
|
receiving keyboard layout events (#1201)
|
||||||
- [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different
|
- Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`,
|
||||||
scancode than `PrtSc` (#1993)
|
`GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427)
|
||||||
- [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not
|
- Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427)
|
||||||
match event scancode (#1993)
|
- Added `GLFW_RESIZE_NS_CURSOR` alias for `GLFW_VRESIZE_CURSOR` (#427)
|
||||||
- [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395)
|
- Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427)
|
||||||
- [Win32] Bugfix: The OSMesa library was not unloaded on termination
|
- Updated the minimum required CMake version to 3.1
|
||||||
- [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050)
|
- Disabled tests and examples by default when built as a CMake subdirectory
|
||||||
- [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false
|
- Bugfix: The CMake config-file package used an absolute path and was not
|
||||||
- [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791)
|
relocatable (#1470)
|
||||||
- [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination
|
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
|
||||||
- [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false
|
- Bugfix: Compiling with -Wextra-semi caused warnings (#1440)
|
||||||
- [Cocoa] Bugfix: Changing `GLFW_DECORATED` in macOS fullscreen would abort
|
- Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583)
|
||||||
application (#1886)
|
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
|
||||||
- [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort
|
to the window menu
|
||||||
application (#2110)
|
- [Win32] Added a version info resource to the GLFW DLL
|
||||||
- [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle
|
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
||||||
subdirectory (#2113,#2120)
|
symbol redefinition (#1524)
|
||||||
- [X11] Bugfix: The OSMesa libray was not unloaded on termination
|
- [Win32] Bugfix: The cursor position event was emitted before its cursor enter
|
||||||
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault
|
event (#1490)
|
||||||
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
|
- [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
|
||||||
- [Wayland] Added support for file path drop events (#2040)
|
window (#1499)
|
||||||
- [Wayland] Added support for more human-readable monitor names where available
|
- [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions
|
||||||
- [Wayland] Removed support for the deprecated wl\_shell protocol
|
- [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622)
|
||||||
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
|
- [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an
|
||||||
`glfwGetClipboardString`
|
invalid pointer
|
||||||
- [Wayland] Bugfix: Data source creation error would cause double free at termination
|
- [Win32] Bugfix: Some synthetic key events were reported as `GLFW_KEY_UNKNOWN`
|
||||||
- [Wayland] Bugfix: Partial writes of clipboard string would cause beginning to repeat
|
(#1623)
|
||||||
- [Wayland] Bugfix: Some errors would cause clipboard string transfer to hang
|
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
||||||
- [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string
|
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
||||||
- [Wayland] Bugfix: MIME type matching was not performed for clipboard string
|
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
||||||
- [Wayland] Bugfix: The OSMesa library was not unloaded on termination
|
- [Cocoa] Removed dependency on the CoreVideo framework
|
||||||
- [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_PLATFORM_ERROR`
|
- [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
|
||||||
- [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed
|
- [Cocoa] Bugfix: Window remained on screen after destruction until event poll
|
||||||
- [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995)
|
(#1412)
|
||||||
- [Wayland] Bugfix: A window leaving full screen mode ignored its desired size
|
- [Cocoa] Bugfix: Event processing before window creation would assert (#1543)
|
||||||
- [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
|
- [Cocoa] Bugfix: Undecorated windows could not be iconified on recent macOS
|
||||||
- [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed
|
- [Cocoa] Bugfix: Touching event queue from secondary thread before main thread
|
||||||
- [Wayland] Bugfix: A window maximized or restored by the user would enter an
|
would abort (#1649)
|
||||||
inconsistent state
|
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
|
||||||
- [Wayland] Bugfix: Window maximization events were not emitted
|
- [X11] Bugfix: Key names were not updated when the keyboard layout changed
|
||||||
- [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode
|
(#1462,#1528)
|
||||||
- [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window
|
- [X11] Bugfix: Decorations could not be enabled after window creation (#1566)
|
||||||
- [Wayland] Bugfix: A window content scale event would be emitted every time
|
- [X11] Bugfix: Content scale fallback value could be inconsistent (#1578)
|
||||||
the window resized
|
- [X11] Bugfix: `glfwMaximizeWindow` had no effect on hidden windows
|
||||||
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
|
- [X11] Bugfix: Clearing `GLFW_FLOATING` on a hidden window caused invalid read
|
||||||
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
|
- [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail
|
||||||
(#1991,#2115,#2127)
|
- [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows
|
||||||
- [Wayland] Bugfix: Size limits included frame size for fallback decorations
|
- [X11] Bugfix: Monitor physical dimensions could be reported as zero mm
|
||||||
- [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side
|
- [X11] Bugfix: Window position events were not emitted during resizing (#1613)
|
||||||
decorations
|
- [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
|
||||||
- [Wayland] Bugfix: A monitor would be reported as connected again if its scale
|
- [X11] Bugfix: Querying a disconnected monitor could segfault (#1602)
|
||||||
changed
|
- [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
|
||||||
- [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed
|
- [X11] Bugfix: Termination would segfault if the IM had been destroyed
|
||||||
scale
|
- [X11] Bugfix: Any IM started after initialization would not be detected
|
||||||
- [Wayland] Bugfix: Window content scale events were not emitted when monitor
|
- [X11] Bugfix: Xlib errors caused by other parts of the application could be
|
||||||
scale changed
|
reported as GLFW errors
|
||||||
- [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of
|
- [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633)
|
||||||
applying the specified ratio
|
- [X11] Bugfix: XKB path used keysyms instead of physical locations for
|
||||||
- [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect
|
non-printable keys (#1598)
|
||||||
- [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show
|
- [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout
|
||||||
- [Wayland] Bugfix: Hiding and then showing a window caused program abort on
|
combinaitons (#1598)
|
||||||
wlroots compositors (#1268)
|
- [Wayland] Removed support for `wl_shell` (#1443)
|
||||||
- [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
|
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||||
decorations
|
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
|
||||||
|
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||||
|
- [NSGL] Removed enforcement of forward-compatible flag for core contexts
|
||||||
|
- [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)
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
On [glfw.org](https://www.glfw.org/) you can find the latest version of GLFW, as
|
On [glfw.org](http://www.glfw.org/) you can find the latest version of GLFW, as
|
||||||
well as news, documentation and other information about the project.
|
well as news, documentation and other information about the project.
|
||||||
|
|
||||||
If you have questions related to the use of GLFW, we have a
|
If you have questions related to the use of GLFW, we have a
|
||||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||||
[Libera.Chat](https://libera.chat/).
|
[Freenode](http://freenode.net/).
|
||||||
|
|
||||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||||
request, please file it in the
|
request, please file it in the
|
||||||
@@ -209,3 +210,201 @@ request, please file it in the
|
|||||||
Finally, if you're interested in helping out with the development of GLFW or
|
Finally, if you're interested in helping out with the development of GLFW or
|
||||||
porting it to your favorite platform, join us on the forum, GitHub or IRC.
|
porting it to your favorite platform, join us on the forum, GitHub or IRC.
|
||||||
|
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
|
||||||
|
GLFW exists because people around the world donated their time and lent their
|
||||||
|
skills.
|
||||||
|
|
||||||
|
- Bobyshev Alexander
|
||||||
|
- Matt Arsenault
|
||||||
|
- David Avedissian
|
||||||
|
- Keith Bauer
|
||||||
|
- John Bartholomew
|
||||||
|
- Coşku Baş
|
||||||
|
- Niklas Behrens
|
||||||
|
- Andrew Belt
|
||||||
|
- Niklas Bergström
|
||||||
|
- Denis Bernard
|
||||||
|
- Doug Binks
|
||||||
|
- blanco
|
||||||
|
- Kyle Brenneman
|
||||||
|
- Rok Breulj
|
||||||
|
- Kai Burjack
|
||||||
|
- Martin Capitanio
|
||||||
|
- David Carlier
|
||||||
|
- Arturo Castro
|
||||||
|
- Chi-kwan Chan
|
||||||
|
- Ian Clarkson
|
||||||
|
- Michał Cichoń
|
||||||
|
- Lambert Clara
|
||||||
|
- Anna Clarke
|
||||||
|
- Yaron Cohen-Tal
|
||||||
|
- Omar Cornut
|
||||||
|
- Andrew Corrigan
|
||||||
|
- Bailey Cosier
|
||||||
|
- Noel Cower
|
||||||
|
- Jason Daly
|
||||||
|
- Jarrod Davis
|
||||||
|
- Olivier Delannoy
|
||||||
|
- Paul R. Deppe
|
||||||
|
- Michael Dickens
|
||||||
|
- Роман Донченко
|
||||||
|
- Mario Dorn
|
||||||
|
- Wolfgang Draxinger
|
||||||
|
- Jonathan Dummer
|
||||||
|
- Ralph Eastwood
|
||||||
|
- Fredrik Ehnbom
|
||||||
|
- Robin Eklind
|
||||||
|
- Siavash Eliasi
|
||||||
|
- Felipe Ferreira
|
||||||
|
- Michael Fogleman
|
||||||
|
- Gerald Franz
|
||||||
|
- Mário Freitas
|
||||||
|
- GeO4d
|
||||||
|
- Marcus Geelnard
|
||||||
|
- Charles Giessen
|
||||||
|
- Ryan C. Gordon
|
||||||
|
- Stephen Gowen
|
||||||
|
- Kovid Goyal
|
||||||
|
- Eloi Marín Gratacós
|
||||||
|
- Stefan Gustavson
|
||||||
|
- Jonathan Hale
|
||||||
|
- Sylvain Hellegouarch
|
||||||
|
- Matthew Henry
|
||||||
|
- heromyth
|
||||||
|
- Lucas Hinderberger
|
||||||
|
- Paul Holden
|
||||||
|
- Warren Hu
|
||||||
|
- Charles Huber
|
||||||
|
- IntellectualKitty
|
||||||
|
- Aaron Jacobs
|
||||||
|
- Erik S. V. Jansson
|
||||||
|
- Toni Jovanoski
|
||||||
|
- Arseny Kapoulkine
|
||||||
|
- Cem Karan
|
||||||
|
- Osman Keskin
|
||||||
|
- Josh Kilmer
|
||||||
|
- Byunghoon Kim
|
||||||
|
- Cameron King
|
||||||
|
- Peter Knut
|
||||||
|
- Christoph Kubisch
|
||||||
|
- Yuri Kunde Schlesner
|
||||||
|
- Rokas Kupstys
|
||||||
|
- Konstantin Käfer
|
||||||
|
- Eric Larson
|
||||||
|
- Francis Lecavalier
|
||||||
|
- Robin Leffmann
|
||||||
|
- Glenn Lewis
|
||||||
|
- Shane Liesegang
|
||||||
|
- Anders Lindqvist
|
||||||
|
- Leon Linhart
|
||||||
|
- Eyal Lotem
|
||||||
|
- Aaron Loucks
|
||||||
|
- Luflosi
|
||||||
|
- lukect
|
||||||
|
- Tristam MacDonald
|
||||||
|
- Hans Mackowiak
|
||||||
|
- Дмитри Малышев
|
||||||
|
- Zbigniew Mandziejewicz
|
||||||
|
- Adam Marcus
|
||||||
|
- Célestin Marot
|
||||||
|
- Kyle McDonald
|
||||||
|
- David Medlock
|
||||||
|
- Bryce Mehring
|
||||||
|
- Jonathan Mercier
|
||||||
|
- Marcel Metz
|
||||||
|
- Liam Middlebrook
|
||||||
|
- Ave Milia
|
||||||
|
- Jonathan Miller
|
||||||
|
- Kenneth Miller
|
||||||
|
- Bruce Mitchener
|
||||||
|
- Jack Moffitt
|
||||||
|
- Jeff Molofee
|
||||||
|
- Alexander Monakov
|
||||||
|
- Pierre Morel
|
||||||
|
- Jon Morton
|
||||||
|
- Pierre Moulon
|
||||||
|
- Martins Mozeiko
|
||||||
|
- Julian Møller
|
||||||
|
- ndogxj
|
||||||
|
- Kristian Nielsen
|
||||||
|
- Kamil Nowakowski
|
||||||
|
- Denis Ovod
|
||||||
|
- Ozzy
|
||||||
|
- Andri Pálsson
|
||||||
|
- Peoro
|
||||||
|
- Braden Pellett
|
||||||
|
- Christopher Pelloux
|
||||||
|
- Arturo J. Pérez
|
||||||
|
- Anthony Pesch
|
||||||
|
- Orson Peters
|
||||||
|
- Emmanuel Gil Peyrot
|
||||||
|
- Cyril Pichard
|
||||||
|
- Keith Pitt
|
||||||
|
- Stanislav Podgorskiy
|
||||||
|
- Konstantin Podsvirov
|
||||||
|
- Nathan Poirier
|
||||||
|
- Alexandre Pretyman
|
||||||
|
- Pablo Prietz
|
||||||
|
- przemekmirek
|
||||||
|
- pthom
|
||||||
|
- Guillaume Racicot
|
||||||
|
- Philip Rideout
|
||||||
|
- Eddie Ringle
|
||||||
|
- Max Risuhin
|
||||||
|
- Jorge Rodriguez
|
||||||
|
- Ed Ropple
|
||||||
|
- Aleksey Rybalkin
|
||||||
|
- Riku Salminen
|
||||||
|
- Brandon Schaefer
|
||||||
|
- Sebastian Schuberth
|
||||||
|
- Christian Sdunek
|
||||||
|
- Matt Sealey
|
||||||
|
- Steve Sexton
|
||||||
|
- Arkady Shapkin
|
||||||
|
- Ali Sherief
|
||||||
|
- Yoshiki Shibukawa
|
||||||
|
- Dmitri Shuralyov
|
||||||
|
- Daniel Skorupski
|
||||||
|
- Bradley Smith
|
||||||
|
- Cliff Smolinsky
|
||||||
|
- Patrick Snape
|
||||||
|
- Erlend Sogge Heggen
|
||||||
|
- Julian Squires
|
||||||
|
- Johannes Stein
|
||||||
|
- Pontus Stenetorp
|
||||||
|
- Michael Stocker
|
||||||
|
- Justin Stoecker
|
||||||
|
- Elviss Strazdins
|
||||||
|
- Paul Sultana
|
||||||
|
- Nathan Sweet
|
||||||
|
- TTK-Bandit
|
||||||
|
- Jared Tiala
|
||||||
|
- Sergey Tikhomirov
|
||||||
|
- Arthur Tombs
|
||||||
|
- Ioannis Tsakpinis
|
||||||
|
- Samuli Tuomola
|
||||||
|
- Matthew Turner
|
||||||
|
- urraka
|
||||||
|
- Elias Vanderstuyft
|
||||||
|
- Stef Velzel
|
||||||
|
- Jari Vetoniemi
|
||||||
|
- Ricardo Vieira
|
||||||
|
- Nicholas Vitovitch
|
||||||
|
- Simon Voordouw
|
||||||
|
- Corentin Wallez
|
||||||
|
- Torsten Walluhn
|
||||||
|
- Patrick Walton
|
||||||
|
- Xo Wang
|
||||||
|
- Jay Weisskopf
|
||||||
|
- Frank Wille
|
||||||
|
- Ryogo Yoshimura
|
||||||
|
- Lukas Zanner
|
||||||
|
- Andrey Zholos
|
||||||
|
- Santi Zupancic
|
||||||
|
- Jonas Ådahl
|
||||||
|
- Lasse Öörni
|
||||||
|
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||||
|
reports, patches, feedback, testing and encouragement
|
||||||
|
|
||||||
|
|||||||
Vendored
+14
-6
@@ -2,9 +2,19 @@
|
|||||||
/* File: vk_platform.h */
|
/* File: vk_platform.h */
|
||||||
/* */
|
/* */
|
||||||
/*
|
/*
|
||||||
** Copyright 2014-2022 The Khronos Group Inc.
|
** Copyright (c) 2014-2017 The Khronos Group Inc.
|
||||||
**
|
**
|
||||||
** SPDX-License-Identifier: Apache-2.0
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +52,7 @@ extern "C"
|
|||||||
#define VKAPI_CALL __stdcall
|
#define VKAPI_CALL __stdcall
|
||||||
#define VKAPI_PTR VKAPI_CALL
|
#define VKAPI_PTR VKAPI_CALL
|
||||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||||
#error "Vulkan is not supported for the 'armeabi' NDK ABI"
|
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
|
||||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||||
/* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
|
/* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
|
||||||
/* calling convention, i.e. float parameters are passed in registers. This */
|
/* calling convention, i.e. float parameters are passed in registers. This */
|
||||||
@@ -58,9 +68,7 @@ extern "C"
|
|||||||
#define VKAPI_PTR
|
#define VKAPI_PTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(VK_NO_STDDEF_H)
|
#include <stddef.h>
|
||||||
#include <stddef.h>
|
|
||||||
#endif /* !defined(VK_NO_STDDEF_H) */
|
|
||||||
|
|
||||||
#if !defined(VK_NO_STDINT_H)
|
#if !defined(VK_NO_STDINT_H)
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||||
|
|||||||
Vendored
+356
-2384
File diff suppressed because it is too large
Load Diff
Vendored
+208
-348
@@ -14,18 +14,10 @@
|
|||||||
|
|
||||||
#endif /* GLAD_IMPL_UTIL_C_ */
|
#endif /* GLAD_IMPL_UTIL_C_ */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int GLAD_VK_VERSION_1_0 = 0;
|
int GLAD_VK_VERSION_1_0 = 0;
|
||||||
int GLAD_VK_VERSION_1_1 = 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_EXT_debug_report = 0;
|
||||||
int GLAD_VK_KHR_portability_enumeration = 0;
|
|
||||||
int GLAD_VK_KHR_surface = 0;
|
int GLAD_VK_KHR_surface = 0;
|
||||||
int GLAD_VK_KHR_swapchain = 0;
|
int GLAD_VK_KHR_swapchain = 0;
|
||||||
|
|
||||||
@@ -43,26 +35,18 @@ PFN_vkBindImageMemory glad_vkBindImageMemory = NULL;
|
|||||||
PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
|
PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
|
||||||
PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
|
PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
|
||||||
PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
|
PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
|
||||||
PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL;
|
|
||||||
PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL;
|
|
||||||
PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
|
PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
|
||||||
PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
|
PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
|
||||||
PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
|
PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
|
||||||
PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
|
PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
|
||||||
PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL;
|
|
||||||
PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
|
PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
|
||||||
PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL;
|
|
||||||
PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
|
PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
|
||||||
PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
|
PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
|
||||||
PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
|
PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
|
||||||
PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
|
PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
|
||||||
PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL;
|
|
||||||
PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
|
PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
|
||||||
PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL;
|
|
||||||
PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
|
PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
|
||||||
PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL;
|
|
||||||
PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
|
PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
|
||||||
PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL;
|
|
||||||
PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
|
PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
|
||||||
PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
|
PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
|
||||||
PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
|
PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
|
||||||
@@ -70,56 +54,31 @@ PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL;
|
|||||||
PFN_vkCmdDraw glad_vkCmdDraw = NULL;
|
PFN_vkCmdDraw glad_vkCmdDraw = NULL;
|
||||||
PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
|
PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
|
||||||
PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
|
PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
|
||||||
PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL;
|
|
||||||
PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
|
PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
|
||||||
PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL;
|
|
||||||
PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
|
PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
|
||||||
PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
|
PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
|
||||||
PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL;
|
|
||||||
PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL;
|
|
||||||
PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
|
PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
|
||||||
PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
|
PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
|
||||||
PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
|
PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
|
||||||
PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL;
|
|
||||||
PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
|
PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
|
||||||
PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL;
|
|
||||||
PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
|
PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
|
||||||
PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
|
PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
|
||||||
PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL;
|
|
||||||
PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
|
PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
|
||||||
PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
|
PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
|
||||||
PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL;
|
|
||||||
PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
|
PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
|
||||||
PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL;
|
|
||||||
PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
|
PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
|
||||||
PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL;
|
|
||||||
PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = 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_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL;
|
||||||
PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
|
PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
|
||||||
PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL;
|
|
||||||
PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL;
|
|
||||||
PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = 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_vkCmdSetScissor glad_vkCmdSetScissor = NULL;
|
||||||
PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL;
|
|
||||||
PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
|
PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
|
||||||
PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL;
|
|
||||||
PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
|
PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
|
||||||
PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL;
|
|
||||||
PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
|
PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
|
||||||
PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
|
PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
|
||||||
PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL;
|
|
||||||
PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
|
PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
|
||||||
PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
|
PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
|
||||||
PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL;
|
|
||||||
PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
|
PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
|
||||||
PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL;
|
|
||||||
PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
|
PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
|
||||||
PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
|
PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
|
||||||
PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
|
PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
|
||||||
@@ -138,10 +97,8 @@ PFN_vkCreateImageView glad_vkCreateImageView = NULL;
|
|||||||
PFN_vkCreateInstance glad_vkCreateInstance = NULL;
|
PFN_vkCreateInstance glad_vkCreateInstance = NULL;
|
||||||
PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
|
PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
|
||||||
PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
|
PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
|
||||||
PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL;
|
|
||||||
PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
|
PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
|
||||||
PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
|
PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
|
||||||
PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL;
|
|
||||||
PFN_vkCreateSampler glad_vkCreateSampler = NULL;
|
PFN_vkCreateSampler glad_vkCreateSampler = NULL;
|
||||||
PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
|
PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
|
||||||
PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
|
PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
|
||||||
@@ -165,7 +122,6 @@ PFN_vkDestroyInstance glad_vkDestroyInstance = NULL;
|
|||||||
PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
|
PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
|
||||||
PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
|
PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
|
||||||
PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
|
PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
|
||||||
PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL;
|
|
||||||
PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
|
PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
|
||||||
PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
|
PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
|
||||||
PFN_vkDestroySampler glad_vkDestroySampler = NULL;
|
PFN_vkDestroySampler glad_vkDestroySampler = NULL;
|
||||||
@@ -187,19 +143,13 @@ PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL;
|
|||||||
PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
|
PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
|
||||||
PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
|
PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
|
||||||
PFN_vkFreeMemory glad_vkFreeMemory = NULL;
|
PFN_vkFreeMemory glad_vkFreeMemory = NULL;
|
||||||
PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL;
|
|
||||||
PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
|
PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
|
||||||
PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
|
PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
|
||||||
PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL;
|
|
||||||
PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
|
PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
|
||||||
PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL;
|
|
||||||
PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
|
PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
|
||||||
PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
|
PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
|
||||||
PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
|
PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
|
||||||
PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL;
|
|
||||||
PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL;
|
|
||||||
PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
|
PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
|
||||||
PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL;
|
|
||||||
PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
|
PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
|
||||||
PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
|
PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
|
||||||
PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
|
PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
|
||||||
@@ -233,12 +183,9 @@ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCap
|
|||||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
|
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
|
||||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
|
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
|
||||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
|
PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
|
||||||
PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL;
|
|
||||||
PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
|
PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
|
||||||
PFN_vkGetPrivateData glad_vkGetPrivateData = NULL;
|
|
||||||
PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
|
PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
|
||||||
PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
|
PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
|
||||||
PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL;
|
|
||||||
PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
|
PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
|
||||||
PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
|
PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
|
||||||
PFN_vkMapMemory glad_vkMapMemory = NULL;
|
PFN_vkMapMemory glad_vkMapMemory = NULL;
|
||||||
@@ -246,277 +193,216 @@ PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL;
|
|||||||
PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
|
PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
|
||||||
PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
|
PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
|
||||||
PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
|
PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
|
||||||
PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL;
|
|
||||||
PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
|
PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
|
||||||
PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
|
PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
|
||||||
PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
|
PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
|
||||||
PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
|
PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
|
||||||
PFN_vkResetEvent glad_vkResetEvent = NULL;
|
PFN_vkResetEvent glad_vkResetEvent = NULL;
|
||||||
PFN_vkResetFences glad_vkResetFences = NULL;
|
PFN_vkResetFences glad_vkResetFences = NULL;
|
||||||
PFN_vkResetQueryPool glad_vkResetQueryPool = NULL;
|
|
||||||
PFN_vkSetEvent glad_vkSetEvent = NULL;
|
PFN_vkSetEvent glad_vkSetEvent = NULL;
|
||||||
PFN_vkSetPrivateData glad_vkSetPrivateData = NULL;
|
|
||||||
PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL;
|
|
||||||
PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
|
PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
|
||||||
PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
|
PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
|
||||||
PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
|
PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
|
||||||
PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
|
PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
|
||||||
PFN_vkWaitForFences glad_vkWaitForFences = NULL;
|
PFN_vkWaitForFences glad_vkWaitForFences = NULL;
|
||||||
PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
|
static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
|
||||||
if(!GLAD_VK_VERSION_1_0) return;
|
if(!GLAD_VK_VERSION_1_0) return;
|
||||||
glad_vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load(userptr, "vkAllocateCommandBuffers");
|
vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load("vkAllocateCommandBuffers", userptr);
|
||||||
glad_vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load(userptr, "vkAllocateDescriptorSets");
|
vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load("vkAllocateDescriptorSets", userptr);
|
||||||
glad_vkAllocateMemory = (PFN_vkAllocateMemory) load(userptr, "vkAllocateMemory");
|
vkAllocateMemory = (PFN_vkAllocateMemory) load("vkAllocateMemory", userptr);
|
||||||
glad_vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load(userptr, "vkBeginCommandBuffer");
|
vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load("vkBeginCommandBuffer", userptr);
|
||||||
glad_vkBindBufferMemory = (PFN_vkBindBufferMemory) load(userptr, "vkBindBufferMemory");
|
vkBindBufferMemory = (PFN_vkBindBufferMemory) load("vkBindBufferMemory", userptr);
|
||||||
glad_vkBindImageMemory = (PFN_vkBindImageMemory) load(userptr, "vkBindImageMemory");
|
vkBindImageMemory = (PFN_vkBindImageMemory) load("vkBindImageMemory", userptr);
|
||||||
glad_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load(userptr, "vkCmdBeginQuery");
|
vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load("vkCmdBeginQuery", userptr);
|
||||||
glad_vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load(userptr, "vkCmdBeginRenderPass");
|
vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load("vkCmdBeginRenderPass", userptr);
|
||||||
glad_vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load(userptr, "vkCmdBindDescriptorSets");
|
vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load("vkCmdBindDescriptorSets", userptr);
|
||||||
glad_vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load(userptr, "vkCmdBindIndexBuffer");
|
vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load("vkCmdBindIndexBuffer", userptr);
|
||||||
glad_vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load(userptr, "vkCmdBindPipeline");
|
vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load("vkCmdBindPipeline", userptr);
|
||||||
glad_vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load(userptr, "vkCmdBindVertexBuffers");
|
vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load("vkCmdBindVertexBuffers", userptr);
|
||||||
glad_vkCmdBlitImage = (PFN_vkCmdBlitImage) load(userptr, "vkCmdBlitImage");
|
vkCmdBlitImage = (PFN_vkCmdBlitImage) load("vkCmdBlitImage", userptr);
|
||||||
glad_vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load(userptr, "vkCmdClearAttachments");
|
vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load("vkCmdClearAttachments", userptr);
|
||||||
glad_vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load(userptr, "vkCmdClearColorImage");
|
vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load("vkCmdClearColorImage", userptr);
|
||||||
glad_vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load(userptr, "vkCmdClearDepthStencilImage");
|
vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load("vkCmdClearDepthStencilImage", userptr);
|
||||||
glad_vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load(userptr, "vkCmdCopyBuffer");
|
vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load("vkCmdCopyBuffer", userptr);
|
||||||
glad_vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load(userptr, "vkCmdCopyBufferToImage");
|
vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load("vkCmdCopyBufferToImage", userptr);
|
||||||
glad_vkCmdCopyImage = (PFN_vkCmdCopyImage) load(userptr, "vkCmdCopyImage");
|
vkCmdCopyImage = (PFN_vkCmdCopyImage) load("vkCmdCopyImage", userptr);
|
||||||
glad_vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load(userptr, "vkCmdCopyImageToBuffer");
|
vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load("vkCmdCopyImageToBuffer", userptr);
|
||||||
glad_vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load(userptr, "vkCmdCopyQueryPoolResults");
|
vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load("vkCmdCopyQueryPoolResults", userptr);
|
||||||
glad_vkCmdDispatch = (PFN_vkCmdDispatch) load(userptr, "vkCmdDispatch");
|
vkCmdDispatch = (PFN_vkCmdDispatch) load("vkCmdDispatch", userptr);
|
||||||
glad_vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load(userptr, "vkCmdDispatchIndirect");
|
vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load("vkCmdDispatchIndirect", userptr);
|
||||||
glad_vkCmdDraw = (PFN_vkCmdDraw) load(userptr, "vkCmdDraw");
|
vkCmdDraw = (PFN_vkCmdDraw) load("vkCmdDraw", userptr);
|
||||||
glad_vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load(userptr, "vkCmdDrawIndexed");
|
vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load("vkCmdDrawIndexed", userptr);
|
||||||
glad_vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load(userptr, "vkCmdDrawIndexedIndirect");
|
vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load("vkCmdDrawIndexedIndirect", userptr);
|
||||||
glad_vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load(userptr, "vkCmdDrawIndirect");
|
vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load("vkCmdDrawIndirect", userptr);
|
||||||
glad_vkCmdEndQuery = (PFN_vkCmdEndQuery) load(userptr, "vkCmdEndQuery");
|
vkCmdEndQuery = (PFN_vkCmdEndQuery) load("vkCmdEndQuery", userptr);
|
||||||
glad_vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load(userptr, "vkCmdEndRenderPass");
|
vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load("vkCmdEndRenderPass", userptr);
|
||||||
glad_vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load(userptr, "vkCmdExecuteCommands");
|
vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load("vkCmdExecuteCommands", userptr);
|
||||||
glad_vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load(userptr, "vkCmdFillBuffer");
|
vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load("vkCmdFillBuffer", userptr);
|
||||||
glad_vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load(userptr, "vkCmdNextSubpass");
|
vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load("vkCmdNextSubpass", userptr);
|
||||||
glad_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load(userptr, "vkCmdPipelineBarrier");
|
vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load("vkCmdPipelineBarrier", userptr);
|
||||||
glad_vkCmdPushConstants = (PFN_vkCmdPushConstants) load(userptr, "vkCmdPushConstants");
|
vkCmdPushConstants = (PFN_vkCmdPushConstants) load("vkCmdPushConstants", userptr);
|
||||||
glad_vkCmdResetEvent = (PFN_vkCmdResetEvent) load(userptr, "vkCmdResetEvent");
|
vkCmdResetEvent = (PFN_vkCmdResetEvent) load("vkCmdResetEvent", userptr);
|
||||||
glad_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load(userptr, "vkCmdResetQueryPool");
|
vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load("vkCmdResetQueryPool", userptr);
|
||||||
glad_vkCmdResolveImage = (PFN_vkCmdResolveImage) load(userptr, "vkCmdResolveImage");
|
vkCmdResolveImage = (PFN_vkCmdResolveImage) load("vkCmdResolveImage", userptr);
|
||||||
glad_vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load(userptr, "vkCmdSetBlendConstants");
|
vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load("vkCmdSetBlendConstants", userptr);
|
||||||
glad_vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load(userptr, "vkCmdSetDepthBias");
|
vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load("vkCmdSetDepthBias", userptr);
|
||||||
glad_vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load(userptr, "vkCmdSetDepthBounds");
|
vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load("vkCmdSetDepthBounds", userptr);
|
||||||
glad_vkCmdSetEvent = (PFN_vkCmdSetEvent) load(userptr, "vkCmdSetEvent");
|
vkCmdSetEvent = (PFN_vkCmdSetEvent) load("vkCmdSetEvent", userptr);
|
||||||
glad_vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load(userptr, "vkCmdSetLineWidth");
|
vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load("vkCmdSetLineWidth", userptr);
|
||||||
glad_vkCmdSetScissor = (PFN_vkCmdSetScissor) load(userptr, "vkCmdSetScissor");
|
vkCmdSetScissor = (PFN_vkCmdSetScissor) load("vkCmdSetScissor", userptr);
|
||||||
glad_vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load(userptr, "vkCmdSetStencilCompareMask");
|
vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load("vkCmdSetStencilCompareMask", userptr);
|
||||||
glad_vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load(userptr, "vkCmdSetStencilReference");
|
vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load("vkCmdSetStencilReference", userptr);
|
||||||
glad_vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load(userptr, "vkCmdSetStencilWriteMask");
|
vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load("vkCmdSetStencilWriteMask", userptr);
|
||||||
glad_vkCmdSetViewport = (PFN_vkCmdSetViewport) load(userptr, "vkCmdSetViewport");
|
vkCmdSetViewport = (PFN_vkCmdSetViewport) load("vkCmdSetViewport", userptr);
|
||||||
glad_vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load(userptr, "vkCmdUpdateBuffer");
|
vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load("vkCmdUpdateBuffer", userptr);
|
||||||
glad_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load(userptr, "vkCmdWaitEvents");
|
vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load("vkCmdWaitEvents", userptr);
|
||||||
glad_vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load(userptr, "vkCmdWriteTimestamp");
|
vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load("vkCmdWriteTimestamp", userptr);
|
||||||
glad_vkCreateBuffer = (PFN_vkCreateBuffer) load(userptr, "vkCreateBuffer");
|
vkCreateBuffer = (PFN_vkCreateBuffer) load("vkCreateBuffer", userptr);
|
||||||
glad_vkCreateBufferView = (PFN_vkCreateBufferView) load(userptr, "vkCreateBufferView");
|
vkCreateBufferView = (PFN_vkCreateBufferView) load("vkCreateBufferView", userptr);
|
||||||
glad_vkCreateCommandPool = (PFN_vkCreateCommandPool) load(userptr, "vkCreateCommandPool");
|
vkCreateCommandPool = (PFN_vkCreateCommandPool) load("vkCreateCommandPool", userptr);
|
||||||
glad_vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load(userptr, "vkCreateComputePipelines");
|
vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load("vkCreateComputePipelines", userptr);
|
||||||
glad_vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load(userptr, "vkCreateDescriptorPool");
|
vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load("vkCreateDescriptorPool", userptr);
|
||||||
glad_vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load(userptr, "vkCreateDescriptorSetLayout");
|
vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load("vkCreateDescriptorSetLayout", userptr);
|
||||||
glad_vkCreateDevice = (PFN_vkCreateDevice) load(userptr, "vkCreateDevice");
|
vkCreateDevice = (PFN_vkCreateDevice) load("vkCreateDevice", userptr);
|
||||||
glad_vkCreateEvent = (PFN_vkCreateEvent) load(userptr, "vkCreateEvent");
|
vkCreateEvent = (PFN_vkCreateEvent) load("vkCreateEvent", userptr);
|
||||||
glad_vkCreateFence = (PFN_vkCreateFence) load(userptr, "vkCreateFence");
|
vkCreateFence = (PFN_vkCreateFence) load("vkCreateFence", userptr);
|
||||||
glad_vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load(userptr, "vkCreateFramebuffer");
|
vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load("vkCreateFramebuffer", userptr);
|
||||||
glad_vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load(userptr, "vkCreateGraphicsPipelines");
|
vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load("vkCreateGraphicsPipelines", userptr);
|
||||||
glad_vkCreateImage = (PFN_vkCreateImage) load(userptr, "vkCreateImage");
|
vkCreateImage = (PFN_vkCreateImage) load("vkCreateImage", userptr);
|
||||||
glad_vkCreateImageView = (PFN_vkCreateImageView) load(userptr, "vkCreateImageView");
|
vkCreateImageView = (PFN_vkCreateImageView) load("vkCreateImageView", userptr);
|
||||||
glad_vkCreateInstance = (PFN_vkCreateInstance) load(userptr, "vkCreateInstance");
|
vkCreateInstance = (PFN_vkCreateInstance) load("vkCreateInstance", userptr);
|
||||||
glad_vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load(userptr, "vkCreatePipelineCache");
|
vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load("vkCreatePipelineCache", userptr);
|
||||||
glad_vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load(userptr, "vkCreatePipelineLayout");
|
vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load("vkCreatePipelineLayout", userptr);
|
||||||
glad_vkCreateQueryPool = (PFN_vkCreateQueryPool) load(userptr, "vkCreateQueryPool");
|
vkCreateQueryPool = (PFN_vkCreateQueryPool) load("vkCreateQueryPool", userptr);
|
||||||
glad_vkCreateRenderPass = (PFN_vkCreateRenderPass) load(userptr, "vkCreateRenderPass");
|
vkCreateRenderPass = (PFN_vkCreateRenderPass) load("vkCreateRenderPass", userptr);
|
||||||
glad_vkCreateSampler = (PFN_vkCreateSampler) load(userptr, "vkCreateSampler");
|
vkCreateSampler = (PFN_vkCreateSampler) load("vkCreateSampler", userptr);
|
||||||
glad_vkCreateSemaphore = (PFN_vkCreateSemaphore) load(userptr, "vkCreateSemaphore");
|
vkCreateSemaphore = (PFN_vkCreateSemaphore) load("vkCreateSemaphore", userptr);
|
||||||
glad_vkCreateShaderModule = (PFN_vkCreateShaderModule) load(userptr, "vkCreateShaderModule");
|
vkCreateShaderModule = (PFN_vkCreateShaderModule) load("vkCreateShaderModule", userptr);
|
||||||
glad_vkDestroyBuffer = (PFN_vkDestroyBuffer) load(userptr, "vkDestroyBuffer");
|
vkDestroyBuffer = (PFN_vkDestroyBuffer) load("vkDestroyBuffer", userptr);
|
||||||
glad_vkDestroyBufferView = (PFN_vkDestroyBufferView) load(userptr, "vkDestroyBufferView");
|
vkDestroyBufferView = (PFN_vkDestroyBufferView) load("vkDestroyBufferView", userptr);
|
||||||
glad_vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load(userptr, "vkDestroyCommandPool");
|
vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load("vkDestroyCommandPool", userptr);
|
||||||
glad_vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load(userptr, "vkDestroyDescriptorPool");
|
vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load("vkDestroyDescriptorPool", userptr);
|
||||||
glad_vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load(userptr, "vkDestroyDescriptorSetLayout");
|
vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load("vkDestroyDescriptorSetLayout", userptr);
|
||||||
glad_vkDestroyDevice = (PFN_vkDestroyDevice) load(userptr, "vkDestroyDevice");
|
vkDestroyDevice = (PFN_vkDestroyDevice) load("vkDestroyDevice", userptr);
|
||||||
glad_vkDestroyEvent = (PFN_vkDestroyEvent) load(userptr, "vkDestroyEvent");
|
vkDestroyEvent = (PFN_vkDestroyEvent) load("vkDestroyEvent", userptr);
|
||||||
glad_vkDestroyFence = (PFN_vkDestroyFence) load(userptr, "vkDestroyFence");
|
vkDestroyFence = (PFN_vkDestroyFence) load("vkDestroyFence", userptr);
|
||||||
glad_vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load(userptr, "vkDestroyFramebuffer");
|
vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load("vkDestroyFramebuffer", userptr);
|
||||||
glad_vkDestroyImage = (PFN_vkDestroyImage) load(userptr, "vkDestroyImage");
|
vkDestroyImage = (PFN_vkDestroyImage) load("vkDestroyImage", userptr);
|
||||||
glad_vkDestroyImageView = (PFN_vkDestroyImageView) load(userptr, "vkDestroyImageView");
|
vkDestroyImageView = (PFN_vkDestroyImageView) load("vkDestroyImageView", userptr);
|
||||||
glad_vkDestroyInstance = (PFN_vkDestroyInstance) load(userptr, "vkDestroyInstance");
|
vkDestroyInstance = (PFN_vkDestroyInstance) load("vkDestroyInstance", userptr);
|
||||||
glad_vkDestroyPipeline = (PFN_vkDestroyPipeline) load(userptr, "vkDestroyPipeline");
|
vkDestroyPipeline = (PFN_vkDestroyPipeline) load("vkDestroyPipeline", userptr);
|
||||||
glad_vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load(userptr, "vkDestroyPipelineCache");
|
vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load("vkDestroyPipelineCache", userptr);
|
||||||
glad_vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load(userptr, "vkDestroyPipelineLayout");
|
vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load("vkDestroyPipelineLayout", userptr);
|
||||||
glad_vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load(userptr, "vkDestroyQueryPool");
|
vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load("vkDestroyQueryPool", userptr);
|
||||||
glad_vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load(userptr, "vkDestroyRenderPass");
|
vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load("vkDestroyRenderPass", userptr);
|
||||||
glad_vkDestroySampler = (PFN_vkDestroySampler) load(userptr, "vkDestroySampler");
|
vkDestroySampler = (PFN_vkDestroySampler) load("vkDestroySampler", userptr);
|
||||||
glad_vkDestroySemaphore = (PFN_vkDestroySemaphore) load(userptr, "vkDestroySemaphore");
|
vkDestroySemaphore = (PFN_vkDestroySemaphore) load("vkDestroySemaphore", userptr);
|
||||||
glad_vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load(userptr, "vkDestroyShaderModule");
|
vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load("vkDestroyShaderModule", userptr);
|
||||||
glad_vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load(userptr, "vkDeviceWaitIdle");
|
vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load("vkDeviceWaitIdle", userptr);
|
||||||
glad_vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load(userptr, "vkEndCommandBuffer");
|
vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load("vkEndCommandBuffer", userptr);
|
||||||
glad_vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load(userptr, "vkEnumerateDeviceExtensionProperties");
|
vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load("vkEnumerateDeviceExtensionProperties", userptr);
|
||||||
glad_vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load(userptr, "vkEnumerateDeviceLayerProperties");
|
vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load("vkEnumerateDeviceLayerProperties", userptr);
|
||||||
glad_vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load(userptr, "vkEnumerateInstanceExtensionProperties");
|
vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load("vkEnumerateInstanceExtensionProperties", userptr);
|
||||||
glad_vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load(userptr, "vkEnumerateInstanceLayerProperties");
|
vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load("vkEnumerateInstanceLayerProperties", userptr);
|
||||||
glad_vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load(userptr, "vkEnumeratePhysicalDevices");
|
vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load("vkEnumeratePhysicalDevices", userptr);
|
||||||
glad_vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load(userptr, "vkFlushMappedMemoryRanges");
|
vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load("vkFlushMappedMemoryRanges", userptr);
|
||||||
glad_vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load(userptr, "vkFreeCommandBuffers");
|
vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load("vkFreeCommandBuffers", userptr);
|
||||||
glad_vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load(userptr, "vkFreeDescriptorSets");
|
vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load("vkFreeDescriptorSets", userptr);
|
||||||
glad_vkFreeMemory = (PFN_vkFreeMemory) load(userptr, "vkFreeMemory");
|
vkFreeMemory = (PFN_vkFreeMemory) load("vkFreeMemory", userptr);
|
||||||
glad_vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load(userptr, "vkGetBufferMemoryRequirements");
|
vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load("vkGetBufferMemoryRequirements", userptr);
|
||||||
glad_vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load(userptr, "vkGetDeviceMemoryCommitment");
|
vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load("vkGetDeviceMemoryCommitment", userptr);
|
||||||
glad_vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load(userptr, "vkGetDeviceProcAddr");
|
vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load("vkGetDeviceProcAddr", userptr);
|
||||||
glad_vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load(userptr, "vkGetDeviceQueue");
|
vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load("vkGetDeviceQueue", userptr);
|
||||||
glad_vkGetEventStatus = (PFN_vkGetEventStatus) load(userptr, "vkGetEventStatus");
|
vkGetEventStatus = (PFN_vkGetEventStatus) load("vkGetEventStatus", userptr);
|
||||||
glad_vkGetFenceStatus = (PFN_vkGetFenceStatus) load(userptr, "vkGetFenceStatus");
|
vkGetFenceStatus = (PFN_vkGetFenceStatus) load("vkGetFenceStatus", userptr);
|
||||||
glad_vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load(userptr, "vkGetImageMemoryRequirements");
|
vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load("vkGetImageMemoryRequirements", userptr);
|
||||||
glad_vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load(userptr, "vkGetImageSparseMemoryRequirements");
|
vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load("vkGetImageSparseMemoryRequirements", userptr);
|
||||||
glad_vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load(userptr, "vkGetImageSubresourceLayout");
|
vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load("vkGetImageSubresourceLayout", userptr);
|
||||||
glad_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load(userptr, "vkGetInstanceProcAddr");
|
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load("vkGetInstanceProcAddr", userptr);
|
||||||
glad_vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load(userptr, "vkGetPhysicalDeviceFeatures");
|
vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load("vkGetPhysicalDeviceFeatures", userptr);
|
||||||
glad_vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load(userptr, "vkGetPhysicalDeviceFormatProperties");
|
vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load("vkGetPhysicalDeviceFormatProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load(userptr, "vkGetPhysicalDeviceImageFormatProperties");
|
vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load("vkGetPhysicalDeviceImageFormatProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load(userptr, "vkGetPhysicalDeviceMemoryProperties");
|
vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load("vkGetPhysicalDeviceMemoryProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load(userptr, "vkGetPhysicalDeviceProperties");
|
vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load("vkGetPhysicalDeviceProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties");
|
vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load("vkGetPhysicalDeviceQueueFamilyProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties");
|
vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load("vkGetPhysicalDeviceSparseImageFormatProperties", userptr);
|
||||||
glad_vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load(userptr, "vkGetPipelineCacheData");
|
vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load("vkGetPipelineCacheData", userptr);
|
||||||
glad_vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load(userptr, "vkGetQueryPoolResults");
|
vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load("vkGetQueryPoolResults", userptr);
|
||||||
glad_vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load(userptr, "vkGetRenderAreaGranularity");
|
vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load("vkGetRenderAreaGranularity", userptr);
|
||||||
glad_vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load(userptr, "vkInvalidateMappedMemoryRanges");
|
vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load("vkInvalidateMappedMemoryRanges", userptr);
|
||||||
glad_vkMapMemory = (PFN_vkMapMemory) load(userptr, "vkMapMemory");
|
vkMapMemory = (PFN_vkMapMemory) load("vkMapMemory", userptr);
|
||||||
glad_vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load(userptr, "vkMergePipelineCaches");
|
vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load("vkMergePipelineCaches", userptr);
|
||||||
glad_vkQueueBindSparse = (PFN_vkQueueBindSparse) load(userptr, "vkQueueBindSparse");
|
vkQueueBindSparse = (PFN_vkQueueBindSparse) load("vkQueueBindSparse", userptr);
|
||||||
glad_vkQueueSubmit = (PFN_vkQueueSubmit) load(userptr, "vkQueueSubmit");
|
vkQueueSubmit = (PFN_vkQueueSubmit) load("vkQueueSubmit", userptr);
|
||||||
glad_vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load(userptr, "vkQueueWaitIdle");
|
vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load("vkQueueWaitIdle", userptr);
|
||||||
glad_vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load(userptr, "vkResetCommandBuffer");
|
vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load("vkResetCommandBuffer", userptr);
|
||||||
glad_vkResetCommandPool = (PFN_vkResetCommandPool) load(userptr, "vkResetCommandPool");
|
vkResetCommandPool = (PFN_vkResetCommandPool) load("vkResetCommandPool", userptr);
|
||||||
glad_vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load(userptr, "vkResetDescriptorPool");
|
vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load("vkResetDescriptorPool", userptr);
|
||||||
glad_vkResetEvent = (PFN_vkResetEvent) load(userptr, "vkResetEvent");
|
vkResetEvent = (PFN_vkResetEvent) load("vkResetEvent", userptr);
|
||||||
glad_vkResetFences = (PFN_vkResetFences) load(userptr, "vkResetFences");
|
vkResetFences = (PFN_vkResetFences) load("vkResetFences", userptr);
|
||||||
glad_vkSetEvent = (PFN_vkSetEvent) load(userptr, "vkSetEvent");
|
vkSetEvent = (PFN_vkSetEvent) load("vkSetEvent", userptr);
|
||||||
glad_vkUnmapMemory = (PFN_vkUnmapMemory) load(userptr, "vkUnmapMemory");
|
vkUnmapMemory = (PFN_vkUnmapMemory) load("vkUnmapMemory", userptr);
|
||||||
glad_vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load(userptr, "vkUpdateDescriptorSets");
|
vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load("vkUpdateDescriptorSets", userptr);
|
||||||
glad_vkWaitForFences = (PFN_vkWaitForFences) load(userptr, "vkWaitForFences");
|
vkWaitForFences = (PFN_vkWaitForFences) load("vkWaitForFences", userptr);
|
||||||
}
|
}
|
||||||
static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
|
static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
|
||||||
if(!GLAD_VK_VERSION_1_1) return;
|
if(!GLAD_VK_VERSION_1_1) return;
|
||||||
glad_vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load(userptr, "vkBindBufferMemory2");
|
vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load("vkBindBufferMemory2", userptr);
|
||||||
glad_vkBindImageMemory2 = (PFN_vkBindImageMemory2) load(userptr, "vkBindImageMemory2");
|
vkBindImageMemory2 = (PFN_vkBindImageMemory2) load("vkBindImageMemory2", userptr);
|
||||||
glad_vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load(userptr, "vkCmdDispatchBase");
|
vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load("vkCmdDispatchBase", userptr);
|
||||||
glad_vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load(userptr, "vkCmdSetDeviceMask");
|
vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load("vkCmdSetDeviceMask", userptr);
|
||||||
glad_vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load(userptr, "vkCreateDescriptorUpdateTemplate");
|
vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load("vkCreateDescriptorUpdateTemplate", userptr);
|
||||||
glad_vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load(userptr, "vkCreateSamplerYcbcrConversion");
|
vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load("vkCreateSamplerYcbcrConversion", userptr);
|
||||||
glad_vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load(userptr, "vkDestroyDescriptorUpdateTemplate");
|
vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load("vkDestroyDescriptorUpdateTemplate", userptr);
|
||||||
glad_vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load(userptr, "vkDestroySamplerYcbcrConversion");
|
vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load("vkDestroySamplerYcbcrConversion", userptr);
|
||||||
glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
|
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr);
|
||||||
glad_vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load(userptr, "vkEnumeratePhysicalDeviceGroups");
|
vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load("vkEnumeratePhysicalDeviceGroups", userptr);
|
||||||
glad_vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load(userptr, "vkGetBufferMemoryRequirements2");
|
vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load("vkGetBufferMemoryRequirements2", userptr);
|
||||||
glad_vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load(userptr, "vkGetDescriptorSetLayoutSupport");
|
vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load("vkGetDescriptorSetLayoutSupport", userptr);
|
||||||
glad_vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load(userptr, "vkGetDeviceGroupPeerMemoryFeatures");
|
vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load("vkGetDeviceGroupPeerMemoryFeatures", userptr);
|
||||||
glad_vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load(userptr, "vkGetDeviceQueue2");
|
vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load("vkGetDeviceQueue2", userptr);
|
||||||
glad_vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load(userptr, "vkGetImageMemoryRequirements2");
|
vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load("vkGetImageMemoryRequirements2", userptr);
|
||||||
glad_vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load(userptr, "vkGetImageSparseMemoryRequirements2");
|
vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load("vkGetImageSparseMemoryRequirements2", userptr);
|
||||||
glad_vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load(userptr, "vkGetPhysicalDeviceExternalBufferProperties");
|
vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load("vkGetPhysicalDeviceExternalBufferProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load(userptr, "vkGetPhysicalDeviceExternalFenceProperties");
|
vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load("vkGetPhysicalDeviceExternalFenceProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load(userptr, "vkGetPhysicalDeviceExternalSemaphoreProperties");
|
vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load("vkGetPhysicalDeviceExternalSemaphoreProperties", userptr);
|
||||||
glad_vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load(userptr, "vkGetPhysicalDeviceFeatures2");
|
vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load("vkGetPhysicalDeviceFeatures2", userptr);
|
||||||
glad_vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load(userptr, "vkGetPhysicalDeviceFormatProperties2");
|
vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load("vkGetPhysicalDeviceFormatProperties2", userptr);
|
||||||
glad_vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceImageFormatProperties2");
|
vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load("vkGetPhysicalDeviceImageFormatProperties2", userptr);
|
||||||
glad_vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load(userptr, "vkGetPhysicalDeviceMemoryProperties2");
|
vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load("vkGetPhysicalDeviceMemoryProperties2", userptr);
|
||||||
glad_vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load(userptr, "vkGetPhysicalDeviceProperties2");
|
vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load("vkGetPhysicalDeviceProperties2", userptr);
|
||||||
glad_vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties2");
|
vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load("vkGetPhysicalDeviceQueueFamilyProperties2", userptr);
|
||||||
glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties2");
|
vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load("vkGetPhysicalDeviceSparseImageFormatProperties2", userptr);
|
||||||
glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool");
|
vkTrimCommandPool = (PFN_vkTrimCommandPool) load("vkTrimCommandPool", userptr);
|
||||||
glad_vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load(userptr, "vkUpdateDescriptorSetWithTemplate");
|
vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load("vkUpdateDescriptorSetWithTemplate", userptr);
|
||||||
}
|
|
||||||
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) {
|
static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) {
|
||||||
if(!GLAD_VK_EXT_debug_report) return;
|
if(!GLAD_VK_EXT_debug_report) return;
|
||||||
glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT");
|
vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load("vkCreateDebugReportCallbackEXT", userptr);
|
||||||
glad_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load(userptr, "vkDebugReportMessageEXT");
|
vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load("vkDebugReportMessageEXT", userptr);
|
||||||
glad_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load(userptr, "vkDestroyDebugReportCallbackEXT");
|
vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load("vkDestroyDebugReportCallbackEXT", userptr);
|
||||||
}
|
}
|
||||||
static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
|
static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
|
||||||
if(!GLAD_VK_KHR_surface) return;
|
if(!GLAD_VK_KHR_surface) return;
|
||||||
glad_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load(userptr, "vkDestroySurfaceKHR");
|
vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load("vkDestroySurfaceKHR", userptr);
|
||||||
glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load(userptr, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
|
vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", userptr);
|
||||||
glad_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load(userptr, "vkGetPhysicalDeviceSurfaceFormatsKHR");
|
vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load("vkGetPhysicalDeviceSurfaceFormatsKHR", userptr);
|
||||||
glad_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load(userptr, "vkGetPhysicalDeviceSurfacePresentModesKHR");
|
vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load("vkGetPhysicalDeviceSurfacePresentModesKHR", userptr);
|
||||||
glad_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load(userptr, "vkGetPhysicalDeviceSurfaceSupportKHR");
|
vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load("vkGetPhysicalDeviceSurfaceSupportKHR", userptr);
|
||||||
}
|
}
|
||||||
static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
|
static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
|
||||||
if(!GLAD_VK_KHR_swapchain) return;
|
if(!GLAD_VK_KHR_swapchain) return;
|
||||||
glad_vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load(userptr, "vkAcquireNextImage2KHR");
|
vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load("vkAcquireNextImage2KHR", userptr);
|
||||||
glad_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load(userptr, "vkAcquireNextImageKHR");
|
vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load("vkAcquireNextImageKHR", userptr);
|
||||||
glad_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load(userptr, "vkCreateSwapchainKHR");
|
vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load("vkCreateSwapchainKHR", userptr);
|
||||||
glad_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load(userptr, "vkDestroySwapchainKHR");
|
vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load("vkDestroySwapchainKHR", userptr);
|
||||||
glad_vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load(userptr, "vkGetDeviceGroupPresentCapabilitiesKHR");
|
vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load("vkGetDeviceGroupPresentCapabilitiesKHR", userptr);
|
||||||
glad_vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load(userptr, "vkGetDeviceGroupSurfacePresentModesKHR");
|
vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load("vkGetDeviceGroupSurfacePresentModesKHR", userptr);
|
||||||
glad_vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load(userptr, "vkGetPhysicalDevicePresentRectanglesKHR");
|
vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load("vkGetPhysicalDevicePresentRectanglesKHR", userptr);
|
||||||
glad_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load(userptr, "vkGetSwapchainImagesKHR");
|
vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load("vkGetSwapchainImagesKHR", userptr);
|
||||||
glad_vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load(userptr, "vkQueuePresentKHR");
|
vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load("vkQueuePresentKHR", userptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -525,49 +411,47 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t instance_extension_count = 0;
|
uint32_t instance_extension_count = 0;
|
||||||
uint32_t device_extension_count = 0;
|
uint32_t device_extension_count = 0;
|
||||||
uint32_t max_extension_count = 0;
|
uint32_t max_extension_count;
|
||||||
uint32_t total_extension_count = 0;
|
uint32_t total_extension_count;
|
||||||
char **extensions = NULL;
|
char **extensions;
|
||||||
VkExtensionProperties *ext_properties = NULL;
|
VkExtensionProperties *ext_properties;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
if (glad_vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && glad_vkEnumerateDeviceExtensionProperties == NULL)) {
|
if (vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && vkEnumerateDeviceExtensionProperties == NULL)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
|
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (physical_device != NULL) {
|
if (physical_device != NULL) {
|
||||||
result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
|
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
total_extension_count = instance_extension_count + device_extension_count;
|
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
|
max_extension_count = instance_extension_count > device_extension_count
|
||||||
? instance_extension_count : device_extension_count;
|
? instance_extension_count : device_extension_count;
|
||||||
|
|
||||||
ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
|
ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
|
||||||
if (ext_properties == NULL) {
|
if (ext_properties == NULL) {
|
||||||
goto glad_vk_get_extensions_error;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
|
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
goto glad_vk_get_extensions_error;
|
free((void*) ext_properties);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions = (char**) calloc(total_extension_count, sizeof(char*));
|
extensions = (char**) calloc(total_extension_count, sizeof(char*));
|
||||||
if (extensions == NULL) {
|
if (extensions == NULL) {
|
||||||
goto glad_vk_get_extensions_error;
|
free((void*) ext_properties);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < instance_extension_count; ++i) {
|
for (i = 0; i < instance_extension_count; ++i) {
|
||||||
@@ -575,16 +459,17 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
|
|||||||
|
|
||||||
size_t extension_name_length = strlen(ext.extensionName) + 1;
|
size_t extension_name_length = strlen(ext.extensionName) + 1;
|
||||||
extensions[i] = (char*) malloc(extension_name_length * sizeof(char));
|
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));
|
memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (physical_device != NULL) {
|
if (physical_device != NULL) {
|
||||||
result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
|
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
goto glad_vk_get_extensions_error;
|
for (i = 0; i < instance_extension_count; ++i) {
|
||||||
|
free((void*) extensions[i]);
|
||||||
|
}
|
||||||
|
free(extensions);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < device_extension_count; ++i) {
|
for (i = 0; i < device_extension_count; ++i) {
|
||||||
@@ -592,9 +477,6 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
|
|||||||
|
|
||||||
size_t extension_name_length = strlen(ext.extensionName) + 1;
|
size_t extension_name_length = strlen(ext.extensionName) + 1;
|
||||||
extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char));
|
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));
|
memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,16 +487,6 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
|
|||||||
*out_extensions = extensions;
|
*out_extensions = extensions;
|
||||||
|
|
||||||
return 1;
|
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) {
|
static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) {
|
||||||
@@ -631,7 +503,7 @@ static int glad_vk_has_extension(const char *name, uint32_t extension_count, cha
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < extension_count; ++i) {
|
for (i = 0; i < extension_count; ++i) {
|
||||||
if(extensions[i] != NULL && strcmp(name, extensions[i]) == 0) {
|
if(strcmp(name, extensions[i]) == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,7 +511,7 @@ static int glad_vk_has_extension(const char *name, uint32_t extension_count, cha
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLADapiproc glad_vk_get_proc_from_userptr(void *userptr, const char* name) {
|
static GLADapiproc glad_vk_get_proc_from_userptr(const char* name, void *userptr) {
|
||||||
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
|
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,12 +521,9 @@ static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
|
|||||||
if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0;
|
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_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_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);
|
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);
|
glad_vk_free_extensions(extension_count, extensions);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -665,11 +534,11 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
|
|||||||
int minor = 0;
|
int minor = 0;
|
||||||
|
|
||||||
#ifdef VK_VERSION_1_1
|
#ifdef VK_VERSION_1_1
|
||||||
if (glad_vkEnumerateInstanceVersion != NULL) {
|
if (vkEnumerateInstanceVersion != NULL) {
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
result = glad_vkEnumerateInstanceVersion(&version);
|
result = vkEnumerateInstanceVersion(&version);
|
||||||
if (result == VK_SUCCESS) {
|
if (result == VK_SUCCESS) {
|
||||||
major = (int) VK_VERSION_MAJOR(version);
|
major = (int) VK_VERSION_MAJOR(version);
|
||||||
minor = (int) VK_VERSION_MINOR(version);
|
minor = (int) VK_VERSION_MINOR(version);
|
||||||
@@ -677,9 +546,9 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (physical_device != NULL && glad_vkGetPhysicalDeviceProperties != NULL) {
|
if (physical_device != NULL && vkGetPhysicalDeviceProperties != NULL) {
|
||||||
VkPhysicalDeviceProperties properties;
|
VkPhysicalDeviceProperties properties;
|
||||||
glad_vkGetPhysicalDeviceProperties(physical_device, &properties);
|
vkGetPhysicalDeviceProperties(physical_device, &properties);
|
||||||
|
|
||||||
major = (int) VK_VERSION_MAJOR(properties.apiVersion);
|
major = (int) VK_VERSION_MAJOR(properties.apiVersion);
|
||||||
minor = (int) VK_VERSION_MINOR(properties.apiVersion);
|
minor = (int) VK_VERSION_MINOR(properties.apiVersion);
|
||||||
@@ -687,8 +556,6 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
|
|||||||
|
|
||||||
GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
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_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);
|
return GLAD_MAKE_VERSION(major, minor);
|
||||||
}
|
}
|
||||||
@@ -697,7 +564,7 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc
|
|||||||
int version;
|
int version;
|
||||||
|
|
||||||
#ifdef VK_VERSION_1_1
|
#ifdef VK_VERSION_1_1
|
||||||
glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
|
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr);
|
||||||
#endif
|
#endif
|
||||||
version = glad_vk_find_core_vulkan( physical_device);
|
version = glad_vk_find_core_vulkan( physical_device);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
@@ -706,8 +573,6 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc
|
|||||||
|
|
||||||
glad_vk_load_VK_VERSION_1_0(load, userptr);
|
glad_vk_load_VK_VERSION_1_0(load, userptr);
|
||||||
glad_vk_load_VK_VERSION_1_1(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;
|
if (!glad_vk_find_extensions_vulkan( physical_device)) return 0;
|
||||||
glad_vk_load_VK_EXT_debug_report(load, userptr);
|
glad_vk_load_VK_EXT_debug_report(load, userptr);
|
||||||
@@ -725,9 +590,4 @@ int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
Vendored
+134
-87
@@ -3,31 +3,40 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
/* 2020-03-02 Camilla Löwy <elmindreda@elmindreda.org>
|
||||||
#define inline __inline
|
* - Added inclusion of string.h for memcpy
|
||||||
|
* - Replaced tan and acos with tanf and acosf
|
||||||
|
* - Replaced double constants with float equivalents
|
||||||
|
*/
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef LINMATH_NO_INLINE
|
||||||
|
#define LINMATH_H_FUNC static
|
||||||
|
#else
|
||||||
|
#define LINMATH_H_FUNC static inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LINMATH_H_DEFINE_VEC(n) \
|
#define LINMATH_H_DEFINE_VEC(n) \
|
||||||
typedef float vec##n[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; \
|
int i; \
|
||||||
for(i=0; i<n; ++i) \
|
for(i=0; i<n; ++i) \
|
||||||
r[i] = a[i] + b[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; \
|
int i; \
|
||||||
for(i=0; i<n; ++i) \
|
for(i=0; i<n; ++i) \
|
||||||
r[i] = a[i] - b[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; \
|
int i; \
|
||||||
for(i=0; i<n; ++i) \
|
for(i=0; i<n; ++i) \
|
||||||
r[i] = v[i] * s; \
|
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.; \
|
||||||
int i; \
|
int i; \
|
||||||
@@ -35,28 +44,40 @@ static inline float vec##n##_mul_inner(vec##n const a, vec##n const b) \
|
|||||||
p += b[i]*a[i]; \
|
p += b[i]*a[i]; \
|
||||||
return p; \
|
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); \
|
float k = 1.f / vec##n##_len(v); \
|
||||||
vec##n##_scale(r, v, k); \
|
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_DEFINE_VEC(2)
|
LINMATH_H_DEFINE_VEC(2)
|
||||||
LINMATH_H_DEFINE_VEC(3)
|
LINMATH_H_DEFINE_VEC(3)
|
||||||
LINMATH_H_DEFINE_VEC(4)
|
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[0] = a[1]*b[2] - a[2]*b[1];
|
||||||
r[1] = a[2]*b[0] - a[0]*b[2];
|
r[1] = a[2]*b[0] - a[0]*b[2];
|
||||||
r[2] = a[0]*b[1] - a[1]*b[0];
|
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;
|
int i;
|
||||||
@@ -64,7 +85,7 @@ static inline void vec3_reflect(vec3 r, vec3 const v, vec3 const n)
|
|||||||
r[i] = v[i] - p*n[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 a, vec4 b)
|
||||||
{
|
{
|
||||||
r[0] = a[1]*b[2] - a[2]*b[1];
|
r[0] = a[1]*b[2] - a[2]*b[1];
|
||||||
r[1] = a[2]*b[0] - a[0]*b[2];
|
r[1] = a[2]*b[0] - a[0]*b[2];
|
||||||
@@ -72,7 +93,7 @@ static inline void vec4_mul_cross(vec4 r, vec4 a, vec4 b)
|
|||||||
r[3] = 1.f;
|
r[3] = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void vec4_reflect(vec4 r, vec4 v, vec4 n)
|
LINMATH_H_FUNC void vec4_reflect(vec4 r, vec4 v, vec4 n)
|
||||||
{
|
{
|
||||||
float p = 2.f*vec4_mul_inner(v, n);
|
float p = 2.f*vec4_mul_inner(v, n);
|
||||||
int i;
|
int i;
|
||||||
@@ -81,58 +102,58 @@ static inline void vec4_reflect(vec4 r, vec4 v, vec4 n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef vec4 mat4x4[4];
|
typedef vec4 mat4x4[4];
|
||||||
static inline void mat4x4_identity(mat4x4 M)
|
LINMATH_H_FUNC void mat4x4_identity(mat4x4 M)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
for(j=0; j<4; ++j)
|
for(j=0; j<4; ++j)
|
||||||
M[i][j] = i==j ? 1.f : 0.f;
|
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 N)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
for(j=0; j<4; ++j)
|
for(j=0; j<4; ++j)
|
||||||
M[i][j] = N[i][j];
|
M[i][j] = N[i][j];
|
||||||
}
|
}
|
||||||
static inline void mat4x4_row(vec4 r, mat4x4 M, int i)
|
LINMATH_H_FUNC void mat4x4_row(vec4 r, mat4x4 M, int i)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
for(k=0; k<4; ++k)
|
for(k=0; k<4; ++k)
|
||||||
r[k] = M[k][i];
|
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 M, int i)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
for(k=0; k<4; ++k)
|
for(k=0; k<4; ++k)
|
||||||
r[k] = M[i][k];
|
r[k] = M[i][k];
|
||||||
}
|
}
|
||||||
static inline void mat4x4_transpose(mat4x4 M, mat4x4 N)
|
LINMATH_H_FUNC void mat4x4_transpose(mat4x4 M, mat4x4 N)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
for(j=0; j<4; ++j)
|
for(j=0; j<4; ++j)
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
M[i][j] = N[j][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 a, mat4x4 b)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
vec4_add(M[i], a[i], b[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 a, mat4x4 b)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
vec4_sub(M[i], a[i], b[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 a, float k)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
vec4_scale(M[i], a[i], k);
|
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 a, float x, float y, float z)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
vec4_scale(M[0], a[0], x);
|
vec4_scale(M[0], a[0], x);
|
||||||
@@ -142,7 +163,7 @@ static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y, floa
|
|||||||
M[3][i] = a[3][i];
|
M[3][i] = a[3][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static inline void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
|
LINMATH_H_FUNC void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
|
||||||
{
|
{
|
||||||
mat4x4 temp;
|
mat4x4 temp;
|
||||||
int k, r, c;
|
int k, r, c;
|
||||||
@@ -153,7 +174,7 @@ static inline void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
|
|||||||
}
|
}
|
||||||
mat4x4_dup(M, temp);
|
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 M, vec4 v)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
for(j=0; j<4; ++j) {
|
for(j=0; j<4; ++j) {
|
||||||
@@ -162,14 +183,14 @@ static inline void mat4x4_mul_vec4(vec4 r, mat4x4 M, vec4 v)
|
|||||||
r[j] += M[i][j] * v[i];
|
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);
|
mat4x4_identity(T);
|
||||||
T[3][0] = x;
|
T[3][0] = x;
|
||||||
T[3][1] = y;
|
T[3][1] = y;
|
||||||
T[3][2] = z;
|
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 t = {x, y, z, 0};
|
||||||
vec4 r;
|
vec4 r;
|
||||||
@@ -179,33 +200,32 @@ static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z
|
|||||||
M[3][i] += vec4_mul_inner(r, t);
|
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 a, vec3 b)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
for(i=0; i<4; ++i) for(j=0; j<4; ++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;
|
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 M, float x, float y, float z, float angle)
|
||||||
{
|
{
|
||||||
float s = sinf(angle);
|
float s = sinf(angle);
|
||||||
float c = cosf(angle);
|
float c = cosf(angle);
|
||||||
vec3 u = {x, y, z};
|
vec3 u = {x, y, z};
|
||||||
|
|
||||||
if(vec3_len(u) > 1e-4) {
|
if(vec3_len(u) > 1e-4) {
|
||||||
mat4x4 T, C, S = {{0}};
|
|
||||||
|
|
||||||
vec3_norm(u, u);
|
vec3_norm(u, u);
|
||||||
|
mat4x4 T;
|
||||||
mat4x4_from_vec3_mul_outer(T, u, u);
|
mat4x4_from_vec3_mul_outer(T, u, u);
|
||||||
|
|
||||||
S[1][2] = u[0];
|
mat4x4 S = {
|
||||||
S[2][1] = -u[0];
|
{ 0, u[2], -u[1], 0},
|
||||||
S[2][0] = u[1];
|
{-u[2], 0, u[0], 0},
|
||||||
S[0][2] = -u[1];
|
{ u[1], -u[0], 0, 0},
|
||||||
S[0][1] = u[2];
|
{ 0, 0, 0, 0}
|
||||||
S[1][0] = -u[2];
|
};
|
||||||
|
|
||||||
mat4x4_scale(S, S, s);
|
mat4x4_scale(S, S, s);
|
||||||
|
|
||||||
|
mat4x4 C;
|
||||||
mat4x4_identity(C);
|
mat4x4_identity(C);
|
||||||
mat4x4_sub(C, C, T);
|
mat4x4_sub(C, C, T);
|
||||||
|
|
||||||
@@ -214,13 +234,13 @@ static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z,
|
|||||||
mat4x4_add(T, T, C);
|
mat4x4_add(T, T, C);
|
||||||
mat4x4_add(T, T, S);
|
mat4x4_add(T, T, S);
|
||||||
|
|
||||||
T[3][3] = 1.;
|
T[3][3] = 1.;
|
||||||
mat4x4_mul(R, M, T);
|
mat4x4_mul(R, M, T);
|
||||||
} else {
|
} else {
|
||||||
mat4x4_dup(R, M);
|
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 M, float angle)
|
||||||
{
|
{
|
||||||
float s = sinf(angle);
|
float s = sinf(angle);
|
||||||
float c = cosf(angle);
|
float c = cosf(angle);
|
||||||
@@ -232,19 +252,19 @@ static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle)
|
|||||||
};
|
};
|
||||||
mat4x4_mul(Q, M, R);
|
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 M, float angle)
|
||||||
{
|
{
|
||||||
float s = sinf(angle);
|
float s = sinf(angle);
|
||||||
float c = cosf(angle);
|
float c = cosf(angle);
|
||||||
mat4x4 R = {
|
mat4x4 R = {
|
||||||
{ c, 0.f, -s, 0.f},
|
{ c, 0.f, s, 0.f},
|
||||||
{ 0.f, 1.f, 0.f, 0.f},
|
{ 0.f, 1.f, 0.f, 0.f},
|
||||||
{ s, 0.f, c, 0.f},
|
{ -s, 0.f, c, 0.f},
|
||||||
{ 0.f, 0.f, 0.f, 1.f}
|
{ 0.f, 0.f, 0.f, 1.f}
|
||||||
};
|
};
|
||||||
mat4x4_mul(Q, M, R);
|
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 M, float angle)
|
||||||
{
|
{
|
||||||
float s = sinf(angle);
|
float s = sinf(angle);
|
||||||
float c = cosf(angle);
|
float c = cosf(angle);
|
||||||
@@ -256,9 +276,8 @@ static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle)
|
|||||||
};
|
};
|
||||||
mat4x4_mul(Q, M, R);
|
mat4x4_mul(Q, M, R);
|
||||||
}
|
}
|
||||||
static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
|
LINMATH_H_FUNC void mat4x4_invert(mat4x4 T, mat4x4 M)
|
||||||
{
|
{
|
||||||
float idet;
|
|
||||||
float s[6];
|
float s[6];
|
||||||
float c[6];
|
float c[6];
|
||||||
s[0] = M[0][0]*M[1][1] - M[1][0]*M[0][1];
|
s[0] = M[0][0]*M[1][1] - M[1][0]*M[0][1];
|
||||||
@@ -274,10 +293,10 @@ static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
|
|||||||
c[3] = M[2][1]*M[3][2] - M[3][1]*M[2][2];
|
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[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];
|
c[5] = M[2][2]*M[3][3] - M[3][2]*M[2][3];
|
||||||
|
|
||||||
/* Assumes it is invertible */
|
/* 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][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][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;
|
T[0][2] = ( M[3][1] * s[5] - M[3][2] * s[4] + M[3][3] * s[3]) * idet;
|
||||||
@@ -298,35 +317,34 @@ static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
|
|||||||
T[3][2] = (-M[3][0] * s[3] + M[3][1] * s[1] - M[3][2] * s[0]) * idet;
|
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;
|
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 M)
|
||||||
{
|
{
|
||||||
|
mat4x4_dup(R, M);
|
||||||
float s = 1.;
|
float s = 1.;
|
||||||
vec3 h;
|
vec3 h;
|
||||||
|
|
||||||
mat4x4_dup(R, M);
|
|
||||||
vec3_norm(R[2], R[2]);
|
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]);
|
s = vec3_mul_inner(R[1], R[2]);
|
||||||
vec3_scale(h, R[2], s);
|
vec3_scale(h, R[2], s);
|
||||||
vec3_sub(R[1], R[1], h);
|
vec3_sub(R[1], R[1], h);
|
||||||
vec3_norm(R[1], R[1]);
|
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]);
|
s = vec3_mul_inner(R[0], R[1]);
|
||||||
vec3_scale(h, R[1], s);
|
vec3_scale(h, R[1], s);
|
||||||
vec3_sub(R[0], R[0], h);
|
vec3_sub(R[0], R[0], h);
|
||||||
vec3_norm(R[0], R[0]);
|
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][0] = 2.f*n/(r-l);
|
||||||
M[0][1] = M[0][2] = M[0][3] = 0.f;
|
M[0][1] = M[0][2] = M[0][3] = 0.f;
|
||||||
|
|
||||||
M[1][1] = 2.f*n/(t-b);
|
M[1][1] = 2.f*n/(t-b);
|
||||||
M[1][0] = M[1][2] = M[1][3] = 0.f;
|
M[1][0] = M[1][2] = M[1][3] = 0.f;
|
||||||
|
|
||||||
@@ -334,11 +352,11 @@ static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t,
|
|||||||
M[2][1] = (t+b)/(t-b);
|
M[2][1] = (t+b)/(t-b);
|
||||||
M[2][2] = -(f+n)/(f-n);
|
M[2][2] = -(f+n)/(f-n);
|
||||||
M[2][3] = -1.f;
|
M[2][3] = -1.f;
|
||||||
|
|
||||||
M[3][2] = -2.f*(f*n)/(f-n);
|
M[3][2] = -2.f*(f*n)/(f-n);
|
||||||
M[3][0] = M[3][1] = M[3][3] = 0.f;
|
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][0] = 2.f/(r-l);
|
||||||
M[0][1] = M[0][2] = M[0][3] = 0.f;
|
M[0][1] = M[0][2] = M[0][3] = 0.f;
|
||||||
@@ -348,17 +366,17 @@ static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, fl
|
|||||||
|
|
||||||
M[2][2] = -2.f/(f-n);
|
M[2][2] = -2.f/(f-n);
|
||||||
M[2][0] = M[2][1] = M[2][3] = 0.f;
|
M[2][0] = M[2][1] = M[2][3] = 0.f;
|
||||||
|
|
||||||
M[3][0] = -(r+l)/(r-l);
|
M[3][0] = -(r+l)/(r-l);
|
||||||
M[3][1] = -(t+b)/(t-b);
|
M[3][1] = -(t+b)/(t-b);
|
||||||
M[3][2] = -(f+n)/(f-n);
|
M[3][2] = -(f+n)/(f-n);
|
||||||
M[3][3] = 1.f;
|
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.
|
/* NOTE: Degrees are an unhandy unit to work with.
|
||||||
* linmath.h uses radians for everything! */
|
* 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][0] = a / aspect;
|
||||||
m[0][1] = 0.f;
|
m[0][1] = 0.f;
|
||||||
@@ -380,7 +398,7 @@ static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float
|
|||||||
m[3][2] = -((2.f * f * n) / (f - n));
|
m[3][2] = -((2.f * f * n) / (f - n));
|
||||||
m[3][3] = 0.f;
|
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 eye, vec3 center, vec3 up)
|
||||||
{
|
{
|
||||||
/* Adapted from Android's OpenGL Matrix.java. */
|
/* Adapted from Android's OpenGL Matrix.java. */
|
||||||
/* See the OpenGL GLUT documentation for gluLookAt for a description */
|
/* See the OpenGL GLUT documentation for gluLookAt for a description */
|
||||||
@@ -389,15 +407,14 @@ static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
|
|||||||
/* TODO: The negation of of can be spared by swapping the order of
|
/* TODO: The negation of of can be spared by swapping the order of
|
||||||
* operands in the following cross products in the right way. */
|
* operands in the following cross products in the right way. */
|
||||||
vec3 f;
|
vec3 f;
|
||||||
|
vec3_sub(f, center, eye);
|
||||||
|
vec3_norm(f, f);
|
||||||
|
|
||||||
vec3 s;
|
vec3 s;
|
||||||
vec3 t;
|
|
||||||
|
|
||||||
vec3_sub(f, center, eye);
|
|
||||||
vec3_norm(f, f);
|
|
||||||
|
|
||||||
vec3_mul_cross(s, f, up);
|
vec3_mul_cross(s, f, up);
|
||||||
vec3_norm(s, s);
|
vec3_norm(s, s);
|
||||||
|
|
||||||
|
vec3 t;
|
||||||
vec3_mul_cross(t, s, f);
|
vec3_mul_cross(t, s, f);
|
||||||
|
|
||||||
m[0][0] = s[0];
|
m[0][0] = s[0];
|
||||||
@@ -424,24 +441,24 @@ static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef float quat[4];
|
typedef float quat[4];
|
||||||
static inline void quat_identity(quat q)
|
LINMATH_H_FUNC void quat_identity(quat q)
|
||||||
{
|
{
|
||||||
q[0] = q[1] = q[2] = 0.f;
|
q[0] = q[1] = q[2] = 0.f;
|
||||||
q[3] = 1.f;
|
q[3] = 1.f;
|
||||||
}
|
}
|
||||||
static inline void quat_add(quat r, quat a, quat b)
|
LINMATH_H_FUNC void quat_add(quat r, quat a, quat b)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
r[i] = a[i] + b[i];
|
r[i] = a[i] + b[i];
|
||||||
}
|
}
|
||||||
static inline void quat_sub(quat r, quat a, quat b)
|
LINMATH_H_FUNC void quat_sub(quat r, quat a, quat b)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
r[i] = a[i] - b[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 p, quat q)
|
||||||
{
|
{
|
||||||
vec3 w;
|
vec3 w;
|
||||||
vec3_mul_cross(r, p, q);
|
vec3_mul_cross(r, p, q);
|
||||||
@@ -451,13 +468,13 @@ static inline void quat_mul(quat r, quat p, quat q)
|
|||||||
vec3_add(r, r, w);
|
vec3_add(r, r, w);
|
||||||
r[3] = p[3]*q[3] - vec3_mul_inner(p, q);
|
r[3] = p[3]*q[3] - vec3_mul_inner(p, q);
|
||||||
}
|
}
|
||||||
static inline void quat_scale(quat r, quat v, float s)
|
LINMATH_H_FUNC void quat_scale(quat r, quat v, float s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<4; ++i)
|
for(i=0; i<4; ++i)
|
||||||
r[i] = v[i] * s;
|
r[i] = v[i] * s;
|
||||||
}
|
}
|
||||||
static inline float quat_inner_product(quat a, quat b)
|
LINMATH_H_FUNC float quat_inner_product(quat a, quat b)
|
||||||
{
|
{
|
||||||
float p = 0.f;
|
float p = 0.f;
|
||||||
int i;
|
int i;
|
||||||
@@ -465,42 +482,43 @@ static inline float quat_inner_product(quat a, quat b)
|
|||||||
p += b[i]*a[i];
|
p += b[i]*a[i];
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
static inline void quat_conj(quat r, quat q)
|
LINMATH_H_FUNC void quat_conj(quat r, quat q)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<3; ++i)
|
for(i=0; i<3; ++i)
|
||||||
r[i] = -q[i];
|
r[i] = -q[i];
|
||||||
r[3] = q[3];
|
r[3] = q[3];
|
||||||
}
|
}
|
||||||
static inline void quat_rotate(quat r, float angle, vec3 axis) {
|
LINMATH_H_FUNC void quat_rotate(quat r, float angle, vec3 axis) {
|
||||||
int i;
|
|
||||||
vec3 v;
|
vec3 v;
|
||||||
vec3_scale(v, axis, sinf(angle / 2));
|
vec3_scale(v, axis, sinf(angle / 2));
|
||||||
|
int i;
|
||||||
for(i=0; i<3; ++i)
|
for(i=0; i<3; ++i)
|
||||||
r[i] = v[i];
|
r[i] = v[i];
|
||||||
r[3] = cosf(angle / 2);
|
r[3] = cosf(angle / 2);
|
||||||
}
|
}
|
||||||
#define quat_norm vec4_norm
|
#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 q, vec3 v)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Method by Fabian 'ryg' Giessen (of Farbrausch)
|
* Method by Fabian 'ryg' Giessen (of Farbrausch)
|
||||||
t = 2 * cross(q.xyz, v)
|
t = 2 * cross(q.xyz, v)
|
||||||
v' = v + q.w * t + cross(q.xyz, t)
|
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 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_scale(t, t, 2);
|
||||||
|
|
||||||
vec3_mul_cross(u, u, t);
|
vec3_mul_cross(u, q_xyz, t);
|
||||||
vec3_scale(t, t, q[3]);
|
vec3_scale(t, t, q[3]);
|
||||||
|
|
||||||
vec3_add(r, v, t);
|
vec3_add(r, v, t);
|
||||||
vec3_add(r, r, u);
|
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 q)
|
||||||
{
|
{
|
||||||
float a = q[3];
|
float a = q[3];
|
||||||
float b = q[0];
|
float b = q[0];
|
||||||
@@ -510,7 +528,7 @@ static inline void mat4x4_from_quat(mat4x4 M, quat q)
|
|||||||
float b2 = b*b;
|
float b2 = b*b;
|
||||||
float c2 = c*c;
|
float c2 = c*c;
|
||||||
float d2 = d*d;
|
float d2 = d*d;
|
||||||
|
|
||||||
M[0][0] = a2 + b2 - c2 - d2;
|
M[0][0] = a2 + b2 - c2 - d2;
|
||||||
M[0][1] = 2.f*(b*c + a*d);
|
M[0][1] = 2.f*(b*c + a*d);
|
||||||
M[0][2] = 2.f*(b*d - a*c);
|
M[0][2] = 2.f*(b*d - a*c);
|
||||||
@@ -530,7 +548,7 @@ static inline void mat4x4_from_quat(mat4x4 M, quat q)
|
|||||||
M[3][3] = 1.f;
|
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 M, quat q)
|
||||||
{
|
{
|
||||||
/* XXX: The way this is written only works for othogonal matrices. */
|
/* XXX: The way this is written only works for othogonal matrices. */
|
||||||
/* TODO: Take care of non-orthogonal case. */
|
/* TODO: Take care of non-orthogonal case. */
|
||||||
@@ -541,7 +559,7 @@ static inline void mat4x4o_mul_quat(mat4x4 R, mat4x4 M, quat q)
|
|||||||
R[3][0] = R[3][1] = R[3][2] = 0.f;
|
R[3][0] = R[3][1] = R[3][2] = 0.f;
|
||||||
R[3][3] = 1.f;
|
R[3][3] = 1.f;
|
||||||
}
|
}
|
||||||
static inline void quat_from_mat4x4(quat q, mat4x4 M)
|
LINMATH_H_FUNC void quat_from_mat4x4(quat q, mat4x4 M)
|
||||||
{
|
{
|
||||||
float r=0.f;
|
float r=0.f;
|
||||||
int i;
|
int i;
|
||||||
@@ -557,7 +575,7 @@ static inline void quat_from_mat4x4(quat q, mat4x4 M)
|
|||||||
p = &perm[i];
|
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) {
|
if(r < 1e-6) {
|
||||||
q[0] = 1.f;
|
q[0] = 1.f;
|
||||||
@@ -571,4 +589,33 @@ static inline void quat_from_mat4x4(quat q, mat4x4 M)
|
|||||||
q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]])/(2.f*r);
|
q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]])/(2.f*r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LINMATH_H_FUNC void mat4x4_arcball(mat4x4 R, mat4x4 M, vec2 _a, vec2 _b, float s)
|
||||||
|
{
|
||||||
|
vec2 a; memcpy(a, _a, sizeof(a));
|
||||||
|
vec2 b; memcpy(b, _b, sizeof(b));
|
||||||
|
|
||||||
|
float z_a = 0.;
|
||||||
|
float z_b = 0.;
|
||||||
|
|
||||||
|
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 = acosf(vec3_mul_inner(a_, b_)) * s;
|
||||||
|
mat4x4_rotate(R, M, c_[0], c_[1], c_[2], angle);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Vendored
+127
-803
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
src/wl_* @linkmauve
|
src/wl_* @linkmauve
|
||||||
|
|
||||||
docs/*.css @glfw/webdev
|
docs/*.css @glfw/webdev
|
||||||
docs/*.scss @glfw/webdev
|
docs/*.less @glfw/webdev
|
||||||
docs/*.html @glfw/webdev
|
docs/*.html @glfw/webdev
|
||||||
docs/*.xml @glfw/webdev
|
docs/*.xml @glfw/webdev
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ section](https://discourse.glfw.org/c/support) of the forum, under the [Stack
|
|||||||
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
||||||
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
||||||
Stack Exchange or in the IRC channel `#glfw` on
|
Stack Exchange or in the IRC channel `#glfw` on
|
||||||
[Libera.Chat](https://libera.chat/).
|
[Freenode](http://freenode.net/).
|
||||||
|
|
||||||
Questions about the design or implementation of GLFW or about future plans
|
Questions about the design or implementation of GLFW or about future plans
|
||||||
should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
|
should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
|
||||||
@@ -351,8 +351,8 @@ __Note:__ If you haven't already implemented the feature, check first if there
|
|||||||
already is an open issue for it and if it's already being developed in an
|
already is an open issue for it and if it's already being developed in an
|
||||||
[experimental branch](https://github.com/glfw/glfw/branches/all).
|
[experimental branch](https://github.com/glfw/glfw/branches/all).
|
||||||
|
|
||||||
__There is no preferred patch size__. A one-character change is just as welcome
|
__There is no preferred patch size__. A one character change is just as welcome
|
||||||
as one adding a thousand lines, if that is the appropriate size for the
|
as one adding a thousand line one, if that is the appropriate size for the
|
||||||
feature.
|
feature.
|
||||||
|
|
||||||
In addition to the code, a complete feature includes:
|
In addition to the code, a complete feature includes:
|
||||||
|
|||||||
@@ -208,6 +208,13 @@ ALIASES = "thread_safety=@par Thread safety^^" \
|
|||||||
"macos=__macOS:__" \
|
"macos=__macOS:__" \
|
||||||
"linux=__Linux:__"
|
"linux=__Linux:__"
|
||||||
|
|
||||||
|
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||||
|
# A mapping has the form "name=value". For example adding
|
||||||
|
# "class=itcl::class" will allow you to use the command class in the
|
||||||
|
# itcl::class meaning.
|
||||||
|
|
||||||
|
TCL_SUBST =
|
||||||
|
|
||||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
||||||
# sources only. Doxygen will then generate output that is more tailored for C.
|
# sources only. Doxygen will then generate output that is more tailored for C.
|
||||||
# For instance, some of the names that are used will be different. The list
|
# For instance, some of the names that are used will be different. The list
|
||||||
@@ -847,6 +854,12 @@ VERBATIM_HEADERS = YES
|
|||||||
|
|
||||||
ALPHABETICAL_INDEX = YES
|
ALPHABETICAL_INDEX = YES
|
||||||
|
|
||||||
|
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
|
||||||
|
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
||||||
|
# in which this list will be split (can be a number in the range [1..20])
|
||||||
|
|
||||||
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
|
|
||||||
# In case all classes in a project start with a common prefix, all
|
# In case all classes in a project start with a common prefix, all
|
||||||
# classes will be put under the same header in the alphabetical index.
|
# classes will be put under the same header in the alphabetical index.
|
||||||
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
||||||
@@ -1354,6 +1367,13 @@ LATEX_BATCHMODE = NO
|
|||||||
|
|
||||||
LATEX_HIDE_INDICES = NO
|
LATEX_HIDE_INDICES = NO
|
||||||
|
|
||||||
|
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
|
||||||
|
# source code with syntax highlighting in the LaTeX output.
|
||||||
|
# Note that which sources are shown also depends on other settings
|
||||||
|
# such as SOURCE_BROWSER.
|
||||||
|
|
||||||
|
LATEX_SOURCE_CODE = NO
|
||||||
|
|
||||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||||
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
|
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
|
||||||
# http://en.wikipedia.org/wiki/BibTeX for more info.
|
# http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
# Support resources
|
# Support resources
|
||||||
|
|
||||||
See the [latest documentation](https://www.glfw.org/docs/latest/) for tutorials,
|
See the [latest documentation](http://www.glfw.org/docs/latest/) for tutorials,
|
||||||
guides and the API reference.
|
guides and the API reference.
|
||||||
|
|
||||||
If you have questions about using GLFW, we have a
|
If you have questions about using GLFW, we have a
|
||||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||||
[Libera.Chat](https://libera.chat/).
|
[Freenode](http://freenode.net/).
|
||||||
|
|
||||||
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
||||||
Please check the [contribution
|
Please check the [contribution
|
||||||
|
|||||||
+21
-34
@@ -25,41 +25,39 @@ GLFW.
|
|||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This header defines all the constants and declares all the types and function
|
This header declares the GLFW API and by default also includes the OpenGL header
|
||||||
prototypes of the GLFW API. By default it also includes the OpenGL header from
|
from your development environment. See below for how to control this.
|
||||||
your development environment. See [option macros](@ref build_macros) below for
|
|
||||||
how to select OpenGL ES headers and more.
|
|
||||||
|
|
||||||
The GLFW header also defines any platform-specific macros needed by your OpenGL
|
The GLFW header also defines any platform-specific macros needed by your OpenGL
|
||||||
header, so that it can be included without needing any window system headers.
|
header, so it can be included without needing any window system headers.
|
||||||
|
|
||||||
It does this only when needed, so if window system headers are included, the
|
For example, under Windows you are normally required to include `windows.h`
|
||||||
GLFW header does not try to redefine those symbols. The reverse is not true,
|
before the OpenGL header, which would bring in the whole Win32 API. The GLFW
|
||||||
i.e. `windows.h` cannot cope if any Win32 symbols have already been defined.
|
header duplicates the small number of macros needed.
|
||||||
|
|
||||||
|
It does this only when needed, so if `windows.h` _is_ included, the GLFW header
|
||||||
|
does not try to redefine those symbols. The reverse is not true, i.e.
|
||||||
|
`windows.h` cannot cope if any of its symbols have already been defined.
|
||||||
|
|
||||||
In other words:
|
In other words:
|
||||||
|
|
||||||
- Use the GLFW header to include OpenGL or OpenGL ES headers portably
|
- Do _not_ include the OpenGL headers yourself, as GLFW does this for you
|
||||||
- Do not include window system headers unless you will use those APIs directly
|
- Do _not_ include `windows.h` or other platform-specific headers unless you
|
||||||
- If you do need such headers, include them before the GLFW header
|
plan on using those APIs directly
|
||||||
|
- If you _do_ need to include such headers, do it _before_ including
|
||||||
|
the GLFW header and it will handle this
|
||||||
|
|
||||||
If you are using an OpenGL extension loading library such as
|
If you are using an OpenGL extension loading library such as
|
||||||
[glad](https://github.com/Dav1dde/glad), the extension loader header should
|
[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
|
be included _before_ the GLFW one.
|
||||||
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
|
@code
|
||||||
#include <glad/gl.h>
|
#include <glad/gl.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Both of these mechanisms depend on the extension loader header defining a known
|
Alternatively the @ref GLFW_INCLUDE_NONE macro (described below) can be used to
|
||||||
macro. If yours doesn't or you don't know which one your users will pick, the
|
prevent the GLFW header from including the OpenGL header.
|
||||||
@ref GLFW_INCLUDE_NONE macro will explicitly prevent the GLFW header from
|
|
||||||
including the OpenGL header. This will also allow you to include the two
|
|
||||||
headers in any order.
|
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#define GLFW_INCLUDE_NONE
|
#define GLFW_INCLUDE_NONE
|
||||||
@@ -107,7 +105,7 @@ __GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.1
|
|||||||
`GLES3/gl31.h` header instead of the regular OpenGL header.
|
`GLES3/gl31.h` header instead of the regular OpenGL header.
|
||||||
|
|
||||||
@anchor GLFW_INCLUDE_ES32
|
@anchor GLFW_INCLUDE_ES32
|
||||||
__GLFW_INCLUDE_ES32__ makes the GLFW header include the OpenGL ES 3.2
|
__GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.2
|
||||||
`GLES3/gl32.h` header instead of the regular OpenGL header.
|
`GLES3/gl32.h` header instead of the regular OpenGL header.
|
||||||
|
|
||||||
@anchor GLFW_INCLUDE_NONE
|
@anchor GLFW_INCLUDE_NONE
|
||||||
@@ -115,8 +113,7 @@ __GLFW_INCLUDE_NONE__ makes the GLFW header not include any OpenGL or OpenGL ES
|
|||||||
API header. This is useful in combination with an extension loading library.
|
API header. This is useful in combination with an extension loading library.
|
||||||
|
|
||||||
If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h`
|
If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h`
|
||||||
header (`OpenGL/gl.h` on macOS) is included, unless GLFW detects the inclusion
|
header (`OpenGL/gl.h` on macOS) is included.
|
||||||
guards of any OpenGL, OpenGL ES or extension loader header it knows about.
|
|
||||||
|
|
||||||
The following macros control the inclusion of additional API headers. Any
|
The following macros control the inclusion of additional API headers. Any
|
||||||
number of these may be defined simultaneously, and/or together with one of the
|
number of these may be defined simultaneously, and/or together with one of the
|
||||||
@@ -185,16 +182,6 @@ build_link_cmake_package.
|
|||||||
With a few changes to your `CMakeLists.txt` you can have the GLFW source tree
|
With a few changes to your `CMakeLists.txt` you can have the GLFW source tree
|
||||||
built along with your application.
|
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
|
Add the root directory of the GLFW source tree to your project. This will add
|
||||||
the `glfw` target to your project.
|
the `glfw` target to your project.
|
||||||
|
|
||||||
@@ -242,7 +229,7 @@ With a few changes to your `CMakeLists.txt` you can locate the package and
|
|||||||
target files generated when GLFW is installed.
|
target files generated when GLFW is installed.
|
||||||
|
|
||||||
@code{.cmake}
|
@code{.cmake}
|
||||||
find_package(glfw3 3.3 REQUIRED)
|
find_package(glfw3 3.4 REQUIRED)
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Once GLFW has been added to the project, link against it with the `glfw` target.
|
Once GLFW has been added to the project, link against it with the `glfw` target.
|
||||||
|
|||||||
+9
-3
@@ -85,6 +85,13 @@ transparent window framebuffers. If the running X server does not support this
|
|||||||
extension or there is no running compositing manager, the
|
extension or there is no running compositing manager, the
|
||||||
`GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect.
|
`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
|
@section compat_wayland Wayland protocols and IPC standards
|
||||||
|
|
||||||
@@ -104,7 +111,7 @@ has been configured in the compositor.
|
|||||||
GLFW uses the [xdg-shell
|
GLFW uses the [xdg-shell
|
||||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
|
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
|
to provide better window management. This protocol is part of
|
||||||
wayland-protocols 1.12, and mandatory at build time.
|
wayland-protocols 1.12, and is mandatory for GLFW to display a window.
|
||||||
|
|
||||||
GLFW uses the [relative pointer
|
GLFW uses the [relative pointer
|
||||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
|
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
|
||||||
@@ -230,8 +237,7 @@ at most OpenGL version 2.1.
|
|||||||
|
|
||||||
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
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
|
`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
|
given version 3.0 or 3.1. The `GLFW_OPENGL_PROFILE` hint must be set to
|
||||||
`GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
|
|
||||||
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts. The
|
`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_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored.
|
||||||
|
|
||||||
|
|||||||
+135
-210
@@ -10,173 +10,165 @@ build applications that use GLFW, see @ref build_guide.
|
|||||||
|
|
||||||
@section compile_cmake Using CMake
|
@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
|
GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles
|
||||||
for your chosen development environment. To compile GLFW, first generate these
|
for a particular development environment. If you are on a Unix-like system such
|
||||||
files with CMake and then use them to compile the GLFW library.
|
as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or
|
||||||
|
Homebrew, you can install its CMake package. If not, you can download
|
||||||
|
installers for Windows and macOS from the
|
||||||
|
[CMake website](https://cmake.org/).
|
||||||
|
|
||||||
If you are on Windows and macOS you can
|
@note CMake only generates project files or makefiles. It does not compile the
|
||||||
[download CMake](https://cmake.org/download/) from their site.
|
actual GLFW library. To compile GLFW, first generate these files for your
|
||||||
|
chosen development environment and then use them to compile the actual GLFW
|
||||||
If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have
|
library.
|
||||||
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
|
@subsection compile_deps Dependencies
|
||||||
|
|
||||||
The C/C++ development environments in Visual Studio, Xcode and MinGW come with
|
Once you have installed CMake, make sure that all other dependencies are
|
||||||
all necessary dependencies for compiling GLFW, but on Unix-like systems like
|
available. On some platforms, GLFW needs a few additional packages to be
|
||||||
Linux and FreeBSD you will need a few extra packages.
|
installed. See the section for your chosen platform and development environment
|
||||||
|
below.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_deps_x11 Dependencies for X11 on Unix-like systems
|
@subsubsection compile_deps_msvc Dependencies for Visual C++ on Windows
|
||||||
|
|
||||||
To compile GLFW for X11, you need to have the X11 development packages
|
The Windows SDK bundled with Visual C++ already contains all the necessary
|
||||||
installed. They are not needed to build or run programs that use GLFW.
|
headers, link libraries and tools except for CMake. Move on to @ref
|
||||||
|
compile_generate.
|
||||||
|
|
||||||
On Debian and derivates like Ubuntu and Linux Mint the `xorg-dev` meta-package
|
|
||||||
pulls in the development packages for all of X11.
|
@subsubsection compile_deps_mingw Dependencies for MinGW or MinGW-w64 on Windows
|
||||||
|
|
||||||
|
Both the MinGW and the MinGW-w64 packages already contain all the necessary
|
||||||
|
headers, link libraries and tools except for CMake. Move on to @ref
|
||||||
|
compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection compile_deps_mingw_cross Dependencies for MinGW or MinGW-w64 cross-compilation
|
||||||
|
|
||||||
|
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/` directory that set up
|
||||||
|
cross-compilation of Windows binaries. To use these files you add an option
|
||||||
|
when running `cmake` to generate the project files or makefiles:
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
sudo apt install xorg-dev
|
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
On Fedora and derivatives like Red Hat the X11 extension packages
|
The exact toolchain file to use depends on the prefix used by the MinGW or
|
||||||
`libXcursor-devel`, `libXi-devel`, `libXinerama-devel` and `libXrandr-devel`
|
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
||||||
required by GLFW pull in all its other dependencies.
|
directory. For example, both the Debian/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}
|
@code{.sh}
|
||||||
sudo dnf install libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
On FreeBSD the X11 headers are installed along the end-user X11 packages, so if
|
For more details see the article
|
||||||
you have an X server running you should have the headers as well. If not,
|
[CMake Cross Compiling](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling) on
|
||||||
install the `xorgproto` package.
|
the CMake wiki.
|
||||||
|
|
||||||
@code{.sh}
|
Once you have this set up, move on to @ref compile_generate.
|
||||||
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
|
@subsubsection compile_deps_xcode Dependencies for Xcode on macOS
|
||||||
|
|
||||||
To compile GLFW for Wayland, you need to have the Wayland and xkbcommon
|
Xcode comes with all necessary tools except for CMake. The required headers
|
||||||
development packages installed. They are not needed to build or run programs
|
and libraries are included in the core macOS frameworks. Xcode can be
|
||||||
that use GLFW.
|
downloaded from the Mac App Store or from the ADC Member Center.
|
||||||
|
|
||||||
On Debian and derivates like Ubuntu and Linux Mint you will need the `libwayland-dev`,
|
Once you have Xcode installed, move on to @ref compile_generate.
|
||||||
`libxkbcommon-dev`, `wayland-protocols` and `extra-cmake-modules` packages.
|
|
||||||
|
|
||||||
@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`,
|
@subsubsection compile_deps_x11 Dependencies for Linux and X11
|
||||||
`libxkbcommon-devel`, `wayland-protocols-devel` and `extra-cmake-modules` packages.
|
|
||||||
|
|
||||||
@code{.sh}
|
To compile GLFW for X11, you need to have the X11 packages installed, as well as
|
||||||
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules
|
the basic development tools like GCC and make. For example, on Ubuntu and other
|
||||||
@endcode
|
distributions based on Debian GNU/Linux, you need to install the `xorg-dev`
|
||||||
|
package, which pulls in all X.org header packages.
|
||||||
|
|
||||||
On FreeBSD you will need the `wayland`, `libxkbcommon`, `wayland-protocols` and
|
Once you have installed the necessary packages, move on to @ref
|
||||||
`kf5-extra-cmake-modules` packages.
|
compile_generate.
|
||||||
|
|
||||||
@code{.sh}
|
|
||||||
pkg install wayland libxkbcommon wayland-protocols kf5-extra-cmake-modules
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
Once you have the required depdendencies, move on to @ref compile_generate.
|
@subsubsection compile_deps_wayland Dependencies for Linux and Wayland
|
||||||
|
|
||||||
|
To compile GLFW for Wayland, you need to have the Wayland packages installed,
|
||||||
|
as well as the basic development tools like GCC and make. For example, on
|
||||||
|
Ubuntu and other distributions based on Debian GNU/Linux, you need to install
|
||||||
|
the `libwayland-dev` package, which contains all Wayland headers and pulls in
|
||||||
|
wayland-scanner, as well as the `wayland-protocols` and `extra-cmake-modules`
|
||||||
|
packages.
|
||||||
|
|
||||||
|
Once you have installed the necessary packages, move on to @ref
|
||||||
|
compile_generate.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compile_deps_osmesa Dependencies for Linux and OSMesa
|
||||||
|
|
||||||
|
To compile GLFW for OSMesa, you need to install the OSMesa library and header
|
||||||
|
packages. For example, on Ubuntu and other distributions based on Debian
|
||||||
|
GNU/Linux, you need to install the `libosmesa6-dev` package. The OSMesa library
|
||||||
|
is required at runtime for context creation and is loaded on demand.
|
||||||
|
|
||||||
|
Once you have installed the necessary packages, move on to @ref
|
||||||
|
compile_generate.
|
||||||
|
|
||||||
|
|
||||||
@subsection compile_generate Generating build files with CMake
|
@subsection compile_generate Generating build files with CMake
|
||||||
|
|
||||||
Once you have all necessary dependencies it is time to generate the project
|
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
|
files or makefiles for your development environment. CMake needs to know two
|
||||||
this:
|
paths for this: the path to the _root_ directory of the GLFW source tree (i.e.
|
||||||
|
_not_ the `src` subdirectory) and the target path for the generated files and
|
||||||
|
compiled binaries. If these are the same, it is called an in-tree build,
|
||||||
|
otherwise it is called an out-of-tree build.
|
||||||
|
|
||||||
- the path to the root directory of the GLFW source tree (not its `src`
|
One of several advantages of out-of-tree builds is that you can generate files
|
||||||
subdirectory)
|
and compile for different development environments using a single source tree.
|
||||||
- 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
|
@note This section is about generating the project files or makefiles necessary
|
||||||
out-of-tree build.
|
to compile the GLFW library, not about compiling the actual library.
|
||||||
|
|
||||||
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
|
@subsubsection compile_generate_cli Generating files with the CMake command-line tool
|
||||||
|
|
||||||
Start the CMake GUI and set the paths to the source and build directories
|
To make an in-tree build, enter the _root_ directory of the GLFW source tree
|
||||||
described above. Then press _Configure_ and _Generate_.
|
(i.e. _not_ the `src` subdirectory) and run CMake. The current directory is
|
||||||
|
used as target path, while the path provided as an argument is used to find the
|
||||||
|
source tree.
|
||||||
|
|
||||||
If you wish change any CMake variables in the list, press _Configure_ and then
|
@code{.sh}
|
||||||
_Generate_ to have the new values take effect. The variable list will be
|
cd <glfw-root-dir>
|
||||||
populated after the first configure step.
|
cmake .
|
||||||
|
@endcode
|
||||||
|
|
||||||
By default GLFW will use X11 on Linux and other Unix-like systems other
|
To make an out-of-tree build, make a directory outside of the source tree, enter
|
||||||
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` option in the
|
it and run CMake with the (relative or absolute) path to the root of the source
|
||||||
GLFW section of the variable list, then apply the new value as described above.
|
tree as an argument.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
mkdir glfw-build
|
||||||
|
cd glfw-build
|
||||||
|
cmake <glfw-root-dir>
|
||||||
|
@endcode
|
||||||
|
|
||||||
Once you have generated the project files or makefiles for your chosen
|
Once you have generated the project files or makefiles for your chosen
|
||||||
development environment, move on to @ref compile_compile.
|
development environment, move on to @ref compile_compile.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_generate_cli Generating files with the CMake command-line tool
|
@subsubsection compile_generate_gui Generating files with the CMake GUI
|
||||||
|
|
||||||
To make a build directory, pass the source and build directories to the `cmake`
|
If you are using the GUI version, choose the root of the GLFW source tree as
|
||||||
command. These can be relative or absolute paths. The build directory is
|
source location and the same directory or another, empty directory as the
|
||||||
created if it doesn't already exist.
|
destination for binaries. Choose _Configure_, change any options you wish to,
|
||||||
|
_Configure_ again to let the changes take effect and then _Generate_.
|
||||||
@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
|
Once you have generated the project files or makefiles for your chosen
|
||||||
development environment, move on to @ref compile_compile.
|
development environment, move on to @ref compile_compile.
|
||||||
@@ -186,39 +178,13 @@ development environment, move on to @ref compile_compile.
|
|||||||
|
|
||||||
You should now have all required dependencies and the project files or makefiles
|
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
|
necessary to compile GLFW. Go ahead and compile the actual GLFW library with
|
||||||
these files as you would with any other project.
|
these files, as you would with any other project.
|
||||||
|
|
||||||
With Visual Studio open `GLFW.sln` and use the Build menu. With Xcode open
|
Once the GLFW library is compiled, you are ready to build your applications,
|
||||||
`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.
|
linking it to the GLFW library. See @ref build_guide for more information.
|
||||||
|
|
||||||
|
|
||||||
@section compile_options CMake options
|
@subsection compile_options CMake options
|
||||||
|
|
||||||
The CMake files for GLFW provide a number of options, although not all are
|
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
|
available on all supported platforms. Some of these are de facto standards
|
||||||
@@ -234,101 +200,55 @@ Finally, if you don't want to use any GUI, you can set options from the `cmake`
|
|||||||
command-line with the `-D` flag.
|
command-line with the `-D` flag.
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
cmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ON
|
cmake -DBUILD_SHARED_LIBS=ON .
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection compile_options_shared Shared CMake options
|
@subsubsection compile_options_shared Shared CMake options
|
||||||
|
|
||||||
@anchor BUILD_SHARED_LIBS
|
@anchor BUILD_SHARED_LIBS
|
||||||
__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static
|
__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static
|
||||||
library or as a DLL / shared library / dynamic library. This is disabled by
|
library or as a DLL / shared library / dynamic library.
|
||||||
default, producing a static GLFW library.
|
|
||||||
|
|
||||||
@anchor GLFW_BUILD_EXAMPLES
|
@anchor GLFW_BUILD_EXAMPLES
|
||||||
__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
|
__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
|
||||||
along with the library.
|
along with the library. This is enabled by default unless GLFW is being built
|
||||||
|
as a sub-project.
|
||||||
|
|
||||||
@anchor GLFW_BUILD_TESTS
|
@anchor GLFW_BUILD_TESTS
|
||||||
__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are
|
__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are
|
||||||
built along with the library.
|
built along with the library. This is enabled by default unless GLFW is being
|
||||||
|
built as a sub-project.
|
||||||
|
|
||||||
@anchor GLFW_BUILD_DOCS
|
@anchor GLFW_BUILD_DOCS
|
||||||
__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
|
__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
|
||||||
with the library. This is enabled by default if
|
with the library.
|
||||||
[Doxygen](https://www.doxygen.nl/) is found by CMake during configuration.
|
|
||||||
|
|
||||||
@anchor GLFW_VULKAN_STATIC
|
@anchor GLFW_VULKAN_STATIC
|
||||||
__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
|
__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
|
||||||
directly with the application. This is disabled by default.
|
directly with the application.
|
||||||
|
|
||||||
|
|
||||||
@subsection compile_options_win32 Windows specific CMake options
|
@subsubsection compile_options_win32 Windows specific CMake options
|
||||||
|
|
||||||
@anchor USE_MSVC_RUNTIME_LIBRARY_DLL
|
@anchor USE_MSVC_RUNTIME_LIBRARY_DLL
|
||||||
__USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the
|
__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
|
static library version of the Visual C++ runtime library. If set to `ON`, the
|
||||||
DLL version of the Visual C++ library is used. This is enabled by default.
|
DLL version of the Visual C++ library is used.
|
||||||
|
|
||||||
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
|
@anchor GLFW_USE_HYBRID_HPG
|
||||||
__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
|
__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
|
||||||
`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
|
`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
|
||||||
high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols
|
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
|
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
|
will not work if GLFW is built as a DLL.
|
||||||
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
|
@section compile_manual Compiling GLFW manually
|
||||||
|
|
||||||
If you wish to compile GLFW without its CMake build environment then you will
|
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
|
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
|
a configuration macro to be defined in order to know what window system it's
|
||||||
being compiled for and also has optional, platform-specific ones for various
|
being compiled for and also has optional, platform-specific ones for various
|
||||||
features.
|
features.
|
||||||
|
|
||||||
@@ -360,6 +280,11 @@ 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_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b
|
||||||
_GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names.
|
_GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names.
|
||||||
|
|
||||||
|
For the EGL context creation API, the following options are available:
|
||||||
|
|
||||||
|
- @b _GLFW_USE_EGLPLATFORM_H to use an existing `EGL/eglplatform.h` header file
|
||||||
|
for native handle types (fallback)
|
||||||
|
|
||||||
@note None of the @ref build_macros may be defined during the compilation of
|
@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
|
GLFW. If you define any of these in your build files, make sure they are not
|
||||||
applied to the GLFW sources.
|
applied to the GLFW sources.
|
||||||
|
|||||||
+18
-22
@@ -84,10 +84,6 @@ objects are recommended for rendering with such contexts.
|
|||||||
You should still [process events](@ref events) as long as you have at least one
|
You should still [process events](@ref events) as long as you have at least one
|
||||||
window, even if none of them are visible.
|
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
|
@subsection context_less Windows without contexts
|
||||||
|
|
||||||
@@ -142,9 +138,9 @@ as extensions until they become obsolete.
|
|||||||
|
|
||||||
An extension is defined by:
|
An extension is defined by:
|
||||||
|
|
||||||
- An extension name (e.g. `GL_ARB_gl_spirv`)
|
- An extension name (e.g. `GL_ARB_debug_output`)
|
||||||
- New OpenGL tokens (e.g. `GL_SPIR_V_BINARY_ARB`)
|
- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`)
|
||||||
- New OpenGL functions (e.g. `glSpecializeShaderARB`)
|
- New OpenGL functions (e.g. `glGetDebugMessageLogARB`)
|
||||||
|
|
||||||
Note the `ARB` affix, which stands for Architecture Review Board and is used
|
Note the `ARB` affix, which stands for Architecture Review Board and is used
|
||||||
for official extensions. The extension above was created by the ARB, but there
|
for official extensions. The extension above was created by the ARB, but there
|
||||||
@@ -229,9 +225,9 @@ To check whether a specific extension is supported, use the `GLAD_GL_xxx`
|
|||||||
booleans.
|
booleans.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (GLAD_GL_ARB_gl_spirv)
|
if (GLAD_GL_ARB_debug_output)
|
||||||
{
|
{
|
||||||
// Use GL_ARB_gl_spirv
|
// Use GL_ARB_debug_output
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@@ -263,8 +259,8 @@ included in your development environment may be several years out of date and
|
|||||||
may not include the extensions you wish to use.
|
may not include the extensions you wish to use.
|
||||||
|
|
||||||
The header defines function pointer types for all functions of all extensions it
|
The header defines function pointer types for all functions of all extensions it
|
||||||
supports. These have names like `PFNGLSPECIALIZESHADERARBPROC` (for
|
supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for
|
||||||
`glSpecializeShaderARB`), i.e. the name is made uppercase and `PFN` (pointer
|
`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer
|
||||||
to function) and `PROC` (procedure) are added to the ends.
|
to function) and `PROC` (procedure) are added to the ends.
|
||||||
|
|
||||||
To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including
|
To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including
|
||||||
@@ -284,7 +280,7 @@ is necessary to check at run-time whether the context supports the extension.
|
|||||||
This is done with @ref glfwExtensionSupported.
|
This is done with @ref glfwExtensionSupported.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
||||||
{
|
{
|
||||||
// The extension is supported by the current context
|
// The extension is supported by the current context
|
||||||
}
|
}
|
||||||
@@ -303,7 +299,7 @@ your operating system, making it necessary to fetch them at run time. You can
|
|||||||
retrieve pointers to these functions with @ref glfwGetProcAddress.
|
retrieve pointers to these functions with @ref glfwGetProcAddress.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB");
|
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
In general, you should avoid giving the function pointer variables the (exact)
|
In general, you should avoid giving the function pointer variables the (exact)
|
||||||
@@ -317,28 +313,28 @@ when used together.
|
|||||||
#define GLFW_INCLUDE_GLEXT
|
#define GLFW_INCLUDE_GLEXT
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#define glSpecializeShaderARB pfnSpecializeShaderARB
|
#define glGetDebugMessageLogARB pfnGetDebugMessageLog
|
||||||
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB;
|
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;
|
||||||
|
|
||||||
// Flag indicating whether the extension is supported
|
// Flag indicating whether the extension is supported
|
||||||
int has_ARB_gl_spirv = 0;
|
int has_ARB_debug_output = 0;
|
||||||
|
|
||||||
void load_extensions(void)
|
void load_extensions(void)
|
||||||
{
|
{
|
||||||
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
||||||
{
|
{
|
||||||
pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC)
|
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC)
|
||||||
glfwGetProcAddress("glSpecializeShaderARB");
|
glfwGetProcAddress("glGetDebugMessageLogARB");
|
||||||
has_ARB_gl_spirv = 1;
|
has_ARB_debug_output = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void some_function(void)
|
void some_function(void)
|
||||||
{
|
{
|
||||||
if (has_ARB_gl_spirv)
|
if (has_ARB_debug_output)
|
||||||
{
|
{
|
||||||
// Now the extension function can be called as usual
|
// Now the extension function can be called as usual
|
||||||
glSpecializeShaderARB(...);
|
glGetDebugMessageLogARB(...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
{"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"}
|
|
||||||
@@ -1,106 +1,106 @@
|
|||||||
// NOTE: Please use this file to perform modifications on default style sheets.
|
// NOTE: Please use this file to perform modifications on default style sheets.
|
||||||
//
|
//
|
||||||
// You need to install the official Sass CLI tool:
|
// You need to install a few Ruby gems to generate extra.css from this file:
|
||||||
// npm install -g sass
|
// gem install less therubyracer
|
||||||
//
|
//
|
||||||
// Run this command to regenerate extra.css after you're finished with changes:
|
// Run this command to regenerate extra.css after you're finished with changes:
|
||||||
// sass --style=compressed extra.scss extra.css
|
// lessc --compress extra.less > extra.css
|
||||||
//
|
//
|
||||||
// Alternatively you can use online services to regenerate extra.css.
|
// Alternatively you can use online services to regenerate extra.css.
|
||||||
|
|
||||||
|
|
||||||
// Default text color for page contents
|
// Default text color for page contents
|
||||||
$default-text-color: hsl(0,0%,30%);
|
@default-text-color: hsl(0,0%,30%);
|
||||||
|
|
||||||
// Page header, footer, table rows, inline codes and definition lists
|
// Page header, footer, table rows, inline codes and definition lists
|
||||||
$header-footer-background-color: hsl(0,0%,95%);
|
@header-footer-background-color: hsl(0,0%,95%);
|
||||||
|
|
||||||
// Page header, footer links and navigation bar background
|
// Page header, footer links and navigation bar background
|
||||||
$header-footer-link-color: hsl(0,0%,40%);
|
@header-footer-link-color: hsl(0,0%,40%);
|
||||||
|
|
||||||
// Doxygen navigation bar links
|
// Doxygen navigation bar links
|
||||||
$navbar-link-color: $header-footer-background-color;
|
@navbar-link-color: @header-footer-background-color;
|
||||||
|
|
||||||
// Page content background color
|
// Page content background color
|
||||||
$content-background-color: hsl(0,0%,100%);
|
@content-background-color: hsl(0,0%,100%);
|
||||||
|
|
||||||
// Bold, italic, h1, h2, ... and table of contents
|
// Bold, italic, h1, h2, ... and table of contents
|
||||||
$heading-color: hsl(0,0%,10%);
|
@heading-color: hsl(0,0%,10%);
|
||||||
|
|
||||||
// Function, enum and macro definition separator
|
// Function, enum and macro definition separator
|
||||||
$def-separator-color: $header-footer-background-color;
|
@def-separator-color: @header-footer-background-color;
|
||||||
|
|
||||||
// Base color hue
|
// Base color hue
|
||||||
$base-hue: 24;
|
@base-hue: 24;
|
||||||
|
|
||||||
// Default color used for links
|
// Default color used for links
|
||||||
$default-link-color: hsl($base-hue,100%,50%);
|
@default-link-color: hsl(@base-hue,100%,50%);
|
||||||
|
|
||||||
// Doxygen navigation bar active tab
|
// Doxygen navigation bar active tab
|
||||||
$tab-text-color: hsl(0,0%,100%);
|
@tab-text-color: hsl(0,0%,100%);
|
||||||
$tab-background-color1: $default-link-color;
|
@tab-background-color1: @default-link-color;
|
||||||
$tab-background-color2: lighten(adjust-hue($tab-background-color1, 10), 10%);
|
@tab-background-color2: lighten(spin(@tab-background-color1, 10), 10%);
|
||||||
|
|
||||||
// Table borders
|
// Table borders
|
||||||
$default-border-color: $default-link-color;
|
@default-border-color: @default-link-color;
|
||||||
|
|
||||||
// Table header
|
// Table header
|
||||||
$table-text-color: $tab-text-color;
|
@table-text-color: @tab-text-color;
|
||||||
$table-background-color1: $tab-background-color1;
|
@table-background-color1: @tab-background-color1;
|
||||||
$table-background-color2: $tab-background-color2;
|
@table-background-color2: @tab-background-color2;
|
||||||
|
|
||||||
// Table of contents, data structure index and prototypes
|
// Table of contents, data structure index and prototypes
|
||||||
$toc-background-color1: hsl(0,0%,90%);
|
@toc-background-color1: hsl(0,0%,90%);
|
||||||
$toc-background-color2: lighten($toc-background-color1, 5%);
|
@toc-background-color2: lighten(@toc-background-color1, 5%);
|
||||||
|
|
||||||
// Function prototype parameters color
|
// Function prototype parameters color
|
||||||
$prototype-param-color: darken($default-link-color, 25%);
|
@prototype-param-color: darken(@default-link-color, 25%);
|
||||||
|
|
||||||
// Message box color: note, pre, post and invariant
|
// Message box color: note, pre, post and invariant
|
||||||
$box-note-color: hsl(103,80%,85%);
|
@box-note-color: hsl(103,80%,85%);
|
||||||
|
|
||||||
// Message box color: warning and attention
|
// Message box color: warning and attention
|
||||||
$box-warning-color: hsl(34,80%,85%);
|
@box-warning-color: hsl(34,80%,85%);
|
||||||
|
|
||||||
// Message box color: deprecated and bug
|
// Message box color: deprecated and bug
|
||||||
$box-bug-color: hsl(333,80%,85%);
|
@box-bug-color: hsl(333,80%,85%);
|
||||||
|
|
||||||
// Message box color: todo and test
|
// Message box color: todo and test
|
||||||
$box-todo-color: hsl(200,80%,85%);
|
@box-todo-color: hsl(200,80%,85%);
|
||||||
|
|
||||||
// Message box helper function
|
// Message box helper function
|
||||||
@mixin message-box($base-color){
|
.message-box(@base-color) {
|
||||||
background:linear-gradient(to bottom,lighten($base-color, 5%) 0%,$base-color 100%);
|
background:linear-gradient(to bottom,lighten(@base-color, 5%) 0%,@base-color 100%);
|
||||||
box-shadow:inset 0 0 32px darken($base-color, 5%);
|
box-shadow:inset 0 0 32px darken(@base-color, 5%);
|
||||||
color:darken($base-color, 67%);
|
color:darken(@base-color, 67%);
|
||||||
border:2px solid desaturate(darken($base-color, 10%), 20%);
|
border:2px solid desaturate(darken(@base-color, 10%), 20%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.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 {
|
.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;
|
background:none;
|
||||||
text-shadow:none;
|
text-shadow:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sm-dox a span.sub-arrow {
|
.sm-dox a span.sub-arrow {
|
||||||
border-color:$navbar-link-color transparent transparent transparent;
|
border-color:@navbar-link-color 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 {
|
.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:$default-link-color transparent transparent transparent;
|
border-color:@default-link-color 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 {
|
.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 $default-link-color;
|
border-color:transparent transparent transparent @default-link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sm-dox ul a:hover {
|
.sm-dox ul a:hover {
|
||||||
background:$header-footer-link-color;
|
background:@header-footer-link-color;
|
||||||
text-shadow:none;
|
text-shadow:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sm-dox ul.sm-nowrap a {
|
.sm-dox ul.sm-nowrap a {
|
||||||
color:$default-text-color;
|
color:@default-text-color;
|
||||||
text-shadow:none;
|
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 {
|
#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 {
|
||||||
@@ -128,61 +128,55 @@ div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.a
|
|||||||
}
|
}
|
||||||
|
|
||||||
html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven {
|
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:$header-footer-background-color;
|
background:@header-footer-background-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
color:$default-text-color;
|
color:@default-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
|
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
|
||||||
color:$heading-color;
|
color:@heading-color;
|
||||||
border-bottom:none;
|
border-bottom:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
padding-top:0.5em;
|
padding-top:0.5em;
|
||||||
font-size:180%;
|
font-size:180%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
padding-top:0.5em;
|
padding-top:0.5em;
|
||||||
margin-bottom:0;
|
margin-bottom:0;
|
||||||
font-size:140%;
|
font-size:140%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
padding-top:0.5em;
|
padding-top:0.5em;
|
||||||
margin-bottom:0;
|
margin-bottom:0;
|
||||||
font-size:110%;
|
font-size:110%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glfwheader {
|
.glfwheader {
|
||||||
font-size:16px;
|
font-size:16px;
|
||||||
min-height:64px;
|
height:64px;
|
||||||
max-width:920px;
|
max-width:920px;
|
||||||
|
min-width:800px;
|
||||||
padding:0 32px;
|
padding:0 32px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
align-content: stretch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#glfwhome {
|
#glfwhome {
|
||||||
line-height:64px;
|
line-height:64px;
|
||||||
padding-right:48px;
|
padding-right:48px;
|
||||||
color:$header-footer-link-color;
|
color:@header-footer-link-color;
|
||||||
font-size:2.5em;
|
font-size:2.5em;
|
||||||
background:url("https://www.glfw.org/css/arrow.png") no-repeat right;
|
background:url("https://www.glfw.org/css/arrow.png") no-repeat right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glfwnavbar {
|
.glfwnavbar {
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
margin:0 0 0 auto;
|
margin:0 auto;
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,11 +188,7 @@ h3 {
|
|||||||
line-height:64px;
|
line-height:64px;
|
||||||
margin-left:2em;
|
margin-left:2em;
|
||||||
display:block;
|
display:block;
|
||||||
color:$header-footer-link-color;
|
color:@header-footer-link-color;
|
||||||
}
|
|
||||||
|
|
||||||
.glfwnavbar {
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#glfwhome,.glfwnavbar a,.glfwnavbar a:visited {
|
#glfwhome,.glfwnavbar a,.glfwnavbar a:visited {
|
||||||
@@ -206,7 +196,7 @@ h3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#titlearea,.footer {
|
#titlearea,.footer {
|
||||||
color:$header-footer-link-color;
|
color:@header-footer-link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
address.footer {
|
address.footer {
|
||||||
@@ -216,54 +206,48 @@ address.footer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#top {
|
#top {
|
||||||
background:$header-footer-link-color;
|
background:@header-footer-link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-nav {
|
#main-nav {
|
||||||
max-width:960px;
|
max-width:960px;
|
||||||
|
min-width:800px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-menu {
|
#main-menu {
|
||||||
max-width:920px;
|
max-width:920px;
|
||||||
|
min-width:800px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.memtitle {
|
.memtitle {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.memproto,.memname {
|
.memproto,.memname {
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
text-shadow:none;
|
text-shadow:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-menu {
|
#main-menu {
|
||||||
min-height:36px;
|
height:36px;
|
||||||
display: flex;
|
display:block;
|
||||||
flex-direction: row;
|
position:relative;
|
||||||
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 {
|
#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li {
|
||||||
color:$navbar-link-color;
|
color:@navbar-link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-menu li ul.sm-nowrap li a {
|
#main-menu li ul.sm-nowrap li a {
|
||||||
color:$default-text-color;
|
color:@default-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-menu li ul.sm-nowrap li a:hover {
|
#main-menu li ul.sm-nowrap li a:hover {
|
||||||
color:$default-link-color;
|
color:@default-link-color;
|
||||||
}
|
|
||||||
|
|
||||||
#main-menu > li:last-child {
|
|
||||||
margin: 0 0 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.contents {
|
.contents {
|
||||||
@@ -274,22 +258,22 @@ div.contents,div.header {
|
|||||||
max-width:920px;
|
max-width:920px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
padding:0 32px;
|
padding:0 32px;
|
||||||
background:$content-background-color none;
|
background:@content-background-color none;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.doxtable th,table.markdownTable th,dl.reflist dt {
|
table.doxtable th,table.markdownTable th,dl.reflist dt {
|
||||||
background:linear-gradient(to bottom,$table-background-color2 0%,$table-background-color1 100%);
|
background:linear-gradient(to bottom,@table-background-color2 0%,@table-background-color1 100%);
|
||||||
box-shadow:inset 0 0 32px $table-background-color1;
|
box-shadow:inset 0 0 32px @table-background-color1;
|
||||||
text-shadow:0 -1px 1px darken($table-background-color1, 15%);
|
text-shadow:0 -1px 1px darken(@table-background-color1, 15%);
|
||||||
text-align:left;
|
text-align:left;
|
||||||
color:$table-text-color;
|
color:@table-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.reflist dt a.el {
|
dl.reflist dt a.el {
|
||||||
color:$default-link-color;
|
color:@default-link-color;
|
||||||
padding:.2em;
|
padding:.2em;
|
||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
background-color:lighten($default-link-color, 40%);
|
background-color:lighten(@default-link-color, 40%);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.toc {
|
div.toc {
|
||||||
@@ -312,27 +296,27 @@ div.toc li {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.toc,.memproto,div.qindex,div.ah {
|
div.toc,.memproto,div.qindex,div.ah {
|
||||||
background:linear-gradient(to bottom,$toc-background-color2 0%,$toc-background-color1 100%);
|
background:linear-gradient(to bottom,@toc-background-color2 0%,@toc-background-color1 100%);
|
||||||
box-shadow:inset 0 0 32px $toc-background-color1;
|
box-shadow:inset 0 0 32px @toc-background-color1;
|
||||||
text-shadow:0 1px 1px lighten($toc-background-color2, 10%);
|
text-shadow:0 1px 1px lighten(@toc-background-color2, 10%);
|
||||||
color:$heading-color;
|
color:@heading-color;
|
||||||
border:2px solid $toc-background-color1;
|
border:2px solid @toc-background-color1;
|
||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paramname {
|
.paramname {
|
||||||
color:$prototype-param-color;
|
color:@prototype-param-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.reflist dt {
|
dl.reflist dt {
|
||||||
border:2px solid $default-border-color;
|
border:2px solid @default-border-color;
|
||||||
border-top-left-radius:4px;
|
border-top-left-radius:4px;
|
||||||
border-top-right-radius:4px;
|
border-top-right-radius:4px;
|
||||||
border-bottom:none;
|
border-bottom:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.reflist dd {
|
dl.reflist dd {
|
||||||
border:2px solid $default-border-color;
|
border:2px solid @default-border-color;
|
||||||
border-bottom-right-radius:4px;
|
border-bottom-right-radius:4px;
|
||||||
border-bottom-left-radius:4px;
|
border-bottom-left-radius:4px;
|
||||||
border-top:none;
|
border-top:none;
|
||||||
@@ -341,41 +325,41 @@ dl.reflist dd {
|
|||||||
table.doxtable,table.markdownTable {
|
table.doxtable,table.markdownTable {
|
||||||
border-collapse:inherit;
|
border-collapse:inherit;
|
||||||
border-spacing:0;
|
border-spacing:0;
|
||||||
border:2px solid $default-border-color;
|
border:2px solid @default-border-color;
|
||||||
border-radius:4px;
|
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 {
|
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:$default-link-color;
|
color:@default-link-color;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.directory {
|
div.directory {
|
||||||
border-collapse:inherit;
|
border-collapse:inherit;
|
||||||
border-spacing:0;
|
border-spacing:0;
|
||||||
border:2px solid $default-border-color;
|
border:2px solid @default-border-color;
|
||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr,.memSeparator {
|
hr,.memSeparator {
|
||||||
height:2px;
|
height:2px;
|
||||||
background:linear-gradient(to right,$def-separator-color 0%,darken($def-separator-color, 10%) 50%,$def-separator-color 100%);
|
background:linear-gradient(to right,@def-separator-color 0%,darken(@def-separator-color, 10%) 50%,@def-separator-color 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.note,dl.pre,dl.post,dl.invariant {
|
dl.note,dl.pre,dl.post,dl.invariant {
|
||||||
@include message-box($box-note-color);
|
.message-box(@box-note-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.warning,dl.attention {
|
dl.warning,dl.attention {
|
||||||
@include message-box($box-warning-color);
|
.message-box(@box-warning-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.deprecated,dl.bug {
|
dl.deprecated,dl.bug {
|
||||||
@include message-box($box-bug-color);
|
.message-box(@box-bug-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.todo,dl.test {
|
dl.todo,dl.test {
|
||||||
@include message-box($box-todo-color);
|
.message-box(@box-todo-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test {
|
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test {
|
||||||
@@ -404,7 +388,7 @@ div.fragment,pre.fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.lineno a,.lineno a:visited,.line,pre.fragment {
|
.lineno a,.lineno a:visited,.line,pre.fragment {
|
||||||
color:$default-text-color;
|
color:@default-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.preprocessor,span.comment {
|
span.preprocessor,span.comment {
|
||||||
@@ -416,7 +400,7 @@ a.code,a.code:visited {
|
|||||||
}
|
}
|
||||||
|
|
||||||
span.keyword,span.keywordtype,span.keywordflow {
|
span.keyword,span.keywordtype,span.keywordflow {
|
||||||
color:darken($default-text-color, 5%);
|
color:darken(@default-text-color, 5%);
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
<meta name="generator" content="Doxygen $doxygenversion"/>
|
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||||
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||||
|
|||||||
+35
-23
@@ -123,21 +123,9 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. Events with
|
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key
|
||||||
`GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most
|
will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it, for example
|
||||||
keys will also emit events with `GLFW_REPEAT` actions while a key is held down.
|
_E-mail_ and _Play_ keys.
|
||||||
|
|
||||||
Key events with `GLFW_REPEAT` actions are intended for text input. They are
|
|
||||||
emitted at the rate set in the user's keyboard settings. At most one key is
|
|
||||||
repeated even if several keys are held down. `GLFW_REPEAT` actions should not
|
|
||||||
be relied on to know which keys are being held down or to drive animation.
|
|
||||||
Instead you should either save the state of relevant keys based on `GLFW_PRESS`
|
|
||||||
and `GLFW_RELEASE` actions, or call @ref glfwGetKey, which provides basic cached
|
|
||||||
key state.
|
|
||||||
|
|
||||||
The key will be one of the existing [key tokens](@ref keys), or
|
|
||||||
`GLFW_KEY_UNKNOWN` if GLFW lacks a token for it, for example _E-mail_ and _Play_
|
|
||||||
keys.
|
|
||||||
|
|
||||||
The scancode is unique for every key, regardless of whether it has a key token.
|
The scancode is unique for every key, regardless of whether it has a key token.
|
||||||
Scancodes are platform-specific but consistent over time, so keys will have
|
Scancodes are platform-specific but consistent over time, so keys will have
|
||||||
@@ -242,6 +230,32 @@ specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is
|
|||||||
ignored. This matches the behavior of the key callback, meaning the callback
|
ignored. This matches the behavior of the key callback, meaning the callback
|
||||||
arguments can always be passed unmodified to this function.
|
arguments can always be passed unmodified to this function.
|
||||||
|
|
||||||
|
The name of a key will not change unless the keyboard layout changes.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection keyboard_layout Keyboard layout
|
||||||
|
|
||||||
|
The human-readable name of the current keyboard layout is returned by @ref
|
||||||
|
glfwGetKeyboardLayoutName.
|
||||||
|
|
||||||
|
If you wish to be notified when the keyboard layout changes, set a keyboard
|
||||||
|
layout callback.
|
||||||
|
|
||||||
|
@code
|
||||||
|
glfwSetKeyboardLayoutCallback(keyboard_layout_callback);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The callback is called when the new layout takes effect for the application,
|
||||||
|
which on some platforms may not happen until one of its windows gets input
|
||||||
|
focus.
|
||||||
|
|
||||||
|
@code
|
||||||
|
void keyboard_layout_callback(void)
|
||||||
|
{
|
||||||
|
update_keyboard_layout_name(glfwGetKeyboardLayoutName());
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@section input_mouse Mouse input
|
@section input_mouse Mouse input
|
||||||
|
|
||||||
@@ -385,12 +399,15 @@ A cursor with a [standard shape](@ref shapes) from the current system cursor
|
|||||||
theme can be can be created with @ref glfwCreateStandardCursor.
|
theme can be can be created with @ref glfwCreateStandardCursor.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
GLFWcursor* url_cursor = glfwCreateStandardCursor(GLFW_POINTING_HAND_CURSOR);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
These cursor objects behave in the exact same way as those created with @ref
|
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.
|
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
|
@subsubsection cursor_destruction Cursor destruction
|
||||||
|
|
||||||
@@ -657,7 +674,7 @@ const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4);
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Joystick names are not guaranteed to be unique. Two joysticks of the same model
|
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
|
and make may have the same name. Only the [joystick token](@ref joysticks) is
|
||||||
guaranteed to be unique, and only until that joystick is disconnected.
|
guaranteed to be unique, and only until that joystick is disconnected.
|
||||||
|
|
||||||
|
|
||||||
@@ -806,11 +823,6 @@ glfwUpdateGamepadMappings(mappings);
|
|||||||
This function supports everything from single lines up to and including the
|
This function supports everything from single lines up to and including the
|
||||||
unmodified contents of the whole `gamecontrollerdb.txt` file.
|
unmodified contents of the whole `gamecontrollerdb.txt` file.
|
||||||
|
|
||||||
If you are compiling GLFW from source with CMake you can update the built-in mappings by
|
|
||||||
building the _update_mappings_ target. This runs the `GenerateMappings.cmake` CMake
|
|
||||||
script, which downloads `gamecontrollerdb.txt` and regenerates the `mappings.h` header
|
|
||||||
file.
|
|
||||||
|
|
||||||
Below is a description of the mapping format. Please keep in mind that __this
|
Below is a description of the mapping format. Please keep in mind that __this
|
||||||
description is not authoritative__. The format is defined by the SDL and
|
description is not authoritative__. The format is defined by the SDL and
|
||||||
SDL_GameControllerDB projects and their documentation and code takes precedence.
|
SDL_GameControllerDB projects and their documentation and code takes precedence.
|
||||||
@@ -830,7 +842,7 @@ The second value is always the human-readable name of the gamepad.
|
|||||||
All subsequent values are in the form `<field>:<value>` and describe the layout
|
All subsequent values are in the form `<field>:<value>` and describe the layout
|
||||||
of the mapping. These fields may not all be present and may occur in any order.
|
of the mapping. These fields may not all be present and may occur in any order.
|
||||||
|
|
||||||
The button fields are `a`, `b`, `x`, `y`, `back`, `start`, `guide`, `dpup`,
|
The button fields are `a`, `b`, `c`, `d`, `back`, `start`, `guide`, `dpup`,
|
||||||
`dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and
|
`dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and
|
||||||
`rightstick`.
|
`rightstick`.
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -62,6 +62,11 @@ before the application exits. Modern systems are very good at freeing resources
|
|||||||
allocated by programs that exit, but GLFW sometimes has to change global system
|
allocated by programs that exit, but GLFW sometimes has to change global system
|
||||||
settings and these might not be restored without termination.
|
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
|
@subsection init_hints Initialization hints
|
||||||
|
|
||||||
@@ -86,7 +91,7 @@ Setting these hints requires no platform specific headers or functions.
|
|||||||
@anchor GLFW_JOYSTICK_HAT_BUTTONS
|
@anchor GLFW_JOYSTICK_HAT_BUTTONS
|
||||||
__GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as
|
__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
|
buttons, for compatibility with earlier versions of GLFW that did not have @ref
|
||||||
glfwGetJoystickHats. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
glfwGetJoystickHats. Set this with @ref glfwInitHint.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection init_hints_osx macOS specific init hints
|
@subsubsection init_hints_osx macOS specific init hints
|
||||||
@@ -97,9 +102,9 @@ the application to the `Contents/Resources` subdirectory of the application's
|
|||||||
bundle, if present. Set this with @ref glfwInitHint.
|
bundle, if present. Set this with @ref glfwInitHint.
|
||||||
|
|
||||||
@anchor GLFW_COCOA_MENUBAR_hint
|
@anchor GLFW_COCOA_MENUBAR_hint
|
||||||
__GLFW_COCOA_MENUBAR__ specifies whether to create a basic menu bar, either from
|
__GLFW_COCOA_MENUBAR__ specifies whether to create the menu bar and dock icon
|
||||||
a nib or manually, when the first window is created, which is when AppKit is
|
when GLFW is initialized. This applies whether the menu bar is created from
|
||||||
initialized. Set this with @ref glfwInitHint.
|
a nib or manually by GLFW. Set this with @ref glfwInitHint.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection init_hints_values Supported and default values
|
@subsubsection init_hints_values Supported and default values
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and
|
|||||||
Vulkan application development. It provides a simple, platform-independent API
|
Vulkan application development. It provides a simple, platform-independent API
|
||||||
for creating windows, contexts and surfaces, reading input, handling events, etc.
|
for creating windows, contexts and surfaces, reading input, handling events, etc.
|
||||||
|
|
||||||
@ref news_33 list new features, caveats and deprecations.
|
@ref news_34 list new features, caveats and deprecations.
|
||||||
|
|
||||||
@ref quick_guide is a guide for users new to GLFW. It takes you through how to
|
@ref quick_guide is a guide for users new to GLFW. It takes you through how to
|
||||||
write a small but complete program.
|
write a small but complete program.
|
||||||
|
|||||||
+2
-2
@@ -362,8 +362,8 @@ should be using the character callback instead, on both GLFW 2 and 3. This will
|
|||||||
give you the characters being input, as opposed to the keys being pressed.
|
give you the characters being input, as opposed to the keys being pressed.
|
||||||
|
|
||||||
GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of
|
GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of
|
||||||
having to remember whether to check for `a` or `A`, you now check for
|
having to remember whether to check for `'a'` or `'A'`, you now check for
|
||||||
@ref GLFW_KEY_A.
|
`GLFW_KEY_A`.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_joystick Joystick function changes
|
@subsection moving_joystick Joystick function changes
|
||||||
|
|||||||
+63
-834
@@ -5,872 +5,101 @@
|
|||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
|
|
||||||
@section news_33 Release notes for version 3.3
|
@section news_34 Release notes for version 3.4
|
||||||
|
|
||||||
These are the release notes for version 3.3. For a more detailed view including
|
@subsection features_34 New features in version 3.4
|
||||||
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
|
@subsubsection keyboard_layout_34 Keyboard layouts
|
||||||
against an earlier version of GLFW 3.
|
|
||||||
|
|
||||||
|
GLFW can now notify when the keyboard layout has changed with @ref
|
||||||
|
glfwSetKeyboardLayoutCallback and provides the human-readable name of the
|
||||||
|
current layout with @ref glfwGetKeyboardLayoutName.
|
||||||
|
|
||||||
@subsection features_33 New features in version 3.3
|
For more information, see @ref keyboard_layout.
|
||||||
|
|
||||||
@subsubsection gamepad_33 Gamepad input via SDL_GameControllerDB
|
|
||||||
|
|
||||||
GLFW can now remap game controllers to a standard Xbox-like layout using
|
@subsubsection standard_cursors_34 More standard cursors
|
||||||
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.
|
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 omni-directional 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.
|
||||||
|
|
||||||
@subsubsection moltenvk_33 Support for Vulkan on macOS via MoltenVK
|
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.
|
||||||
|
|
||||||
GLFW now supports [MoltenVK](https://moltengl.com/moltenvk/), a Vulkan
|
For more information see @ref cursor_standard.
|
||||||
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 features_34_win32_keymenu Support for keyboard access to Windows window menu
|
||||||
|
|
||||||
@subsubsection content_scale_33 Content scale queries for DPI-aware rendering
|
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.
|
||||||
|
|
||||||
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
|
@subsection caveats_34 Caveats for version 3.4
|
||||||
scale callback, set with @ref glfwSetWindowContentScaleCallback.
|
|
||||||
|
|
||||||
The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a
|
@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project
|
||||||
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.
|
GLFW now does not build the tests and examples when it is added as
|
||||||
|
a subdirectory of another CMake project. To enable these, set the @ref
|
||||||
|
GLFW_BUILD_TESTS and @ref GLFW_BUILD_EXAMPLES cache variables before adding the
|
||||||
|
GLFW subdirectory.
|
||||||
|
|
||||||
|
@code{.cmake}
|
||||||
|
set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE)
|
||||||
|
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
|
||||||
|
add_subdirectory(path/to/glfw)
|
||||||
|
@endcode
|
||||||
|
|
||||||
@subsubsection setwindowattrib_33 Support for updating window attributes
|
|
||||||
|
|
||||||
GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
|
@subsubsection initmenu_34 macOS main menu now created at initialization
|
||||||
[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.
|
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.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection raw_motion_33 Support for raw mouse motion
|
@subsubsection corevideo_34 CoreVideo dependency has been removed
|
||||||
|
|
||||||
GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled
|
GLFW no longer depends on the CoreVideo framework on macOS and it no longer
|
||||||
cursor mode with the [GLFW_RAW_MOUSE_MOTION](@ref GLFW_RAW_MOUSE_MOTION) input
|
needs to be specified during compilation or linking.
|
||||||
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.
|
|
||||||
|
|
||||||
|
@subsection deprecations_34 Deprecations in version 3.4
|
||||||
|
|
||||||
@subsubsection joysticks_33 Joystick hats
|
@subsection removals_34 Removals in 3.4
|
||||||
|
|
||||||
GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with
|
@subsection symbols_34 New symbols in version 3.4
|
||||||
@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 functions_34 New functions in version 3.4
|
||||||
|
@subsubsection types_34 New types in version 3.4
|
||||||
|
@subsubsection constants_34 New constants in version 3.4
|
||||||
|
|
||||||
|
- @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_NOT_ALLOWED_CURSOR
|
||||||
|
- @ref GLFW_CURSOR_UNAVAILABLE
|
||||||
|
- @ref GLFW_WIN32_KEYBOARD_MENU
|
||||||
|
|
||||||
@subsubsection geterror_33 Error query
|
|
||||||
|
|
||||||
GLFW now supports querying the last error code for the calling thread and its
|
@section news_archive Release notes for earlier versions
|
||||||
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.
|
- [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)
|
||||||
@subsubsection init_hints_33 Support for initialization hints
|
- [Release notes for 3.0](https://www.glfw.org/docs/3.0/news.html)
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
||||||
|
|
||||||
@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.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
+39
-32
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
@tableofcontents
|
@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
|
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
|
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.
|
introduce a few of the most commonly used functions, but there are many more.
|
||||||
@@ -18,42 +18,43 @@ behave differently in GLFW 3.
|
|||||||
|
|
||||||
@subsection quick_include Including the GLFW header
|
@subsection quick_include Including the GLFW header
|
||||||
|
|
||||||
In the source files of your application where you use GLFW, you need to include
|
In the source files of your application where you use OpenGL or GLFW, you need
|
||||||
its header file.
|
to include the GLFW 3 header file.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This header provides all the constants, types and function prototypes of the
|
This defines all the constants, types and function prototypes of the GLFW API.
|
||||||
GLFW API.
|
It also includes the OpenGL header from your development environment and
|
||||||
|
defines all the constants and types necessary for it to work on your platform
|
||||||
|
without including any platform-specific headers.
|
||||||
|
|
||||||
By default it also includes the OpenGL header from your development environment.
|
In other words:
|
||||||
On some platforms this header only supports older versions of OpenGL. The most
|
|
||||||
extreme case is Windows, where it typically only supports OpenGL 1.2.
|
|
||||||
|
|
||||||
Most programs will instead use an
|
- Do _not_ include the OpenGL header yourself, as GLFW does this for you in
|
||||||
[extension loader library](@ref context_glext_auto) and include its header.
|
a platform-independent way
|
||||||
This example uses files generated by [glad](https://gen.glad.sh/). The GLFW
|
- Do _not_ include `windows.h` or other platform-specific headers unless
|
||||||
header can detect most such headers if they are included first and will then not
|
you plan on using those APIs yourself
|
||||||
include the one from your development environment.
|
- If you _do_ need to include such headers, include them _before_ the GLFW
|
||||||
|
header and it will detect this
|
||||||
|
|
||||||
|
On some platforms supported by GLFW the OpenGL header and link library only
|
||||||
|
expose older versions of OpenGL. The most extreme case is Windows, which only
|
||||||
|
exposes OpenGL 1.2. The easiest way to work around this is to use an
|
||||||
|
[extension loader library](@ref context_glext_auto).
|
||||||
|
|
||||||
|
If you are using such a library then you should include its header _before_ the
|
||||||
|
GLFW header. This lets it replace the OpenGL header included by GLFW without
|
||||||
|
conflicts. This example uses
|
||||||
|
[glad2](https://github.com/Dav1dde/glad), but the same rule applies to all such
|
||||||
|
libraries.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#include <glad/gl.h>
|
#include <glad/gl.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@endcode
|
@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
|
|
||||||
#define GLFW_INCLUDE_NONE
|
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
#include <glad/gl.h>
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
|
|
||||||
@subsection quick_init_term Initializing and terminating GLFW
|
@subsection quick_init_term Initializing and terminating GLFW
|
||||||
|
|
||||||
@@ -134,9 +135,14 @@ require a minimum OpenGL version by setting the `GLFW_CONTEXT_VERSION_MAJOR` and
|
|||||||
`GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation. If the required minimum
|
`GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation. If the required minimum
|
||||||
version is not supported on the machine, context (and window) creation fails.
|
version is not supported on the machine, context (and window) creation fails.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@@ -329,19 +335,20 @@ for example, many kinds of editing tools.
|
|||||||
@section quick_example Putting it together
|
@section quick_example Putting it together
|
||||||
|
|
||||||
Now that you know how to initialize GLFW, create a window and poll for
|
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
|
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
|
clears the screen, renders a triangle and processes events until the user either
|
||||||
presses _Escape_ or closes the window.
|
presses _Escape_ or closes the window.
|
||||||
|
|
||||||
@snippet simple.c code
|
@snippet triangle-opengl.c code
|
||||||
|
|
||||||
The program above can be found in the
|
The program above can be found in the
|
||||||
[source package](https://www.glfw.org/download.html) as `examples/simple.c`
|
[source package](https://www.glfw.org/download.html) as
|
||||||
and is compiled along with all other examples when you build GLFW. If you
|
`examples/triangle-opengl.c` and is compiled along with all other examples when
|
||||||
built GLFW from the source package then you already have this as `simple.exe` on
|
you build GLFW. If you built GLFW from the source package then you already have
|
||||||
Windows, `simple` on Linux or `simple.app` on macOS.
|
this as `triangle-opengl.exe` on Windows, `triangle-opengl` on Linux or
|
||||||
|
`triangle-opengl.app` on macOS.
|
||||||
|
|
||||||
This tutorial used only a few of the many functions GLFW provides. There are
|
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
|
guides for each of the areas covered by GLFW. Each guide will introduce all the
|
||||||
|
|||||||
+4
-11
@@ -42,9 +42,9 @@ 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
|
directly instead of dynamically loading it at runtime. Not linking against the
|
||||||
Vulkan loader will then be a compile-time error.
|
Vulkan loader will then be a compile-time error.
|
||||||
|
|
||||||
@macos To make your application be redistributable you will need to set up the
|
@macos Because the Vulkan loader and ICD are not installed globally on macOS,
|
||||||
application bundle according to the LunarG SDK documentation. This is explained
|
you need to set up the application bundle according to the LunarG SDK
|
||||||
in more detail in the
|
documentation. This is explained in more detail in the
|
||||||
[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
|
[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
|
||||||
|
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ if (glfwVulkanSupported())
|
|||||||
This function returns `GLFW_TRUE` if the Vulkan loader and any minimally
|
This function returns `GLFW_TRUE` if the Vulkan loader and any minimally
|
||||||
functional ICD was found.
|
functional ICD was found.
|
||||||
|
|
||||||
If one or both were not found, calling any other Vulkan related GLFW function
|
If if one or both were not found, calling any other Vulkan related GLFW function
|
||||||
will generate a @ref GLFW_API_UNAVAILABLE error.
|
will generate a @ref GLFW_API_UNAVAILABLE error.
|
||||||
|
|
||||||
|
|
||||||
@@ -177,13 +177,6 @@ check whether any extensions you wish to enable are already in the returned
|
|||||||
array, as it is an error to specify an extension more than once in the
|
array, as it is an error to specify an extension more than once in the
|
||||||
`VkInstanceCreateInfo` struct.
|
`VkInstanceCreateInfo` struct.
|
||||||
|
|
||||||
@macos MoltenVK is (as of July 2022) not yet a fully conformant implementation
|
|
||||||
of Vulkan. As of Vulkan SDK 1.3.216.0, this means you must also enable the
|
|
||||||
`VK_KHR_portability_enumeration` instance extension and set the
|
|
||||||
`VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the instance creation
|
|
||||||
info flags for MoltenVK to show up in the list of physical devices. For more
|
|
||||||
information, see the Vulkan and MoltenVK documentation.
|
|
||||||
|
|
||||||
|
|
||||||
@section vulkan_present Querying for Vulkan presentation support
|
@section vulkan_present Querying for Vulkan presentation support
|
||||||
|
|
||||||
|
|||||||
+77
-48
@@ -234,10 +234,16 @@ alpha channel will be used to combine the framebuffer with the background. This
|
|||||||
does not affect window decorations. Possible values are `GLFW_TRUE` and
|
does not affect window decorations. Possible values are `GLFW_TRUE` and
|
||||||
`GLFW_FALSE`.
|
`GLFW_FALSE`.
|
||||||
|
|
||||||
|
@par
|
||||||
|
@win32 GLFW sets a color key for the window to work around repainting issues
|
||||||
|
with a transparent framebuffer. The chosen color value is RGB 255,0,255
|
||||||
|
(magenta). This will make pixels with that exact color fully transparent
|
||||||
|
regardless of their alpha values. If this is a problem, make these pixels any
|
||||||
|
other color before buffer swap.
|
||||||
|
|
||||||
@anchor GLFW_FOCUS_ON_SHOW_hint
|
@anchor GLFW_FOCUS_ON_SHOW_hint
|
||||||
__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input
|
__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input
|
||||||
focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and
|
focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||||
`GLFW_FALSE`.
|
|
||||||
|
|
||||||
@anchor GLFW_SCALE_TO_MONITOR
|
@anchor GLFW_SCALE_TO_MONITOR
|
||||||
__GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be
|
__GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be
|
||||||
@@ -272,6 +278,7 @@ __GLFW_ACCUM_ALPHA_BITS__ specify the desired bit depths of the various
|
|||||||
components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the
|
components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the
|
||||||
application has no preference.
|
application has no preference.
|
||||||
|
|
||||||
|
@par
|
||||||
Accumulation buffers are a legacy OpenGL feature and should not be used in new
|
Accumulation buffers are a legacy OpenGL feature and should not be used in new
|
||||||
code.
|
code.
|
||||||
|
|
||||||
@@ -279,6 +286,7 @@ code.
|
|||||||
__GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value
|
__GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value
|
||||||
of `GLFW_DONT_CARE` means the application has no preference.
|
of `GLFW_DONT_CARE` means the application has no preference.
|
||||||
|
|
||||||
|
@par
|
||||||
Auxiliary buffers are a legacy OpenGL feature and should not be used in new
|
Auxiliary buffers are a legacy OpenGL feature and should not be used in new
|
||||||
code.
|
code.
|
||||||
|
|
||||||
@@ -295,12 +303,14 @@ the application has no preference.
|
|||||||
__GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable.
|
__GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable.
|
||||||
Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||||
|
|
||||||
@note __OpenGL:__ If enabled and supported by the system, the
|
@par
|
||||||
`GL_FRAMEBUFFER_SRGB` enable will control sRGB rendering. By default, sRGB
|
__OpenGL:__ If enabled and supported by the system, the `GL_FRAMEBUFFER_SRGB`
|
||||||
rendering will be disabled.
|
enable will control sRGB rendering. By default, sRGB rendering will be
|
||||||
|
disabled.
|
||||||
|
|
||||||
@note __OpenGL ES:__ If enabled and supported by the system, the context will
|
@par
|
||||||
always have sRGB rendering enabled.
|
__OpenGL ES:__ If enabled and supported by the system, the context will always
|
||||||
|
have sRGB rendering enabled.
|
||||||
|
|
||||||
@anchor GLFW_DOUBLEBUFFER
|
@anchor GLFW_DOUBLEBUFFER
|
||||||
__GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double
|
__GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double
|
||||||
@@ -329,22 +339,28 @@ create the context. Possible values are `GLFW_NATIVE_CONTEXT_API`,
|
|||||||
`GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard
|
`GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard
|
||||||
constraint. If no client API is requested, this hint is ignored.
|
constraint. If no client API is requested, this hint is ignored.
|
||||||
|
|
||||||
An [extension loader library](@ref context_glext_auto) that assumes it knows
|
@par
|
||||||
which API was used to create the current context may fail if you change this
|
@macos The EGL API is not available on this platform and requests to use it
|
||||||
hint. This can be resolved by having it load functions via @ref
|
will fail.
|
||||||
glfwGetProcAddress.
|
|
||||||
|
|
||||||
@note @wayland The EGL API _is_ the native context creation API, so this hint
|
@par
|
||||||
|
__Wayland:__ The EGL API _is_ the native context creation API, so this hint
|
||||||
will have no effect.
|
will have no effect.
|
||||||
|
|
||||||
@note @x11 On some Linux systems, creating contexts via both the native and EGL
|
@par
|
||||||
APIs in a single process will cause the application to segfault. Stick to one
|
__OSMesa:__ As its name implies, an OpenGL context created with OSMesa does not
|
||||||
API or the other on Linux for now.
|
update the window contents when its buffers are swapped. Use OpenGL functions
|
||||||
|
or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer and @ref
|
||||||
|
glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
|
||||||
|
|
||||||
@note __OSMesa:__ As its name implies, an OpenGL context created with OSMesa
|
@note An OpenGL extension loader library that assumes it knows which context
|
||||||
does not update the window contents when its buffers are swapped. Use OpenGL
|
creation API is used on a given platform may fail if you change this hint. This
|
||||||
functions or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer
|
can be resolved by having it load via @ref glfwGetProcAddress, which always uses
|
||||||
and @ref glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
|
the selected API.
|
||||||
|
|
||||||
|
@bug On some Linux systems, creating contexts via both the native and EGL APIs
|
||||||
|
in a single process will cause the application to segfault. Stick to one API or
|
||||||
|
the other on Linux for now.
|
||||||
|
|
||||||
@anchor GLFW_CONTEXT_VERSION_MAJOR_hint
|
@anchor GLFW_CONTEXT_VERSION_MAJOR_hint
|
||||||
@anchor GLFW_CONTEXT_VERSION_MINOR_hint
|
@anchor GLFW_CONTEXT_VERSION_MINOR_hint
|
||||||
@@ -352,31 +368,32 @@ __GLFW_CONTEXT_VERSION_MAJOR__ and __GLFW_CONTEXT_VERSION_MINOR__ specify the
|
|||||||
client API version that the created context must be compatible with. The exact
|
client API version that the created context must be compatible with. The exact
|
||||||
behavior of these hints depend on the requested client API.
|
behavior of these hints depend on the requested client API.
|
||||||
|
|
||||||
|
@note Do not confuse these hints with `GLFW_VERSION_MAJOR` and
|
||||||
|
`GLFW_VERSION_MINOR`, which provide the API version of the GLFW header.
|
||||||
|
|
||||||
|
@par
|
||||||
|
__OpenGL:__ These hints are not hard constraints, but creation will fail if the
|
||||||
|
OpenGL version of the created context is less than the one requested. It is
|
||||||
|
therefore perfectly safe to use the default of version 1.0 for legacy code and
|
||||||
|
you will still get backwards-compatible contexts of version 3.0 and above when
|
||||||
|
available.
|
||||||
|
|
||||||
|
@par
|
||||||
While there is no way to ask the driver for a context of the highest supported
|
While there is no way to ask the driver for a context of the highest supported
|
||||||
version, GLFW will attempt to provide this when you ask for a version 1.0
|
version, GLFW will attempt to provide this when you ask for a version 1.0
|
||||||
context, which is the default for these hints.
|
context, which is the default for these hints.
|
||||||
|
|
||||||
Do not confuse these hints with @ref GLFW_VERSION_MAJOR and @ref
|
@par
|
||||||
GLFW_VERSION_MINOR, which provide the API version of the GLFW header.
|
__OpenGL ES:__ These hints are not hard constraints, but creation will fail if
|
||||||
|
the OpenGL ES version of the created context is less than the one requested.
|
||||||
|
Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was 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 __OpenGL:__ These hints are not hard constraints, but creation will fail
|
@note @macos The OS only supports core profile contexts for OpenGL versions 3.2
|
||||||
if the OpenGL version of the created context is less than the one requested. It
|
and later. Before creating an OpenGL context of version 3.2 or later you must
|
||||||
is therefore perfectly safe to use the default of version 1.0 for legacy code
|
set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hint accordingly.
|
||||||
and you will still get backwards-compatible contexts of version 3.0 and above
|
OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
|
||||||
when available.
|
|
||||||
|
|
||||||
@note __OpenGL ES:__ These hints are not hard constraints, but creation will
|
|
||||||
fail if the OpenGL ES version of the created context is less than the one
|
|
||||||
requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was
|
|
||||||
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.
|
|
||||||
|
|
||||||
@anchor GLFW_OPENGL_FORWARD_COMPAT_hint
|
@anchor GLFW_OPENGL_FORWARD_COMPAT_hint
|
||||||
__GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be
|
__GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be
|
||||||
@@ -384,17 +401,15 @@ forward-compatible, i.e. one where all functionality deprecated in the requested
|
|||||||
version of OpenGL is removed. This must only be used if the requested OpenGL
|
version of OpenGL is removed. This must only be used if the requested OpenGL
|
||||||
version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.
|
version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.
|
||||||
|
|
||||||
|
@par
|
||||||
Forward-compatibility is described in detail in the
|
Forward-compatibility is described in detail in the
|
||||||
[OpenGL Reference Manual](https://www.opengl.org/registry/).
|
[OpenGL Reference Manual](https://www.opengl.org/registry/).
|
||||||
|
|
||||||
@anchor GLFW_OPENGL_DEBUG_CONTEXT_hint
|
@anchor GLFW_OPENGL_DEBUG_CONTEXT_hint
|
||||||
__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created
|
__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether to create a debug OpenGL
|
||||||
in debug mode, which may provide additional error and diagnostic reporting
|
context, which may have additional error and performance issue reporting
|
||||||
functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If OpenGL ES
|
||||||
|
is requested, this hint is ignored.
|
||||||
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.
|
|
||||||
|
|
||||||
@anchor GLFW_OPENGL_PROFILE_hint
|
@anchor GLFW_OPENGL_PROFILE_hint
|
||||||
__GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context
|
__GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context
|
||||||
@@ -404,6 +419,7 @@ a specific profile. If requesting an OpenGL version below 3.2,
|
|||||||
`GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint
|
`GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint
|
||||||
is ignored.
|
is ignored.
|
||||||
|
|
||||||
|
@par
|
||||||
OpenGL profiles are described in detail in the
|
OpenGL profiles are described in detail in the
|
||||||
[OpenGL Reference Manual](https://www.opengl.org/registry/).
|
[OpenGL Reference Manual](https://www.opengl.org/registry/).
|
||||||
|
|
||||||
@@ -423,6 +439,7 @@ the pipeline will be flushed whenever the context is released from being the
|
|||||||
current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will
|
current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will
|
||||||
not be flushed on release.
|
not be flushed on release.
|
||||||
|
|
||||||
|
@par
|
||||||
Context release behaviors are described in detail by the
|
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)
|
[GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt)
|
||||||
extension.
|
extension.
|
||||||
@@ -432,11 +449,20 @@ __GLFW_CONTEXT_NO_ERROR__ specifies whether errors should be generated by the
|
|||||||
context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled,
|
context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled,
|
||||||
situations that would have generated errors instead cause undefined behavior.
|
situations that would have generated errors instead cause undefined behavior.
|
||||||
|
|
||||||
|
@par
|
||||||
The no error mode for OpenGL and OpenGL ES is described in detail by the
|
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)
|
[GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt)
|
||||||
extension.
|
extension.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection window_hints_win32 Windows specific window hints
|
||||||
|
|
||||||
|
@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.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection window_hints_osx macOS specific window hints
|
@subsubsection window_hints_osx macOS specific window hints
|
||||||
|
|
||||||
@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
|
@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
|
||||||
@@ -457,10 +483,12 @@ run on the discrete GPU. This only affects systems with both integrated and
|
|||||||
discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is
|
discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is
|
||||||
ignored on other platforms.
|
ignored on other platforms.
|
||||||
|
|
||||||
|
@par
|
||||||
Simpler programs and tools may want to enable this to save power, while games
|
Simpler programs and tools may want to enable this to save power, while games
|
||||||
and other applications performing advanced rendering will want to leave it
|
and other applications performing advanced rendering will want to leave it
|
||||||
disabled.
|
disabled.
|
||||||
|
|
||||||
|
@par
|
||||||
A bundled application that wishes to participate in Automatic Graphics Switching
|
A bundled application that wishes to participate in Automatic Graphics Switching
|
||||||
should also declare this in its `Info.plist` by setting the
|
should also declare this in its `Info.plist` by setting the
|
||||||
`NSSupportsAutomaticGraphicsSwitching` key to `true`.
|
`NSSupportsAutomaticGraphicsSwitching` key to `true`.
|
||||||
@@ -515,6 +543,7 @@ GLFW_CONTEXT_RELEASE_BEHAVIOR | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_
|
|||||||
GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_OPENGL_DEBUG_CONTEXT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_OPENGL_DEBUG_CONTEXT | `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_OPENGL_PROFILE | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
|
||||||
|
GLFW_WIN32_KEYBOARD_MENU | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name
|
GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name
|
||||||
GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
@@ -1306,8 +1335,8 @@ __GLFW_OPENGL_FORWARD_COMPAT__ is `GLFW_TRUE` if the window's context is an
|
|||||||
OpenGL forward-compatible one, or `GLFW_FALSE` otherwise.
|
OpenGL forward-compatible one, or `GLFW_FALSE` otherwise.
|
||||||
|
|
||||||
@anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib
|
@anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib
|
||||||
__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is in debug
|
__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is an
|
||||||
mode, or `GLFW_FALSE` otherwise.
|
OpenGL debug context, or `GLFW_FALSE` otherwise.
|
||||||
|
|
||||||
@anchor GLFW_OPENGL_PROFILE_attrib
|
@anchor GLFW_OPENGL_PROFILE_attrib
|
||||||
__GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This
|
__GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This
|
||||||
|
|||||||
+9
-24
@@ -7,8 +7,7 @@ if (MATH_LIBRARY)
|
|||||||
link_libraries("${MATH_LIBRARY}")
|
link_libraries("${MATH_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Workaround for the MS CRT deprecating parts of the standard library
|
if (MSVC)
|
||||||
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -18,17 +17,6 @@ elseif (APPLE)
|
|||||||
set(ICON glfw.icns)
|
set(ICON glfw.icns)
|
||||||
endif()
|
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"
|
set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
|
||||||
"${GLFW_SOURCE_DIR}/deps/glad_gl.c")
|
"${GLFW_SOURCE_DIR}/deps/glad_gl.c")
|
||||||
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
||||||
@@ -42,20 +30,21 @@ add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL})
|
|||||||
add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
|
add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
|
||||||
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${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(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(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL})
|
||||||
|
add_executable(triangle-opengl WIN32 MACOSX_BUNDLE triangle-opengl.c ${ICON} ${GLAD_GL})
|
||||||
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
|
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
|
||||||
|
|
||||||
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}")
|
target_link_libraries(particles Threads::Threads)
|
||||||
if (RT_LIBRARY)
|
if (RT_LIBRARY)
|
||||||
target_link_libraries(particles "${RT_LIBRARY}")
|
target_link_libraries(particles "${RT_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(GUI_ONLY_BINARIES boing gears heightmap particles sharing simple splitview
|
set(GUI_ONLY_BINARIES boing gears heightmap particles sharing splitview
|
||||||
wave)
|
triangle-opengl wave)
|
||||||
set(CONSOLE_BINARIES offscreen)
|
set(CONSOLE_BINARIES offscreen)
|
||||||
|
|
||||||
set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||||
|
C_STANDARD 99
|
||||||
FOLDER "GLFW3/Examples")
|
FOLDER "GLFW3/Examples")
|
||||||
|
|
||||||
if (GLFW_USE_OSMESA)
|
if (GLFW_USE_OSMESA)
|
||||||
@@ -63,13 +52,9 @@ if (GLFW_USE_OSMESA)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Tell MSVC to use main instead of WinMain
|
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
||||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
||||||
LINK_FLAGS "/ENTRY:mainCRTStartup")
|
LINK_FLAGS "/ENTRY:mainCRTStartup")
|
||||||
elseif (CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
|
||||||
# Tell Clang using MS CRT to use main instead of WinMain
|
|
||||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
|
||||||
LINK_FLAGS "-Wl,/entry:mainCRTStartup")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
@@ -78,7 +63,7 @@ if (APPLE)
|
|||||||
set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
|
set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
|
||||||
set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
|
set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
|
||||||
set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
|
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(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
|
set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
|
||||||
set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
||||||
|
|
||||||
@@ -88,6 +73,6 @@ if (APPLE)
|
|||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
||||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
|
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
|
||||||
MACOSX_BUNDLE_ICON_FILE glfw.icns
|
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()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -292,12 +292,12 @@ static void generate_heightmap__circle(float* center_x, float* center_y,
|
|||||||
{
|
{
|
||||||
float sign;
|
float sign;
|
||||||
/* random value for element in between [0-1.0] */
|
/* random value for element in between [0-1.0] */
|
||||||
*center_x = (MAP_SIZE * rand()) / (float) RAND_MAX;
|
*center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
|
||||||
*center_y = (MAP_SIZE * rand()) / (float) RAND_MAX;
|
*center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
|
||||||
*size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX;
|
*size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX);
|
||||||
sign = (1.0f * rand()) / (float) RAND_MAX;
|
sign = (1.0f * rand()) / (1.0f * RAND_MAX);
|
||||||
sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f;
|
sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f;
|
||||||
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX;
|
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run the specified number of iterations of the generation process for the
|
/* Run the specified number of iterations of the generation process for the
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// This is an example program for the GLFW library
|
// This is an example program for the GLFW library
|
||||||
//
|
//
|
||||||
// The program uses a "split window" view, rendering four views of the
|
// The program uses a "split window" view, rendering four views of the
|
||||||
// same scene in one window (e.g. useful for 3D modelling software). This
|
// same scene in one window (e.g. uesful for 3D modelling software). This
|
||||||
// demo uses scissors to separate the four different rendering areas from
|
// demo uses scissors to separate the four different rendering areas from
|
||||||
// each other.
|
// each other.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// Simple GLFW example
|
// OpenGL triangle example
|
||||||
// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied
|
// This software is provided 'as-is', without any express or implied
|
||||||
@@ -31,25 +31,28 @@
|
|||||||
#include "linmath.h"
|
#include "linmath.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static const struct
|
typedef struct Vertex
|
||||||
{
|
{
|
||||||
float x, y;
|
vec2 pos;
|
||||||
float r, g, b;
|
vec3 col;
|
||||||
} vertices[3] =
|
} Vertex;
|
||||||
|
|
||||||
|
static const Vertex vertices[3] =
|
||||||
{
|
{
|
||||||
{ -0.6f, -0.4f, 1.f, 0.f, 0.f },
|
{ { -0.6f, -0.4f }, { 1.f, 0.f, 0.f } },
|
||||||
{ 0.6f, -0.4f, 0.f, 1.f, 0.f },
|
{ { 0.6f, -0.4f }, { 0.f, 1.f, 0.f } },
|
||||||
{ 0.f, 0.6f, 0.f, 0.f, 1.f }
|
{ { 0.f, 0.6f }, { 0.f, 0.f, 1.f } }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* vertex_shader_text =
|
static const char* vertex_shader_text =
|
||||||
"#version 110\n"
|
"#version 330\n"
|
||||||
"uniform mat4 MVP;\n"
|
"uniform mat4 MVP;\n"
|
||||||
"attribute vec3 vCol;\n"
|
"in vec3 vCol;\n"
|
||||||
"attribute vec2 vPos;\n"
|
"in vec2 vPos;\n"
|
||||||
"varying vec3 color;\n"
|
"out vec3 color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
|
" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
|
||||||
@@ -57,11 +60,12 @@ static const char* vertex_shader_text =
|
|||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static const char* fragment_shader_text =
|
static const char* fragment_shader_text =
|
||||||
"#version 110\n"
|
"#version 330\n"
|
||||||
"varying vec3 color;\n"
|
"in vec3 color;\n"
|
||||||
|
"out vec4 fragment;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = vec4(color, 1.0);\n"
|
" fragment = vec4(color, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
@@ -77,19 +81,16 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow* window;
|
|
||||||
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
|
||||||
GLint mvp_location, vpos_location, vcol_location;
|
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
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)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
@@ -104,53 +105,56 @@ int main(void)
|
|||||||
|
|
||||||
// NOTE: OpenGL error checks have been omitted for brevity
|
// NOTE: OpenGL error checks have been omitted for brevity
|
||||||
|
|
||||||
|
GLuint vertex_buffer;
|
||||||
glGenBuffers(1, &vertex_buffer);
|
glGenBuffers(1, &vertex_buffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
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);
|
glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);
|
||||||
glCompileShader(vertex_shader);
|
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);
|
glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);
|
||||||
glCompileShader(fragment_shader);
|
glCompileShader(fragment_shader);
|
||||||
|
|
||||||
program = glCreateProgram();
|
const GLuint program = glCreateProgram();
|
||||||
glAttachShader(program, vertex_shader);
|
glAttachShader(program, vertex_shader);
|
||||||
glAttachShader(program, fragment_shader);
|
glAttachShader(program, fragment_shader);
|
||||||
glLinkProgram(program);
|
glLinkProgram(program);
|
||||||
|
|
||||||
mvp_location = glGetUniformLocation(program, "MVP");
|
const GLint mvp_location = glGetUniformLocation(program, "MVP");
|
||||||
vpos_location = glGetAttribLocation(program, "vPos");
|
const GLint vpos_location = glGetAttribLocation(program, "vPos");
|
||||||
vcol_location = glGetAttribLocation(program, "vCol");
|
const GLint vcol_location = glGetAttribLocation(program, "vCol");
|
||||||
|
|
||||||
|
GLuint vertex_array;
|
||||||
|
glGenVertexArrays(1, &vertex_array);
|
||||||
|
glBindVertexArray(vertex_array);
|
||||||
glEnableVertexAttribArray(vpos_location);
|
glEnableVertexAttribArray(vpos_location);
|
||||||
glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
|
glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
|
||||||
sizeof(vertices[0]), (void*) 0);
|
sizeof(Vertex), (void*) offsetof(Vertex, pos));
|
||||||
glEnableVertexAttribArray(vcol_location);
|
glEnableVertexAttribArray(vcol_location);
|
||||||
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
|
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
|
||||||
sizeof(vertices[0]), (void*) (sizeof(float) * 2));
|
sizeof(Vertex), (void*) offsetof(Vertex, col));
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
float ratio;
|
|
||||||
int width, height;
|
int width, height;
|
||||||
mat4x4 m, p, mvp;
|
|
||||||
|
|
||||||
glfwGetFramebufferSize(window, &width, &height);
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
ratio = width / (float) height;
|
const float ratio = width / (float) height;
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
mat4x4 m, p, mvp;
|
||||||
mat4x4_identity(m);
|
mat4x4_identity(m);
|
||||||
mat4x4_rotate_Z(m, m, (float) glfwGetTime());
|
mat4x4_rotate_Z(m, m, (float) glfwGetTime());
|
||||||
mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
|
mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
|
||||||
mat4x4_mul(mvp, p, m);
|
mat4x4_mul(mvp, p, m);
|
||||||
|
|
||||||
glUseProgram(program);
|
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);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
+302
-150
@@ -1,5 +1,5 @@
|
|||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW 3.3 - www.glfw.org
|
* GLFW 3.4 - www.glfw.org
|
||||||
* A library for OpenGL, window and input
|
* A library for OpenGL, window and input
|
||||||
*------------------------------------------------------------------------
|
*------------------------------------------------------------------------
|
||||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
@@ -190,44 +190,10 @@ extern "C" {
|
|||||||
#else /*__APPLE__*/
|
#else /*__APPLE__*/
|
||||||
|
|
||||||
#include <GL/glcorearb.h>
|
#include <GL/glcorearb.h>
|
||||||
#if defined(GLFW_INCLUDE_GLEXT)
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__APPLE__*/
|
#endif /*__APPLE__*/
|
||||||
|
|
||||||
#elif defined(GLFW_INCLUDE_GLU)
|
#elif !defined(GLFW_INCLUDE_NONE)
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
|
|
||||||
#if defined(GLFW_INCLUDE_GLU)
|
|
||||||
#include <OpenGL/glu.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /*__APPLE__*/
|
|
||||||
|
|
||||||
#if defined(GLFW_INCLUDE_GLU)
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__APPLE__*/
|
|
||||||
|
|
||||||
#elif !defined(GLFW_INCLUDE_NONE) && \
|
|
||||||
!defined(__gl_h_) && \
|
|
||||||
!defined(__gles1_gl_h_) && \
|
|
||||||
!defined(__gles2_gl2_h_) && \
|
|
||||||
!defined(__gles2_gl3_h_) && \
|
|
||||||
!defined(__gles2_gl31_h_) && \
|
|
||||||
!defined(__gles2_gl32_h_) && \
|
|
||||||
!defined(__gl_glcorearb_h_) && \
|
|
||||||
!defined(__gl2_h_) /*legacy*/ && \
|
|
||||||
!defined(__gl3_h_) /*legacy*/ && \
|
|
||||||
!defined(__gl31_h_) /*legacy*/ && \
|
|
||||||
!defined(__gl32_h_) /*legacy*/ && \
|
|
||||||
!defined(__glcorearb_h_) /*legacy*/ && \
|
|
||||||
!defined(__GL_H__) /*non-standard*/ && \
|
|
||||||
!defined(__gltypes_h_) /*non-standard*/ && \
|
|
||||||
!defined(__glee_h_) /*non-standard*/
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
@@ -235,6 +201,9 @@ extern "C" {
|
|||||||
#define GL_GLEXT_LEGACY
|
#define GL_GLEXT_LEGACY
|
||||||
#endif
|
#endif
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
|
#if defined(GLFW_INCLUDE_GLU)
|
||||||
|
#include <OpenGL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /*__APPLE__*/
|
#else /*__APPLE__*/
|
||||||
|
|
||||||
@@ -242,6 +211,9 @@ extern "C" {
|
|||||||
#if defined(GLFW_INCLUDE_GLEXT)
|
#if defined(GLFW_INCLUDE_GLEXT)
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(GLFW_INCLUDE_GLU)
|
||||||
|
#include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /*__APPLE__*/
|
#endif /*__APPLE__*/
|
||||||
|
|
||||||
@@ -262,12 +234,13 @@ extern "C" {
|
|||||||
/* We are building GLFW as a Win32 DLL */
|
/* We are building GLFW as a Win32 DLL */
|
||||||
#define GLFWAPI __declspec(dllexport)
|
#define GLFWAPI __declspec(dllexport)
|
||||||
#elif defined(_WIN32) && defined(GLFW_DLL)
|
#elif defined(_WIN32) && defined(GLFW_DLL)
|
||||||
/* We are calling a GLFW Win32 DLL */
|
/* We are calling GLFW as a Win32 DLL */
|
||||||
#define GLFWAPI __declspec(dllimport)
|
#define GLFWAPI __declspec(dllimport)
|
||||||
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
|
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
|
||||||
/* We are building GLFW as a Unix shared library */
|
/* We are building GLFW as a shared / dynamic library */
|
||||||
#define GLFWAPI __attribute__((visibility("default")))
|
#define GLFWAPI __attribute__((visibility("default")))
|
||||||
#else
|
#else
|
||||||
|
/* We are building or calling GLFW as a static library */
|
||||||
#define GLFWAPI
|
#define GLFWAPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -278,27 +251,26 @@ extern "C" {
|
|||||||
|
|
||||||
/*! @name GLFW version macros
|
/*! @name GLFW version macros
|
||||||
* @{ */
|
* @{ */
|
||||||
/*! @brief The major version number of the GLFW header.
|
/*! @brief The major version number of the GLFW library.
|
||||||
*
|
*
|
||||||
* The major version number of the GLFW header. This is incremented when the
|
* This is incremented when the API is changed in non-compatible ways.
|
||||||
* API is changed in non-compatible ways.
|
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_MAJOR 3
|
#define GLFW_VERSION_MAJOR 3
|
||||||
/*! @brief The minor version number of the GLFW header.
|
/*! @brief The minor version number of the GLFW library.
|
||||||
*
|
*
|
||||||
* The minor version number of the GLFW header. This is incremented when
|
* This is incremented when features are added to the API but it remains
|
||||||
* features are added to the API but it remains backward-compatible.
|
* backward-compatible.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_MINOR 3
|
#define GLFW_VERSION_MINOR 4
|
||||||
/*! @brief The revision number of the GLFW header.
|
/*! @brief The revision number of the GLFW library.
|
||||||
*
|
*
|
||||||
* The revision number of the GLFW header. This is incremented when a bug fix
|
* This is incremented when a bug fix release is made that does not contain any
|
||||||
* release is made that does not contain any API changes.
|
* API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 8
|
#define GLFW_VERSION_REVISION 0
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@@ -785,6 +757,17 @@ extern "C" {
|
|||||||
* @analysis Application programmer error. Fix the offending call.
|
* @analysis Application programmer error. Fix the offending call.
|
||||||
*/
|
*/
|
||||||
#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
|
#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 system 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
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @addtogroup window
|
/*! @addtogroup window
|
||||||
@@ -959,7 +942,7 @@ extern "C" {
|
|||||||
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
|
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
|
||||||
/*! @brief Context client API revision number attribute.
|
/*! @brief Context client API revision number hint and attribute.
|
||||||
*
|
*
|
||||||
* Context client API revision number
|
* Context client API revision number
|
||||||
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
||||||
@@ -977,9 +960,9 @@ extern "C" {
|
|||||||
* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
|
* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
|
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
|
||||||
/*! @brief Debug mode context hint and attribute.
|
/*! @brief OpenGL debug context hint and attribute.
|
||||||
*
|
*
|
||||||
* Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
|
* OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
|
||||||
* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
|
* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
|
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
|
||||||
@@ -1031,6 +1014,7 @@ extern "C" {
|
|||||||
* [window hint](@ref GLFW_X11_CLASS_NAME_hint).
|
* [window hint](@ref GLFW_X11_CLASS_NAME_hint).
|
||||||
*/
|
*/
|
||||||
#define GLFW_X11_INSTANCE_NAME 0x00024002
|
#define GLFW_X11_INSTANCE_NAME 0x00024002
|
||||||
|
#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
#define GLFW_NO_API 0
|
#define GLFW_NO_API 0
|
||||||
@@ -1066,14 +1050,15 @@ extern "C" {
|
|||||||
/*! @defgroup shapes Standard cursor shapes
|
/*! @defgroup shapes Standard cursor shapes
|
||||||
* @brief Standard system 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 window system.
|
||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
* @{ */
|
* @{ */
|
||||||
|
|
||||||
/*! @brief The regular arrow cursor shape.
|
/*! @brief The regular arrow cursor shape.
|
||||||
*
|
*
|
||||||
* The regular arrow cursor.
|
* The regular arrow cursor shape.
|
||||||
*/
|
*/
|
||||||
#define GLFW_ARROW_CURSOR 0x00036001
|
#define GLFW_ARROW_CURSOR 0x00036001
|
||||||
/*! @brief The text input I-beam cursor shape.
|
/*! @brief The text input I-beam cursor shape.
|
||||||
@@ -1081,26 +1066,91 @@ extern "C" {
|
|||||||
* The text input I-beam cursor shape.
|
* The text input I-beam cursor shape.
|
||||||
*/
|
*/
|
||||||
#define GLFW_IBEAM_CURSOR 0x00036002
|
#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
|
#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
|
#define GLFW_POINTING_HAND_CURSOR 0x00036004
|
||||||
/*! @brief The horizontal resize arrow shape.
|
/*! @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
|
#define GLFW_RESIZE_EW_CURSOR 0x00036005
|
||||||
/*! @brief The vertical resize arrow shape.
|
/*! @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 @x11 This shape is provided by a newer standard not supported by all
|
||||||
|
* cursor themes.
|
||||||
|
*
|
||||||
|
* @note @wayland 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 @x11 This shape is provided by a newer standard not supported by all
|
||||||
|
* cursor themes.
|
||||||
|
*
|
||||||
|
* @note @wayland 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 @x11 This shape is provided by a newer standard not supported by all
|
||||||
|
* cursor themes.
|
||||||
|
*
|
||||||
|
* @note @wayland 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
|
#define GLFW_CONNECTED 0x00040001
|
||||||
@@ -1218,7 +1268,24 @@ typedef struct GLFWcursor GLFWcursor;
|
|||||||
*
|
*
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWerrorfun)(int error_code, const char* description);
|
typedef void (* GLFWerrorfun)(int,const char*);
|
||||||
|
|
||||||
|
/*! @brief The function pointer type for keyboard layout callbacks.
|
||||||
|
*
|
||||||
|
* This is the function pointer type for keyboard layout callbacks. A keyboard
|
||||||
|
* layout callback function has the following signature:
|
||||||
|
* @code
|
||||||
|
* void callback_name(void);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @sa @ref keyboard_layout
|
||||||
|
* @sa @ref glfwSetKeyboardLayoutCallback
|
||||||
|
*
|
||||||
|
* @since Added in version 3.4.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
typedef void (* GLFWkeyboardlayoutfun)(void);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window position callbacks.
|
/*! @brief The function pointer type for window position callbacks.
|
||||||
*
|
*
|
||||||
@@ -1241,7 +1308,7 @@ typedef void (* GLFWerrorfun)(int error_code, const char* description);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
|
typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window size callbacks.
|
/*! @brief The function pointer type for window size callbacks.
|
||||||
*
|
*
|
||||||
@@ -1263,7 +1330,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
|
typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window close callbacks.
|
/*! @brief The function pointer type for window close callbacks.
|
||||||
*
|
*
|
||||||
@@ -1283,7 +1350,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
|
typedef void (* GLFWwindowclosefun)(GLFWwindow*);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window content refresh callbacks.
|
/*! @brief The function pointer type for window content refresh callbacks.
|
||||||
*
|
*
|
||||||
@@ -1303,7 +1370,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
|
typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window focus callbacks.
|
/*! @brief The function pointer type for window focus callbacks.
|
||||||
*
|
*
|
||||||
@@ -1324,7 +1391,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
|
typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window iconify callbacks.
|
/*! @brief The function pointer type for window iconify callbacks.
|
||||||
*
|
*
|
||||||
@@ -1345,7 +1412,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
|
typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window maximize callbacks.
|
/*! @brief The function pointer type for window maximize callbacks.
|
||||||
*
|
*
|
||||||
@@ -1356,7 +1423,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
|
|||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] window The window that was maximized or restored.
|
* @param[in] window The window that was maximized or restored.
|
||||||
* @param[in] maximized `GLFW_TRUE` if the window was maximized, or
|
* @param[in] iconified `GLFW_TRUE` if the window was maximized, or
|
||||||
* `GLFW_FALSE` if it was restored.
|
* `GLFW_FALSE` if it was restored.
|
||||||
*
|
*
|
||||||
* @sa @ref window_maximize
|
* @sa @ref window_maximize
|
||||||
@@ -1366,7 +1433,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
|
typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for framebuffer size callbacks.
|
/*! @brief The function pointer type for framebuffer size callbacks.
|
||||||
*
|
*
|
||||||
@@ -1387,7 +1454,7 @@ typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);
|
typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window content scale callbacks.
|
/*! @brief The function pointer type for window content scale callbacks.
|
||||||
*
|
*
|
||||||
@@ -1408,7 +1475,7 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int heigh
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);
|
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
|
||||||
|
|
||||||
/*! @brief The function pointer type for mouse button callbacks.
|
/*! @brief The function pointer type for mouse button callbacks.
|
||||||
*
|
*
|
||||||
@@ -1434,7 +1501,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, flo
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
|
typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for cursor position callbacks.
|
/*! @brief The function pointer type for cursor position callbacks.
|
||||||
*
|
*
|
||||||
@@ -1457,7 +1524,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action,
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
|
typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
|
||||||
|
|
||||||
/*! @brief The function pointer type for cursor enter/leave callbacks.
|
/*! @brief The function pointer type for cursor enter/leave callbacks.
|
||||||
*
|
*
|
||||||
@@ -1478,7 +1545,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
|
typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for scroll callbacks.
|
/*! @brief The function pointer type for scroll callbacks.
|
||||||
*
|
*
|
||||||
@@ -1499,7 +1566,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);
|
typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
||||||
|
|
||||||
/*! @brief The function pointer type for keyboard key callbacks.
|
/*! @brief The function pointer type for keyboard key callbacks.
|
||||||
*
|
*
|
||||||
@@ -1525,7 +1592,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffse
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);
|
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for Unicode character callbacks.
|
/*! @brief The function pointer type for Unicode character callbacks.
|
||||||
*
|
*
|
||||||
@@ -1546,7 +1613,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int actio
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
|
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for Unicode character with modifiers
|
/*! @brief The function pointer type for Unicode character with modifiers
|
||||||
* callbacks.
|
* callbacks.
|
||||||
@@ -1573,7 +1640,7 @@ typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);
|
typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for path drop callbacks.
|
/*! @brief The function pointer type for path drop callbacks.
|
||||||
*
|
*
|
||||||
@@ -1597,7 +1664,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);
|
typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
|
||||||
|
|
||||||
/*! @brief The function pointer type for monitor configuration callbacks.
|
/*! @brief The function pointer type for monitor configuration callbacks.
|
||||||
*
|
*
|
||||||
@@ -1618,7 +1685,7 @@ typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* pat
|
|||||||
*
|
*
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
|
typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
||||||
|
|
||||||
/*! @brief The function pointer type for joystick configuration callbacks.
|
/*! @brief The function pointer type for joystick configuration callbacks.
|
||||||
*
|
*
|
||||||
@@ -1639,7 +1706,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWjoystickfun)(int jid, int event);
|
typedef void (* GLFWjoystickfun)(int,int);
|
||||||
|
|
||||||
/*! @brief Video mode type.
|
/*! @brief Video mode type.
|
||||||
*
|
*
|
||||||
@@ -1781,6 +1848,14 @@ typedef struct GLFWgamepadstate
|
|||||||
* bundle, if present. This can be disabled with the @ref
|
* bundle, if present. This can be disabled with the @ref
|
||||||
* GLFW_COCOA_CHDIR_RESOURCES init hint.
|
* 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 @x11 This function will set the `LC_CTYPE` category of the
|
* @remark @x11 This function will set the `LC_CTYPE` category of the
|
||||||
* application locale according to the current environment if that category is
|
* application locale according to the current environment if that category is
|
||||||
* still "C". This is because the "C" locale breaks Unicode text input.
|
* still "C". This is because the "C" locale breaks Unicode text input.
|
||||||
@@ -1808,8 +1883,6 @@ GLFWAPI int glfwInit(void);
|
|||||||
* call this function, as it is called by @ref glfwInit before it returns
|
* call this function, as it is called by @ref glfwInit before it returns
|
||||||
* failure.
|
* failure.
|
||||||
*
|
*
|
||||||
* This function has no effect if GLFW is not initialized.
|
|
||||||
*
|
|
||||||
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
|
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark This function may be called before @ref glfwInit.
|
* @remark This function may be called before @ref glfwInit.
|
||||||
@@ -2127,8 +2200,8 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
|
|||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
*
|
*
|
||||||
* @remark @win32 On Windows 8 and earlier the physical size is calculated from
|
* @remark @win32 calculates the returned physical size from the
|
||||||
* the current resolution and system DPI instead of querying the monitor EDID data.
|
* current resolution and system DPI instead of querying the monitor EDID data.
|
||||||
*
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
@@ -2282,9 +2355,8 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
|||||||
*
|
*
|
||||||
* This function returns an array of all video modes supported by the specified
|
* This function returns an array of all video modes supported by the specified
|
||||||
* monitor. The returned array is sorted in ascending order, first by color
|
* monitor. The returned array is sorted in ascending order, first by color
|
||||||
* bit depth (the sum of all channel depths), then by resolution area (the
|
* bit depth (the sum of all channel depths) and then by resolution area (the
|
||||||
* product of width and height), then resolution width and finally by refresh
|
* product of width and height).
|
||||||
* rate.
|
|
||||||
*
|
*
|
||||||
* @param[in] monitor The monitor to query.
|
* @param[in] monitor The monitor to query.
|
||||||
* @param[out] count Where to store the number of video modes in the returned
|
* @param[out] count Where to store the number of video modes in the returned
|
||||||
@@ -2615,12 +2687,11 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
|||||||
* @remark @win32 The context to share resources with must not be current on
|
* @remark @win32 The context to share resources with must not be current on
|
||||||
* any other thread.
|
* any other thread.
|
||||||
*
|
*
|
||||||
* @remark @macos The OS only supports forward-compatible core profile contexts
|
* @remark @macos The OS only supports core profile contexts for OpenGL
|
||||||
* for OpenGL versions 3.2 and later. Before creating an OpenGL context of
|
* versions 3.2 and later. Before creating an OpenGL context of version 3.2 or
|
||||||
* version 3.2 or later you must set the
|
* later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
|
||||||
* [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
|
* hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all
|
||||||
* [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
|
* on macOS.
|
||||||
* 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
|
* @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.
|
* window, but the dock icon will be the same as the application bundle's icon.
|
||||||
@@ -2628,13 +2699,6 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
|||||||
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
|
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
|
||||||
* in the Mac Developer Library.
|
* 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.
|
|
||||||
*
|
|
||||||
* @remark @macos On OS X 10.10 and later the window frame will not be rendered
|
* @remark @macos On OS X 10.10 and later the window frame will not be rendered
|
||||||
* at full resolution on Retina displays unless the
|
* at full resolution on Retina displays unless the
|
||||||
* [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
|
* [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
|
||||||
@@ -2643,7 +2707,7 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
|||||||
* [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
|
* [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
|
* in the Mac Developer Library. The GLFW test and example programs use
|
||||||
* a custom `Info.plist` template for this, which can be found as
|
* a custom `Info.plist` template for this, which can be found as
|
||||||
* `CMake/MacOSXBundleInfo.plist.in` in the source tree.
|
* `CMake/Info.plist.in` in the source tree.
|
||||||
*
|
*
|
||||||
* @remark @macos When activating frame autosaving with
|
* @remark @macos When activating frame autosaving with
|
||||||
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
|
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
|
||||||
@@ -2807,8 +2871,8 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
|
|||||||
* @param[in] images The images to create the icon from. This is ignored if
|
* @param[in] images The images to create the icon from. This is ignored if
|
||||||
* count is zero.
|
* count is zero.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @pointer_lifetime The specified image data is copied before this function
|
* @pointer_lifetime The specified image data is copied before this function
|
||||||
* returns.
|
* returns.
|
||||||
@@ -3218,15 +3282,18 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
|
|||||||
* previously restored. If the window is already iconified, this function does
|
* previously restored. If the window is already iconified, this function does
|
||||||
* nothing.
|
* nothing.
|
||||||
*
|
*
|
||||||
* If the specified window is a full screen window, GLFW restores the original
|
* If the specified window is a full screen window, the original monitor
|
||||||
* video mode of the monitor. The window's desired video mode is set again
|
* resolution is restored until the window is restored.
|
||||||
* when the window is restored.
|
|
||||||
*
|
*
|
||||||
* @param[in] window The window to iconify.
|
* @param[in] window The window to iconify.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* 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.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_iconify
|
* @sa @ref window_iconify
|
||||||
@@ -3246,8 +3313,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
|||||||
* (minimized) or maximized. If the window is already restored, this function
|
* (minimized) or maximized. If the window is already restored, this function
|
||||||
* does nothing.
|
* does nothing.
|
||||||
*
|
*
|
||||||
* If the specified window is an iconified full screen window, its desired
|
* If the specified window is a full screen window, the resolution chosen for
|
||||||
* video mode is set again for its monitor when the window is restored.
|
* the window is restored on the selected monitor.
|
||||||
*
|
*
|
||||||
* @param[in] window The window to restore.
|
* @param[in] window The window to restore.
|
||||||
*
|
*
|
||||||
@@ -3308,11 +3375,6 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @wayland Because Wayland wants every frame of the desktop to be
|
|
||||||
* complete, this function does not immediately make the window visible.
|
|
||||||
* Instead it will become visible the next time the window framebuffer is
|
|
||||||
* updated after this call.
|
|
||||||
*
|
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_hide
|
* @sa @ref window_hide
|
||||||
@@ -3515,9 +3577,6 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int
|
|||||||
* errors. However, this function should not fail as long as it is passed
|
* errors. However, this function should not fail as long as it is passed
|
||||||
* valid arguments and the library has been [initialized](@ref intro_init).
|
* valid arguments and the library has been [initialized](@ref intro_init).
|
||||||
*
|
*
|
||||||
* @remark @wayland The Wayland protocol provides no way to check whether a
|
|
||||||
* window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`.
|
|
||||||
*
|
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_attribs
|
* @sa @ref window_attribs
|
||||||
@@ -3809,9 +3868,6 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
|
|||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
* @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.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_iconify
|
* @sa @ref window_iconify
|
||||||
@@ -4226,6 +4282,11 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
|
|||||||
* non-printable keys are the same across layouts but depend on the application
|
* non-printable keys are the same across layouts but depend on the application
|
||||||
* language and should be localized along with other user interface text.
|
* language and should be localized along with other user interface text.
|
||||||
*
|
*
|
||||||
|
* The contents of the returned string may change when a keyboard
|
||||||
|
* layout change event is received. Set a
|
||||||
|
* [keyboard layout](@ref keyboard_layout) callback to be notified when the
|
||||||
|
* layout changes.
|
||||||
|
*
|
||||||
* @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
|
* @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
|
||||||
* @param[in] scancode The scancode of the key to query.
|
* @param[in] scancode The scancode of the key to query.
|
||||||
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
|
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
|
||||||
@@ -4233,9 +4294,6 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark The contents of the returned string may change when a keyboard
|
|
||||||
* layout change event is received.
|
|
||||||
*
|
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is valid until the library is terminated.
|
* should not free it yourself. It is valid until the library is terminated.
|
||||||
*
|
*
|
||||||
@@ -4273,12 +4331,80 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetKeyScancode(int key);
|
GLFWAPI int glfwGetKeyScancode(int key);
|
||||||
|
|
||||||
|
/*! @brief Returns the human-readable name of the current keyboard layout.
|
||||||
|
*
|
||||||
|
* This function returns the human-readable name, encoded as UTF-8, of the
|
||||||
|
* current keyboard layout. On some platforms this may not be updated until
|
||||||
|
* one of the application's windows gets input focus.
|
||||||
|
*
|
||||||
|
* The keyboard layout name is intended to be shown to the user during text
|
||||||
|
* input, especially in full screen applications.
|
||||||
|
*
|
||||||
|
* The name may be localized into the current operating system UI language. It
|
||||||
|
* is provided by the operating system and may not be identical for a given
|
||||||
|
* layout across platforms.
|
||||||
|
*
|
||||||
|
* @return The UTF-8 encoded name of the current keyboard layout, or `NULL` if
|
||||||
|
* an [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR and @ref
|
||||||
|
* GLFW_NOT_INITIALIZED.
|
||||||
|
*
|
||||||
|
* @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 this
|
||||||
|
* function or the library is terminated.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref keyboard_layout
|
||||||
|
* @sa @ref glfwSetKeyboardLayoutCallback
|
||||||
|
*
|
||||||
|
* @since Added in version 3.4.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetKeyboardLayoutName(void);
|
||||||
|
|
||||||
|
/*! @brief Sets the keyboard layout callback.
|
||||||
|
*
|
||||||
|
* This function sets the keyboard layout callback, which is called when the
|
||||||
|
* keyboard layout is changed. The name of the current layout is returned by
|
||||||
|
* @ref glfwGetKeyboardLayoutName.
|
||||||
|
*
|
||||||
|
* On some platforms the keyboard layout event may not arrive until one of the
|
||||||
|
* application's windows get input focus. Layout changes may not be reported
|
||||||
|
* while other applications have input focus.
|
||||||
|
*
|
||||||
|
* @param[in] callback The new callback, or `NULL` to remove the currently set
|
||||||
|
* callback.
|
||||||
|
* @return The previously set callback, or `NULL` if no callback was set or the
|
||||||
|
* library had not been [initialized](@ref intro_init).
|
||||||
|
*
|
||||||
|
* @callback_signature
|
||||||
|
* @code
|
||||||
|
* void function_name(void)
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref keyboard_layout
|
||||||
|
* @sa @ref glfwGetKeyboardLayoutName
|
||||||
|
*
|
||||||
|
* @since Added in version 3.4.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI GLFWkeyboardlayoutfun glfwSetKeyboardLayoutCallback(GLFWkeyboardlayoutfun callback);
|
||||||
|
|
||||||
/*! @brief Returns the last reported state of a keyboard key for the specified
|
/*! @brief Returns the last reported state of a keyboard key for the specified
|
||||||
* window.
|
* window.
|
||||||
*
|
*
|
||||||
* This function returns the last state reported for the specified key to the
|
* This function returns the last state reported for the specified key to the
|
||||||
* specified window. The returned state is one of `GLFW_PRESS` or
|
* specified window. The returned state is one of `GLFW_PRESS` or
|
||||||
* `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.
|
* `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
|
||||||
|
* the key callback.
|
||||||
*
|
*
|
||||||
* If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
|
* If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
|
||||||
* `GLFW_PRESS` the first time you call it for a key that was pressed, even if
|
* `GLFW_PRESS` the first time you call it for a key that was pressed, even if
|
||||||
@@ -4439,8 +4565,8 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
|
|||||||
* @return The handle of the created cursor, or `NULL` if an
|
* @return The handle of the created cursor, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @pointer_lifetime The specified image data is copied before this function
|
* @pointer_lifetime The specified image data is copied before this function
|
||||||
* returns.
|
* returns.
|
||||||
@@ -4459,19 +4585,44 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
|
|||||||
|
|
||||||
/*! @brief Creates a cursor with a standard shape.
|
/*! @brief Creates a cursor with a standard shape.
|
||||||
*
|
*
|
||||||
* Returns a cursor with a [standard shape](@ref shapes), that can be set for
|
* Returns a cursor with a standard shape, that can be set for a window with
|
||||||
* a window with @ref glfwSetCursor.
|
* @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).
|
* @param[in] shape One of the [standard shapes](@ref shapes).
|
||||||
* @return A new cursor ready to use or `NULL` if an
|
* @return A new cursor ready to use or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @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.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref cursor_object
|
* @sa @ref cursor_standard
|
||||||
* @sa @ref glfwCreateCursor
|
* @sa @ref glfwCreateCursor
|
||||||
*
|
*
|
||||||
* @since Added in version 3.1.
|
* @since Added in version 3.1.
|
||||||
@@ -5230,8 +5381,6 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string);
|
|||||||
* joystick is not present, does not have a mapping or an
|
* joystick is not present, does not have a mapping or an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.
|
|
||||||
*
|
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is valid until the specified joystick is
|
* should not free it yourself. It is valid until the specified joystick is
|
||||||
* disconnected, the gamepad mappings are updated or the library is terminated.
|
* disconnected, the gamepad mappings are updated or the library is terminated.
|
||||||
@@ -5321,8 +5470,8 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
|||||||
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
||||||
* if an [error](@ref error_handling) occurred.
|
* if an [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is valid until the next call to @ref
|
* should not free it yourself. It is valid until the next call to @ref
|
||||||
@@ -5666,11 +5815,13 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
|
|||||||
* This function returns whether the Vulkan loader and any minimally functional
|
* This function returns whether the Vulkan loader and any minimally functional
|
||||||
* ICD have been found.
|
* ICD have been found.
|
||||||
*
|
*
|
||||||
* The availability of a Vulkan loader and even an ICD does not by itself guarantee that
|
* The availability of a Vulkan loader and even an ICD does not by itself
|
||||||
* surface creation or even instance creation is possible. Call @ref
|
* guarantee that surface creation or even instance creation is possible.
|
||||||
* glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan
|
* For example, on Fermi systems Nvidia will install an ICD that provides no
|
||||||
* surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to
|
* actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
|
||||||
* check whether a queue family of a physical device supports image presentation.
|
* whether the extensions necessary for Vulkan surface creation are available
|
||||||
|
* and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
|
||||||
|
* family of a physical device supports image presentation.
|
||||||
*
|
*
|
||||||
* @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
|
* @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
|
||||||
* otherwise.
|
* otherwise.
|
||||||
@@ -5716,6 +5867,10 @@ GLFWAPI int glfwVulkanSupported(void);
|
|||||||
* returned array, as it is an error to specify an extension more than once in
|
* returned array, as it is an error to specify an extension more than once in
|
||||||
* the `VkInstanceCreateInfo` struct.
|
* the `VkInstanceCreateInfo` struct.
|
||||||
*
|
*
|
||||||
|
* @remark @macos This function currently supports either the
|
||||||
|
* `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface`
|
||||||
|
* extension.
|
||||||
|
*
|
||||||
* @pointer_lifetime The returned array is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned array is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is guaranteed to be valid only until the
|
* should not free it yourself. It is guaranteed to be valid only until the
|
||||||
* library is terminated.
|
* library is terminated.
|
||||||
@@ -5797,7 +5952,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
|
|||||||
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @macos This function currently always returns `GLFW_TRUE`, as the
|
* @remark @macos This function currently always returns `GLFW_TRUE`, as the
|
||||||
* `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
|
* `VK_MVK_macos_surface` extension does not provide
|
||||||
* a `vkGetPhysicalDevice*PresentationSupport` type function.
|
* a `vkGetPhysicalDevice*PresentationSupport` type function.
|
||||||
*
|
*
|
||||||
* @thread_safety This function may be called from any thread. For
|
* @thread_safety This function may be called from any thread. For
|
||||||
@@ -5854,10 +6009,8 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys
|
|||||||
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
|
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
|
||||||
* eliminate almost all occurrences of these errors.
|
* eliminate almost all occurrences of these errors.
|
||||||
*
|
*
|
||||||
* @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the
|
* @remark @macos This function currently only supports the
|
||||||
* `VK_MVK_macos_surface` extension as a fallback. The name of the selected
|
* `VK_MVK_macos_surface` extension from MoltenVK.
|
||||||
* extension, if any, is included in the array returned by @ref
|
|
||||||
* glfwGetRequiredInstanceExtensions.
|
|
||||||
*
|
*
|
||||||
* @remark @macos This function creates and sets a `CAMetalLayer` instance for
|
* @remark @macos This function creates and sets a `CAMetalLayer` instance for
|
||||||
* the window content view, which is required for MoltenVK to function.
|
* the window content view, which is required for MoltenVK to function.
|
||||||
@@ -5898,7 +6051,6 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
|
|||||||
*/
|
*/
|
||||||
#ifndef GLAPIENTRY
|
#ifndef GLAPIENTRY
|
||||||
#define GLAPIENTRY APIENTRY
|
#define GLAPIENTRY APIENTRY
|
||||||
#define GLFW_GLAPIENTRY_DEFINED
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
|
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
|
||||||
|
|||||||
+38
-141
@@ -1,5 +1,5 @@
|
|||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW 3.3 - www.glfw.org
|
* GLFW 3.4 - www.glfw.org
|
||||||
* A library for OpenGL, window and input
|
* A library for OpenGL, window and input
|
||||||
*------------------------------------------------------------------------
|
*------------------------------------------------------------------------
|
||||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
@@ -74,16 +74,6 @@ extern "C" {
|
|||||||
* and which platform-specific headers to include. It is then up your (by
|
* and which platform-specific headers to include. It is then up your (by
|
||||||
* definition platform-specific) code to handle which of these should be
|
* definition platform-specific) code to handle which of these should be
|
||||||
* defined.
|
* defined.
|
||||||
*
|
|
||||||
* If you do not want the platform-specific headers to be included, define
|
|
||||||
* `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #define GLFW_EXPOSE_NATIVE_WIN32
|
|
||||||
* #define GLFW_EXPOSE_NATIVE_WGL
|
|
||||||
* #define GLFW_NATIVE_INCLUDE_NONE
|
|
||||||
* #include <GLFW/glfw3native.h>
|
|
||||||
* @endcode
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -91,65 +81,44 @@ extern "C" {
|
|||||||
* System headers and types
|
* System headers and types
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#if !defined(GLFW_NATIVE_INCLUDE_NONE)
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
|
// example to allow applications to correctly declare a GL_ARB_debug_output
|
||||||
|
// callback) but windows.h assumes no one will define APIENTRY before it does
|
||||||
|
#if defined(GLFW_APIENTRY_DEFINED)
|
||||||
|
#undef APIENTRY
|
||||||
|
#undef GLFW_APIENTRY_DEFINED
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
|
#if defined(__OBJC__)
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#else
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
typedef void* id;
|
||||||
|
#endif
|
||||||
|
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||||
|
#include <wayland-client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
/* WGL is declared by windows.h */
|
||||||
* example to allow applications to correctly declare a GL_KHR_debug callback)
|
#endif
|
||||||
* but windows.h assumes no one will define APIENTRY before it does
|
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
*/
|
/* NSGL is declared by Cocoa.h */
|
||||||
#if defined(GLFW_APIENTRY_DEFINED)
|
#endif
|
||||||
#undef APIENTRY
|
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
#undef GLFW_APIENTRY_DEFINED
|
#include <GL/glx.h>
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
#include <EGL/egl.h>
|
||||||
#if defined(__OBJC__)
|
#endif
|
||||||
#import <Cocoa/Cocoa.h>
|
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||||
#else
|
#include <GL/osmesa.h>
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#endif
|
||||||
#include <objc/objc.h>
|
|
||||||
#endif
|
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/extensions/Xrandr.h>
|
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
|
||||||
#include <wayland-client.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
|
||||||
/* WGL is declared by windows.h */
|
|
||||||
#endif
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
|
||||||
/* NSGL is declared by Cocoa.h */
|
|
||||||
#endif
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
|
||||||
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
|
||||||
* default it also acts as an OpenGL header
|
|
||||||
* However, glx.h will include gl.h, which will define it unconditionally
|
|
||||||
*/
|
|
||||||
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
|
||||||
#undef GLAPIENTRY
|
|
||||||
#undef GLFW_GLAPIENTRY_DEFINED
|
|
||||||
#endif
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#endif
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#endif
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
|
||||||
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
|
||||||
* default it also acts as an OpenGL header
|
|
||||||
* However, osmesa.h will include gl.h, which will define it unconditionally
|
|
||||||
*/
|
|
||||||
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
|
||||||
#undef GLAPIENTRY
|
|
||||||
#undef GLFW_GLAPIENTRY_DEFINED
|
|
||||||
#endif
|
|
||||||
#include <GL/osmesa.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -163,8 +132,6 @@ extern "C" {
|
|||||||
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
|
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
|
||||||
* occurred.
|
* occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -180,8 +147,6 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
|||||||
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
|
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -196,16 +161,6 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
|||||||
* @return The `HWND` of the specified window, or `NULL` if an
|
* @return The `HWND` of the specified window, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @remark The `HDC` associated with the window can be queried with the
|
|
||||||
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
|
||||||
* function.
|
|
||||||
* @code
|
|
||||||
* HDC dc = GetDC(glfwGetWin32Window(window));
|
|
||||||
* @endcode
|
|
||||||
* This DC is private and does not need to be released.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -222,17 +177,6 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
|||||||
* @return The `HGLRC` of the specified window, or `NULL` if an
|
* @return The `HGLRC` of the specified window, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @remark The `HDC` associated with the window can be queried with the
|
|
||||||
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
|
||||||
* function.
|
|
||||||
* @code
|
|
||||||
* HDC dc = GetDC(glfwGetWin32Window(window));
|
|
||||||
* @endcode
|
|
||||||
* This DC is private and does not need to be released.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -249,8 +193,6 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
|||||||
* @return The `CGDirectDisplayID` of the specified monitor, or
|
* @return The `CGDirectDisplayID` of the specified monitor, or
|
||||||
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
|
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -265,8 +207,6 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
|||||||
* @return The `NSWindow` of the specified window, or `nil` if an
|
* @return The `NSWindow` of the specified window, or `nil` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -283,9 +223,6 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
|||||||
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
|
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -302,8 +239,6 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
|||||||
* @return The `Display` used by GLFW, or `NULL` if an
|
* @return The `Display` used by GLFW, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -318,8 +253,6 @@ GLFWAPI Display* glfwGetX11Display(void);
|
|||||||
* @return The `RRCrtc` of the specified monitor, or `None` if an
|
* @return The `RRCrtc` of the specified monitor, or `None` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -334,8 +267,6 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
|||||||
* @return The `RROutput` of the specified monitor, or `None` if an
|
* @return The `RROutput` of the specified monitor, or `None` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -350,8 +281,6 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
|||||||
* @return The `Window` of the specified window, or `None` if an
|
* @return The `Window` of the specified window, or `None` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -418,9 +347,6 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
|
|||||||
* @return The `GLXContext` of the specified window, or `NULL` if an
|
* @return The `GLXContext` of the specified window, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -435,9 +361,6 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
|||||||
* @return The `GLXWindow` of the specified window, or `None` if an
|
* @return The `GLXWindow` of the specified window, or `None` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -454,8 +377,6 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
|||||||
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
|
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -470,8 +391,6 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
|
|||||||
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
|
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -486,8 +405,6 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
|||||||
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
|
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
|
||||||
* an [error](@ref error_handling) occurred.
|
* an [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -504,11 +421,6 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
|||||||
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
|
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @remark Because EGL is initialized on demand, this function will return
|
|
||||||
* `EGL_NO_DISPLAY` until the first context has been created via EGL.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -523,9 +435,6 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
|||||||
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
|
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -540,9 +449,6 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
|||||||
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
|
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -566,9 +472,6 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
|||||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -590,9 +493,6 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
|
|||||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
@@ -607,9 +507,6 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
|
|||||||
* @return The `OSMesaContext` of the specified window, or `NULL` if an
|
* @return The `OSMesaContext` of the specified window, or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
|
||||||
* GLFW_NOT_INITIALIZED.
|
|
||||||
*
|
|
||||||
* @thread_safety This function may be called from any thread. Access is not
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
* synchronized.
|
* synchronized.
|
||||||
*
|
*
|
||||||
|
|||||||
+92
-108
@@ -1,114 +1,96 @@
|
|||||||
|
|
||||||
set(common_HEADERS internal.h mappings.h
|
add_library(glfw "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
||||||
"${GLFW_BINARY_DIR}/src/glfw_config.h"
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h"
|
||||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
internal.h mappings.h context.c init.c input.c monitor.c
|
||||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
|
vulkan.c window.c)
|
||||||
set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c)
|
|
||||||
|
|
||||||
add_custom_target(update_mappings
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -P "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake" mappings.h.in mappings.h
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
COMMENT "Updating gamepad mappings from upstream repository"
|
|
||||||
SOURCES mappings.h.in "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake"
|
|
||||||
VERBATIM)
|
|
||||||
|
|
||||||
set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
|
|
||||||
|
|
||||||
if (_GLFW_COCOA)
|
if (_GLFW_COCOA)
|
||||||
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h
|
target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h posix_thread.h
|
||||||
posix_thread.h nsgl_context.h egl_context.h osmesa_context.h)
|
nsgl_context.h egl_context.h osmesa_context.h
|
||||||
set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_joystick.m
|
cocoa_init.m cocoa_joystick.m cocoa_monitor.m
|
||||||
cocoa_monitor.m cocoa_window.m cocoa_time.c posix_thread.c
|
cocoa_window.m cocoa_time.c posix_thread.c
|
||||||
nsgl_context.m egl_context.c osmesa_context.c)
|
nsgl_context.m egl_context.c osmesa_context.c)
|
||||||
elseif (_GLFW_WIN32)
|
elseif (_GLFW_WIN32)
|
||||||
set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_joystick.h
|
target_sources(glfw PRIVATE win32_platform.h win32_joystick.h wgl_context.h
|
||||||
wgl_context.h egl_context.h osmesa_context.h)
|
egl_context.h osmesa_context.h win32_init.c
|
||||||
set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_joystick.c
|
win32_joystick.c win32_monitor.c win32_time.c
|
||||||
win32_monitor.c win32_time.c win32_thread.c win32_window.c
|
win32_thread.c win32_window.c wgl_context.c
|
||||||
wgl_context.c egl_context.c osmesa_context.c)
|
egl_context.c osmesa_context.c)
|
||||||
elseif (_GLFW_X11)
|
elseif (_GLFW_X11)
|
||||||
set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h posix_time.h
|
target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h posix_time.h
|
||||||
posix_thread.h glx_context.h egl_context.h osmesa_context.h)
|
posix_thread.h glx_context.h egl_context.h
|
||||||
set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c
|
osmesa_context.h x11_init.c x11_monitor.c
|
||||||
xkb_unicode.c posix_time.c posix_thread.c glx_context.c
|
x11_window.c xkb_unicode.c posix_time.c
|
||||||
egl_context.c osmesa_context.c)
|
posix_thread.c glx_context.c egl_context.c
|
||||||
|
osmesa_context.c)
|
||||||
elseif (_GLFW_WAYLAND)
|
elseif (_GLFW_WAYLAND)
|
||||||
set(glfw_HEADERS ${common_HEADERS} wl_platform.h
|
target_sources(glfw PRIVATE wl_platform.h posix_time.h posix_thread.h
|
||||||
posix_time.h posix_thread.h xkb_unicode.h egl_context.h
|
xkb_unicode.h egl_context.h osmesa_context.h
|
||||||
osmesa_context.h)
|
wl_init.c wl_monitor.c wl_window.c posix_time.c
|
||||||
set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c
|
posix_thread.c xkb_unicode.c egl_context.c
|
||||||
posix_time.c posix_thread.c xkb_unicode.c
|
osmesa_context.c)
|
||||||
egl_context.c osmesa_context.c)
|
|
||||||
|
|
||||||
ecm_add_wayland_client_protocol(glfw_SOURCES
|
|
||||||
PROTOCOL
|
|
||||||
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml"
|
|
||||||
BASENAME xdg-shell)
|
|
||||||
ecm_add_wayland_client_protocol(glfw_SOURCES
|
|
||||||
PROTOCOL
|
|
||||||
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
|
||||||
BASENAME xdg-decoration)
|
|
||||||
ecm_add_wayland_client_protocol(glfw_SOURCES
|
|
||||||
PROTOCOL
|
|
||||||
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml"
|
|
||||||
BASENAME viewporter)
|
|
||||||
ecm_add_wayland_client_protocol(glfw_SOURCES
|
|
||||||
PROTOCOL
|
|
||||||
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
|
|
||||||
BASENAME relative-pointer-unstable-v1)
|
|
||||||
ecm_add_wayland_client_protocol(glfw_SOURCES
|
|
||||||
PROTOCOL
|
|
||||||
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
|
|
||||||
BASENAME pointer-constraints-unstable-v1)
|
|
||||||
ecm_add_wayland_client_protocol(glfw_SOURCES
|
|
||||||
PROTOCOL
|
|
||||||
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
|
|
||||||
BASENAME idle-inhibit-unstable-v1)
|
|
||||||
elseif (_GLFW_OSMESA)
|
elseif (_GLFW_OSMESA)
|
||||||
set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h
|
target_sources(glfw PRIVATE null_platform.h null_joystick.h posix_time.h
|
||||||
posix_time.h posix_thread.h osmesa_context.h)
|
posix_thread.h osmesa_context.h null_init.c
|
||||||
set(glfw_SOURCES ${common_SOURCES} null_init.c null_monitor.c null_window.c
|
null_monitor.c null_window.c null_joystick.c
|
||||||
null_joystick.c posix_time.c posix_thread.c osmesa_context.c)
|
posix_time.c posix_thread.c osmesa_context.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (_GLFW_X11 OR _GLFW_WAYLAND)
|
if (_GLFW_X11 OR _GLFW_WAYLAND)
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||||
set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h)
|
target_sources(glfw PRIVATE linux_joystick.h linux_joystick.c)
|
||||||
set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c)
|
|
||||||
else()
|
else()
|
||||||
set(glfw_HEADERS ${glfw_HEADERS} null_joystick.h)
|
target_sources(glfw PRIVATE null_joystick.h null_joystick.c)
|
||||||
set(glfw_SOURCES ${glfw_SOURCES} null_joystick.c)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Workaround for CMake not knowing about .m files before version 3.16
|
if (_GLFW_WAYLAND)
|
||||||
if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
|
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES
|
||||||
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
|
PROTOCOL
|
||||||
cocoa_window.m nsgl_context.m PROPERTIES
|
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml"
|
||||||
LANGUAGE C)
|
BASENAME xdg-shell)
|
||||||
|
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES
|
||||||
|
PROTOCOL
|
||||||
|
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
||||||
|
BASENAME xdg-decoration)
|
||||||
|
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES
|
||||||
|
PROTOCOL
|
||||||
|
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml"
|
||||||
|
BASENAME viewporter)
|
||||||
|
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES
|
||||||
|
PROTOCOL
|
||||||
|
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
|
||||||
|
BASENAME relative-pointer-unstable-v1)
|
||||||
|
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES
|
||||||
|
PROTOCOL
|
||||||
|
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
|
||||||
|
BASENAME pointer-constraints-unstable-v1)
|
||||||
|
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES
|
||||||
|
PROTOCOL
|
||||||
|
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
|
||||||
|
BASENAME idle-inhibit-unstable-v1)
|
||||||
|
target_sources(glfw PRIVATE ${GLFW_WAYLAND_PROTOCOL_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
|
if (WIN32 AND BUILD_SHARED_LIBS)
|
||||||
|
configure_file(glfw.rc.in glfw.rc @ONLY)
|
||||||
|
target_sources(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/glfw.rc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_file(glfw_config.h.in glfw_config.h @ONLY)
|
||||||
|
target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
|
||||||
|
target_sources(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/glfw_config.h")
|
||||||
|
|
||||||
set_target_properties(glfw PROPERTIES
|
set_target_properties(glfw PROPERTIES
|
||||||
OUTPUT_NAME ${GLFW_LIB_NAME}
|
OUTPUT_NAME ${GLFW_LIB_NAME}
|
||||||
VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
|
VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
|
||||||
SOVERSION ${GLFW_VERSION_MAJOR}
|
SOVERSION ${GLFW_VERSION_MAJOR}
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
C_STANDARD 99
|
||||||
|
C_EXTENSIONS OFF
|
||||||
|
DEFINE_SYMBOL _GLFW_BUILD_DLL
|
||||||
FOLDER "GLFW3")
|
FOLDER "GLFW3")
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_EQUAL "3.1.0" OR
|
|
||||||
CMAKE_VERSION VERSION_GREATER "3.1.0")
|
|
||||||
|
|
||||||
set_target_properties(glfw 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>")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
|
|
||||||
target_include_directories(glfw PUBLIC
|
target_include_directories(glfw PUBLIC
|
||||||
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||||
@@ -116,32 +98,34 @@ target_include_directories(glfw PRIVATE
|
|||||||
"${GLFW_SOURCE_DIR}/src"
|
"${GLFW_SOURCE_DIR}/src"
|
||||||
"${GLFW_BINARY_DIR}/src"
|
"${GLFW_BINARY_DIR}/src"
|
||||||
${glfw_INCLUDE_DIRS})
|
${glfw_INCLUDE_DIRS})
|
||||||
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
|
target_link_libraries(glfw PRIVATE Threads::Threads ${glfw_LIBRARIES})
|
||||||
|
|
||||||
# Make GCC warn about declarations that VS 2010 and 2012 won't accept for all
|
if (APPLE)
|
||||||
# source files that VS will build (Clang ignores this because we set -std=c99)
|
# For some reason CMake didn't know about .m until version 3.16
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
|
||||||
|
cocoa_window.m nsgl_context.m PROPERTIES
|
||||||
|
LANGUAGE C)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
|
||||||
|
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
|
||||||
|
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
|
||||||
|
|
||||||
|
# Make GCC and Clang warn about declarations that VS 2010 and 2012 won't
|
||||||
|
# accept for all source files that VS will build
|
||||||
set_source_files_properties(context.c init.c input.c monitor.c vulkan.c
|
set_source_files_properties(context.c init.c input.c monitor.c vulkan.c
|
||||||
window.c win32_init.c win32_joystick.c
|
window.c win32_init.c win32_joystick.c
|
||||||
win32_monitor.c win32_time.c win32_thread.c
|
win32_monitor.c win32_time.c win32_thread.c
|
||||||
win32_window.c wgl_context.c egl_context.c
|
win32_window.c wgl_context.c egl_context.c
|
||||||
osmesa_context.c PROPERTIES
|
osmesa_context.c PROPERTIES
|
||||||
COMPILE_FLAGS -Wdeclaration-after-statement)
|
COMPILE_FLAGS -Wdeclaration-after-statement)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Enable a reasonable set of warnings
|
|
||||||
# NOTE: The order matters here, Clang-CL matches both MSVC and Clang
|
|
||||||
if (MSVC)
|
|
||||||
target_compile_options(glfw PRIVATE "/W3")
|
|
||||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
|
||||||
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
|
||||||
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
|
||||||
|
|
||||||
|
# Enable a reasonable set of warnings (no, -Wextra is not reasonable)
|
||||||
target_compile_options(glfw PRIVATE "-Wall")
|
target_compile_options(glfw PRIVATE "-Wall")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (_GLFW_WIN32)
|
if (WIN32)
|
||||||
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
|
target_compile_definitions(glfw PRIVATE _UNICODE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
||||||
@@ -149,7 +133,7 @@ endif()
|
|||||||
# win32_platform.h. We define them here until a saner solution can be found
|
# win32_platform.h. We define them here until a saner solution can be found
|
||||||
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
target_compile_definitions(glfw PRIVATE WINVER=0x0501)
|
target_compile_definitions(glfw PRIVATE UNICODE WINVER=0x0501)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
@@ -171,8 +155,8 @@ if (BUILD_SHARED_LIBS)
|
|||||||
|
|
||||||
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
# Add -fno-common to work around a bug in Apple's GCC
|
set_target_properties(glfw PROPERTIES
|
||||||
target_compile_options(glfw PRIVATE "-fno-common")
|
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
@@ -181,14 +165,14 @@ if (BUILD_SHARED_LIBS)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
if (MSVC)
|
||||||
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GLFW_INSTALL)
|
if (GLFW_INSTALL)
|
||||||
install(TARGETS glfw
|
install(TARGETS glfw
|
||||||
EXPORT glfwTargets
|
EXPORT glfwTargets
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
RUNTIME DESTINATION "bin"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+66
-60
@@ -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>
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -305,38 +305,6 @@ static void createKeyTables(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve Unicode data for the current keyboard layout
|
|
||||||
//
|
|
||||||
static GLFWbool updateUnicodeDataNS(void)
|
|
||||||
{
|
|
||||||
if (_glfw.ns.inputSource)
|
|
||||||
{
|
|
||||||
CFRelease(_glfw.ns.inputSource);
|
|
||||||
_glfw.ns.inputSource = NULL;
|
|
||||||
_glfw.ns.unicodeData = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfw.ns.inputSource = TISCopyCurrentKeyboardLayoutInputSource();
|
|
||||||
if (!_glfw.ns.inputSource)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Cocoa: Failed to retrieve keyboard layout input source");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfw.ns.unicodeData =
|
|
||||||
TISGetInputSourceProperty(_glfw.ns.inputSource,
|
|
||||||
kTISPropertyUnicodeKeyLayoutData);
|
|
||||||
if (!_glfw.ns.unicodeData)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Cocoa: Failed to retrieve keyboard layout Unicode data");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load HIToolbox.framework and the TIS symbols we need from it
|
// Load HIToolbox.framework and the TIS symbols we need from it
|
||||||
//
|
//
|
||||||
static GLFWbool initializeTIS(void)
|
static GLFWbool initializeTIS(void)
|
||||||
@@ -354,6 +322,15 @@ static GLFWbool initializeTIS(void)
|
|||||||
CFStringRef* kPropertyUnicodeKeyLayoutData =
|
CFStringRef* kPropertyUnicodeKeyLayoutData =
|
||||||
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
|
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
|
||||||
CFSTR("kTISPropertyUnicodeKeyLayoutData"));
|
CFSTR("kTISPropertyUnicodeKeyLayoutData"));
|
||||||
|
CFStringRef* kPropertyInputSourceID =
|
||||||
|
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("kTISPropertyInputSourceID"));
|
||||||
|
CFStringRef* kPropertyLocalizedName =
|
||||||
|
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("kTISPropertyLocalizedName"));
|
||||||
|
_glfw.ns.tis.CopyCurrentKeyboardInputSource =
|
||||||
|
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("TISCopyCurrentKeyboardInputSource"));
|
||||||
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
|
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
|
||||||
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
|
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
|
||||||
CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
|
CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
|
||||||
@@ -365,6 +342,9 @@ static GLFWbool initializeTIS(void)
|
|||||||
CFSTR("LMGetKbdType"));
|
CFSTR("LMGetKbdType"));
|
||||||
|
|
||||||
if (!kPropertyUnicodeKeyLayoutData ||
|
if (!kPropertyUnicodeKeyLayoutData ||
|
||||||
|
!kPropertyInputSourceID ||
|
||||||
|
!kPropertyLocalizedName ||
|
||||||
|
!TISCopyCurrentKeyboardInputSource ||
|
||||||
!TISCopyCurrentKeyboardLayoutInputSource ||
|
!TISCopyCurrentKeyboardLayoutInputSource ||
|
||||||
!TISGetInputSourceProperty ||
|
!TISGetInputSourceProperty ||
|
||||||
!LMGetKbdType)
|
!LMGetKbdType)
|
||||||
@@ -376,8 +356,18 @@ static GLFWbool initializeTIS(void)
|
|||||||
|
|
||||||
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
|
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
|
||||||
*kPropertyUnicodeKeyLayoutData;
|
*kPropertyUnicodeKeyLayoutData;
|
||||||
|
_glfw.ns.tis.kPropertyInputSourceID =
|
||||||
|
*kPropertyInputSourceID;
|
||||||
|
_glfw.ns.tis.kPropertyLocalizedName =
|
||||||
|
*kPropertyLocalizedName;
|
||||||
|
|
||||||
return updateUnicodeDataNS();
|
_glfw.ns.inputSource = TISCopyCurrentKeyboardInputSource();
|
||||||
|
_glfw.ns.keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
|
_glfw.ns.unicodeData =
|
||||||
|
TISGetInputSourceProperty(_glfw.ns.keyboardLayout,
|
||||||
|
kTISPropertyUnicodeKeyLayoutData);
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface GLFWHelper : NSObject
|
@interface GLFWHelper : NSObject
|
||||||
@@ -387,7 +377,28 @@ static GLFWbool initializeTIS(void)
|
|||||||
|
|
||||||
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object
|
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object
|
||||||
{
|
{
|
||||||
updateUnicodeDataNS();
|
// The keyboard layout is needed for Unicode data which is the source of
|
||||||
|
// GLFW key names on Cocoa (the generic input source may not have this)
|
||||||
|
CFRelease(_glfw.ns.keyboardLayout);
|
||||||
|
_glfw.ns.keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
|
_glfw.ns.unicodeData =
|
||||||
|
TISGetInputSourceProperty(_glfw.ns.keyboardLayout,
|
||||||
|
kTISPropertyUnicodeKeyLayoutData);
|
||||||
|
|
||||||
|
// The generic input source may be something higher level than a keyboard
|
||||||
|
// layout and if so will provide a better layout name than the layout source
|
||||||
|
const TISInputSourceRef source = TISCopyCurrentKeyboardInputSource();
|
||||||
|
const CFStringRef newID =
|
||||||
|
TISGetInputSourceProperty(source, kTISPropertyInputSourceID);
|
||||||
|
const CFStringRef oldID =
|
||||||
|
TISGetInputSourceProperty(_glfw.ns.inputSource, kTISPropertyInputSourceID);
|
||||||
|
const CFComparisonResult result = CFStringCompare(oldID, newID, 0);
|
||||||
|
CFRelease(_glfw.ns.inputSource);
|
||||||
|
_glfw.ns.inputSource = source;
|
||||||
|
|
||||||
|
// Filter events as we may receive more than one per input source switch
|
||||||
|
if (result != kCFCompareEqualTo)
|
||||||
|
_glfwInputKeyboardLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)doNothing:(id)object
|
- (void)doNothing:(id)object
|
||||||
@@ -428,6 +439,9 @@ static GLFWbool initializeTIS(void)
|
|||||||
{
|
{
|
||||||
if (_glfw.hints.init.ns.menubar)
|
if (_glfw.hints.init.ns.menubar)
|
||||||
{
|
{
|
||||||
|
// In case we are unbundled, make us a proper UI application
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
|
||||||
// Menu bar setup must go between sharedApplication and finishLaunching
|
// Menu bar setup must go between sharedApplication and finishLaunching
|
||||||
// in order to properly emulate the behavior of NSApplicationMain
|
// in order to properly emulate the behavior of NSApplicationMain
|
||||||
|
|
||||||
@@ -444,13 +458,7 @@ static GLFWbool initializeTIS(void)
|
|||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
_glfw.ns.finishedLaunching = GLFW_TRUE;
|
|
||||||
_glfwPlatformPostEmptyEvent();
|
_glfwPlatformPostEmptyEvent();
|
||||||
|
|
||||||
// In case we are unbundled, make us a proper UI application
|
|
||||||
if (_glfw.hints.init.ns.menubar)
|
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
||||||
|
|
||||||
[NSApp stop:nil];
|
[NSApp stop:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,26 +483,18 @@ void* _glfwLoadLocalVulkanLoaderNS(void)
|
|||||||
if (!bundle)
|
if (!bundle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
|
CFURLRef url =
|
||||||
if (!frameworksUrl)
|
CFBundleCopyAuxiliaryExecutableURL(bundle, CFSTR("libvulkan.1.dylib"));
|
||||||
|
if (!url)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
|
|
||||||
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
|
|
||||||
if (!loaderUrl)
|
|
||||||
{
|
|
||||||
CFRelease(frameworksUrl);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
void* handle = NULL;
|
void* handle = NULL;
|
||||||
|
|
||||||
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
|
if (CFURLGetFileSystemRepresentation(url, true, (UInt8*) path, sizeof(path) - 1))
|
||||||
handle = _glfw_dlopen(path);
|
handle = _glfw_dlopen(path);
|
||||||
|
|
||||||
CFRelease(loaderUrl);
|
CFRelease(url);
|
||||||
CFRelease(frameworksUrl);
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,9 +513,6 @@ int _glfwPlatformInit(void)
|
|||||||
toTarget:_glfw.ns.helper
|
toTarget:_glfw.ns.helper
|
||||||
withObject:nil];
|
withObject:nil];
|
||||||
|
|
||||||
if (NSApp)
|
|
||||||
_glfw.ns.finishedLaunching = GLFW_TRUE;
|
|
||||||
|
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
_glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init];
|
_glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init];
|
||||||
@@ -568,6 +565,10 @@ int _glfwPlatformInit(void)
|
|||||||
_glfwInitJoysticksNS();
|
_glfwInitJoysticksNS();
|
||||||
|
|
||||||
_glfwPollMonitorsNS();
|
_glfwPollMonitorsNS();
|
||||||
|
|
||||||
|
if (![[NSRunningApplication currentApplication] isFinishedLaunching])
|
||||||
|
[NSApp run];
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
@@ -577,11 +578,17 @@ void _glfwPlatformTerminate(void)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
|
if (_glfw.ns.keyboardLayout)
|
||||||
|
{
|
||||||
|
CFRelease(_glfw.ns.keyboardLayout);
|
||||||
|
_glfw.ns.keyboardLayout = NULL;
|
||||||
|
_glfw.ns.unicodeData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.ns.inputSource)
|
if (_glfw.ns.inputSource)
|
||||||
{
|
{
|
||||||
CFRelease(_glfw.ns.inputSource);
|
CFRelease(_glfw.ns.inputSource);
|
||||||
_glfw.ns.inputSource = NULL;
|
_glfw.ns.inputSource = NULL;
|
||||||
_glfw.ns.unicodeData = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.ns.eventSource)
|
if (_glfw.ns.eventSource)
|
||||||
@@ -613,10 +620,9 @@ void _glfwPlatformTerminate(void)
|
|||||||
[NSEvent removeMonitor:_glfw.ns.keyUpMonitor];
|
[NSEvent removeMonitor:_glfw.ns.keyUpMonitor];
|
||||||
|
|
||||||
free(_glfw.ns.clipboardString);
|
free(_glfw.ns.clipboardString);
|
||||||
|
free(_glfw.ns.keyboardLayoutName);
|
||||||
|
|
||||||
_glfwTerminateNSGL();
|
_glfwTerminateNSGL();
|
||||||
_glfwTerminateEGL();
|
|
||||||
_glfwTerminateOSMesa();
|
|
||||||
_glfwTerminateJoysticksNS();
|
_glfwTerminateJoysticksNS();
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
|
|||||||
@@ -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>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; }
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; }
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
|
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
|
||||||
#define GLFW_BUILD_COCOA_MAPPINGS
|
|
||||||
|
|
||||||
// Cocoa-specific per-joystick data
|
// Cocoa-specific per-joystick data
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -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) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
||||||
@@ -98,7 +98,8 @@ static void closeJoystick(_GLFWjoystick* js)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
if (!js->present)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < CFArrayGetCount(js->ns.axes); i++)
|
for (i = 0; i < CFArrayGetCount(js->ns.axes); i++)
|
||||||
free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
|
free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
|
||||||
@@ -113,6 +114,7 @@ static void closeJoystick(_GLFWjoystick* js)
|
|||||||
CFRelease(js->ns.hats);
|
CFRelease(js->ns.hats);
|
||||||
|
|
||||||
_glfwFreeJoystick(js);
|
_glfwFreeJoystick(js);
|
||||||
|
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for user-initiated joystick addition
|
// Callback for user-initiated joystick addition
|
||||||
@@ -292,9 +294,9 @@ static void removeCallback(void* context,
|
|||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device)
|
if (_glfw.joysticks[jid].ns.device == device)
|
||||||
{
|
{
|
||||||
closeJoystick(&_glfw.joysticks[jid]);
|
closeJoystick(_glfw.joysticks + jid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,10 +392,7 @@ void _glfwTerminateJoysticksNS(void)
|
|||||||
int jid;
|
int jid;
|
||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
closeJoystick(_glfw.joysticks + jid);
|
||||||
if (_glfw.joysticks[jid].connected)
|
|
||||||
closeJoystick(&_glfw.joysticks[jid]);
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(_glfw.ns.hidManager);
|
CFRelease(_glfw.ns.hidManager);
|
||||||
_glfw.ns.hidManager = NULL;
|
_glfw.ns.hidManager = NULL;
|
||||||
@@ -471,7 +470,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return js->connected;
|
return js->present;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
|
|||||||
+51
-66
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -39,31 +39,18 @@
|
|||||||
|
|
||||||
// Get the name of the specified display, or NULL
|
// Get the name of the specified display, or NULL
|
||||||
//
|
//
|
||||||
static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
static char* getDisplayName(CGDirectDisplayID displayID)
|
||||||
{
|
{
|
||||||
// IOKit doesn't work on Apple Silicon anymore
|
|
||||||
// Luckily, 10.15 introduced -[NSScreen localizedName].
|
|
||||||
// Use it if available, and fall back to IOKit otherwise.
|
|
||||||
if (screen)
|
|
||||||
{
|
|
||||||
if ([screen respondsToSelector:@selector(localizedName)])
|
|
||||||
{
|
|
||||||
NSString* name = [screen valueForKey:@"localizedName"];
|
|
||||||
if (name)
|
|
||||||
return _glfw_strdup([name UTF8String]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
io_iterator_t it;
|
io_iterator_t it;
|
||||||
io_service_t service;
|
io_service_t service;
|
||||||
CFDictionaryRef info;
|
CFDictionaryRef info;
|
||||||
|
|
||||||
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
||||||
IOServiceMatching("IODisplayConnect"),
|
IOServiceMatching("IODisplayConnect"),
|
||||||
&it) != 0)
|
&it) != 0)
|
||||||
{
|
{
|
||||||
// This may happen if a desktop Mac is running headless
|
// This may happen if a desktop Mac is running headless
|
||||||
return _glfw_strdup("Display");
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((service = IOIteratorNext(it)) != 0)
|
while ((service = IOIteratorNext(it)) != 0)
|
||||||
@@ -98,7 +85,11 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||||||
IOObjectRelease(it);
|
IOObjectRelease(it);
|
||||||
|
|
||||||
if (!service)
|
if (!service)
|
||||||
return _glfw_strdup("Display");
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to find service port for display");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CFDictionaryRef names =
|
CFDictionaryRef names =
|
||||||
CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
||||||
@@ -110,7 +101,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||||||
{
|
{
|
||||||
// This may happen if a desktop Mac is running headless
|
// This may happen if a desktop Mac is running headless
|
||||||
CFRelease(info);
|
CFRelease(info);
|
||||||
return _glfw_strdup("Display");
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CFIndex size =
|
const CFIndex size =
|
||||||
@@ -218,6 +209,31 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Finds and caches the NSScreen corresponding to the specified monitor
|
||||||
|
//
|
||||||
|
static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
||||||
|
{
|
||||||
|
if (monitor->ns.screen)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
for (NSScreen* screen in [NSScreen screens])
|
||||||
|
{
|
||||||
|
NSNumber* displayID = [screen deviceDescription][@"NSScreenNumber"];
|
||||||
|
|
||||||
|
// HACK: Compare unit numbers instead of display IDs to work around
|
||||||
|
// display replacement on machines with automatic graphics
|
||||||
|
// switching
|
||||||
|
if (monitor->ns.unitNumber == CGDisplayUnitNumber([displayID unsignedIntValue]))
|
||||||
|
{
|
||||||
|
monitor->ns.screen = screen;
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find a screen for monitor");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the display refresh rate queried from the I/O registry
|
// Returns the display refresh rate queried from the I/O registry
|
||||||
//
|
//
|
||||||
static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
||||||
@@ -227,7 +243,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
|||||||
io_iterator_t it;
|
io_iterator_t it;
|
||||||
io_service_t service;
|
io_service_t service;
|
||||||
|
|
||||||
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
||||||
IOServiceMatching("IOFramebuffer"),
|
IOServiceMatching("IOFramebuffer"),
|
||||||
&it) != 0)
|
&it) != 0)
|
||||||
{
|
{
|
||||||
@@ -261,20 +277,14 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
|||||||
CFSTR("IOFBCurrentPixelCount"),
|
CFSTR("IOFBCurrentPixelCount"),
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault,
|
||||||
kNilOptions);
|
kNilOptions);
|
||||||
|
if (!clockRef || !countRef)
|
||||||
|
break;
|
||||||
|
|
||||||
uint32_t clock = 0, count = 0;
|
uint32_t clock = 0, count = 0;
|
||||||
|
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
||||||
if (clockRef)
|
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
||||||
{
|
CFRelease(clockRef);
|
||||||
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
CFRelease(countRef);
|
||||||
CFRelease(clockRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (countRef)
|
|
||||||
{
|
|
||||||
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
|
||||||
CFRelease(countRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clock > 0 && count > 0)
|
if (clock > 0 && count > 0)
|
||||||
refreshRate = clock / (double) count;
|
refreshRate = clock / (double) count;
|
||||||
@@ -318,46 +328,27 @@ void _glfwPollMonitorsNS(void)
|
|||||||
if (CGDisplayIsAsleep(displays[i]))
|
if (CGDisplayIsAsleep(displays[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
|
||||||
NSScreen* screen = nil;
|
|
||||||
|
|
||||||
for (screen in [NSScreen screens])
|
|
||||||
{
|
|
||||||
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
|
|
||||||
|
|
||||||
// HACK: Compare unit numbers instead of display IDs to work around
|
|
||||||
// display replacement on machines with automatic graphics
|
|
||||||
// switching
|
|
||||||
if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: Compare unit numbers instead of display IDs to work around
|
// HACK: Compare unit numbers instead of display IDs to work around
|
||||||
// display replacement on machines with automatic graphics
|
// display replacement on machines with automatic graphics
|
||||||
// switching
|
// switching
|
||||||
uint32_t j;
|
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||||
for (j = 0; j < disconnectedCount; j++)
|
for (uint32_t j = 0; j < disconnectedCount; j++)
|
||||||
{
|
{
|
||||||
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
||||||
{
|
{
|
||||||
disconnected[j]->ns.screen = screen;
|
|
||||||
disconnected[j] = NULL;
|
disconnected[j] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j < disconnectedCount)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
char* name = getMonitorName(displays[i], screen);
|
char* name = getDisplayName(displays[i]);
|
||||||
if (!name)
|
if (!name)
|
||||||
continue;
|
name = _glfw_strdup("Unknown");
|
||||||
|
|
||||||
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||||
monitor->ns.displayID = displays[i];
|
monitor->ns.displayID = displays[i];
|
||||||
monitor->ns.unitNumber = unitNumber;
|
monitor->ns.unitNumber = unitNumber;
|
||||||
monitor->ns.screen = screen;
|
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
@@ -466,11 +457,8 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!monitor->ns.screen)
|
if (!refreshMonitorScreen(monitor))
|
||||||
{
|
return;
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Cocoa: Cannot query content scale without screen");
|
|
||||||
}
|
|
||||||
|
|
||||||
const NSRect points = [monitor->ns.screen frame];
|
const NSRect points = [monitor->ns.screen frame];
|
||||||
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
|
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
|
||||||
@@ -489,11 +477,8 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!monitor->ns.screen)
|
if (!refreshMonitorScreen(monitor))
|
||||||
{
|
return;
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Cocoa: Cannot query workarea without screen");
|
|
||||||
}
|
|
||||||
|
|
||||||
const NSRect frameRect = [monitor->ns.screen visibleFrame];
|
const NSRect frameRect = [monitor->ns.screen visibleFrame];
|
||||||
|
|
||||||
@@ -536,7 +521,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip duplicate modes
|
// Skip duplicate modes
|
||||||
if (j < *count)
|
if (i < *count)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(*count)++;
|
(*count)++;
|
||||||
|
|||||||
+19
-19
@@ -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>
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -31,9 +31,7 @@
|
|||||||
|
|
||||||
// NOTE: All of NSGL was deprecated in the 10.14 SDK
|
// NOTE: All of NSGL was deprecated in the 10.14 SDK
|
||||||
// This disables the pointless warnings for every symbol we use
|
// This disables the pointless warnings for every symbol we use
|
||||||
#ifndef GL_SILENCE_DEPRECATION
|
|
||||||
#define GL_SILENCE_DEPRECATION
|
#define GL_SILENCE_DEPRECATION
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__OBJC__)
|
#if defined(__OBJC__)
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
@@ -42,10 +40,8 @@ typedef void* id;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||||
// SDK versions where one is unavailable or deprecated.
|
// SDK versions where one is unavailable or the other deprecated
|
||||||
// We use the newer names in code and replace them with the older names if
|
// We use the newer names in code and these macros to handle compatibility
|
||||||
// the base SDK does not provide the newer names.
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||||
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||||
#define NSEventMaskAny NSAnyEventMask
|
#define NSEventMaskAny NSAnyEventMask
|
||||||
@@ -64,15 +60,6 @@ typedef void* id;
|
|||||||
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: Many Cocoa dynamically linked constants 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 deployment target is older than the newer names.
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
|
|
||||||
#define NSPasteboardTypeURL NSURLPboardType
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||||
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
||||||
|
|
||||||
@@ -105,7 +92,7 @@ typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMeta
|
|||||||
#define _glfw_dlclose(handle) dlclose(handle)
|
#define _glfw_dlclose(handle) dlclose(handle)
|
||||||
#define _glfw_dlsym(handle, name) dlsym(handle, name)
|
#define _glfw_dlsym(handle, name) dlsym(handle, name)
|
||||||
|
|
||||||
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.layer)
|
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.view)
|
||||||
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
|
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns
|
||||||
@@ -116,6 +103,10 @@ typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMeta
|
|||||||
|
|
||||||
// HIToolbox.framework pointer typedefs
|
// HIToolbox.framework pointer typedefs
|
||||||
#define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
|
#define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
|
||||||
|
#define kTISPropertyInputSourceID _glfw.ns.tis.kPropertyInputSourceID
|
||||||
|
#define kTISPropertyLocalizedName _glfw.ns.tis.kPropertyLocalizedName
|
||||||
|
typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardInputSource)(void);
|
||||||
|
#define TISCopyCurrentKeyboardInputSource _glfw.ns.tis.CopyCurrentKeyboardInputSource
|
||||||
typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void);
|
typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void);
|
||||||
#define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource
|
#define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource
|
||||||
typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef);
|
typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef);
|
||||||
@@ -146,6 +137,7 @@ typedef struct _GLFWwindowNS
|
|||||||
// since the last cursor motion event was processed
|
// since the last cursor motion event was processed
|
||||||
// This is kept to counteract Cocoa doing the same internally
|
// This is kept to counteract Cocoa doing the same internally
|
||||||
double cursorWarpDeltaX, cursorWarpDeltaY;
|
double cursorWarpDeltaX, cursorWarpDeltaY;
|
||||||
|
|
||||||
} _GLFWwindowNS;
|
} _GLFWwindowNS;
|
||||||
|
|
||||||
// Cocoa-specific global data
|
// Cocoa-specific global data
|
||||||
@@ -154,11 +146,11 @@ typedef struct _GLFWlibraryNS
|
|||||||
{
|
{
|
||||||
CGEventSourceRef eventSource;
|
CGEventSourceRef eventSource;
|
||||||
id delegate;
|
id delegate;
|
||||||
GLFWbool finishedLaunching;
|
|
||||||
GLFWbool cursorHidden;
|
GLFWbool cursorHidden;
|
||||||
TISInputSourceRef inputSource;
|
TISInputSourceRef inputSource;
|
||||||
|
TISInputSourceRef keyboardLayout;
|
||||||
IOHIDManagerRef hidManager;
|
IOHIDManagerRef hidManager;
|
||||||
id unicodeData;
|
void* unicodeData;
|
||||||
id helper;
|
id helper;
|
||||||
id keyUpMonitor;
|
id keyUpMonitor;
|
||||||
id nibObjects;
|
id nibObjects;
|
||||||
@@ -167,6 +159,7 @@ typedef struct _GLFWlibraryNS
|
|||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
char* keyboardLayoutName;
|
||||||
CGPoint cascadePoint;
|
CGPoint cascadePoint;
|
||||||
// Where to place the cursor when re-enabled
|
// Where to place the cursor when re-enabled
|
||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
@@ -175,11 +168,15 @@ typedef struct _GLFWlibraryNS
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
CFBundleRef bundle;
|
CFBundleRef bundle;
|
||||||
|
PFN_TISCopyCurrentKeyboardInputSource CopyCurrentKeyboardInputSource;
|
||||||
PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource;
|
PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource;
|
||||||
PFN_TISGetInputSourceProperty GetInputSourceProperty;
|
PFN_TISGetInputSourceProperty GetInputSourceProperty;
|
||||||
PFN_LMGetKbdType GetKbdType;
|
PFN_LMGetKbdType GetKbdType;
|
||||||
CFStringRef kPropertyUnicodeKeyLayoutData;
|
CFStringRef kPropertyUnicodeKeyLayoutData;
|
||||||
|
CFStringRef kPropertyInputSourceID;
|
||||||
|
CFStringRef kPropertyLocalizedName;
|
||||||
} tis;
|
} tis;
|
||||||
|
|
||||||
} _GLFWlibraryNS;
|
} _GLFWlibraryNS;
|
||||||
|
|
||||||
// Cocoa-specific per-monitor data
|
// Cocoa-specific per-monitor data
|
||||||
@@ -191,6 +188,7 @@ typedef struct _GLFWmonitorNS
|
|||||||
uint32_t unitNumber;
|
uint32_t unitNumber;
|
||||||
id screen;
|
id screen;
|
||||||
double fallbackRefreshRate;
|
double fallbackRefreshRate;
|
||||||
|
|
||||||
} _GLFWmonitorNS;
|
} _GLFWmonitorNS;
|
||||||
|
|
||||||
// Cocoa-specific per-cursor data
|
// Cocoa-specific per-cursor data
|
||||||
@@ -198,6 +196,7 @@ typedef struct _GLFWmonitorNS
|
|||||||
typedef struct _GLFWcursorNS
|
typedef struct _GLFWcursorNS
|
||||||
{
|
{
|
||||||
id object;
|
id object;
|
||||||
|
|
||||||
} _GLFWcursorNS;
|
} _GLFWcursorNS;
|
||||||
|
|
||||||
// Cocoa-specific global timer data
|
// Cocoa-specific global timer data
|
||||||
@@ -205,6 +204,7 @@ typedef struct _GLFWcursorNS
|
|||||||
typedef struct _GLFWtimerNS
|
typedef struct _GLFWtimerNS
|
||||||
{
|
{
|
||||||
uint64_t frequency;
|
uint64_t frequency;
|
||||||
|
|
||||||
} _GLFWtimerNS;
|
} _GLFWtimerNS;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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>
|
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
|
|||||||
+119
-188
@@ -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>
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -31,9 +31,25 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// HACK: This enum value is missing from framework headers on OS X 10.11 despite
|
// Returns the style mask corresponding to the window settings
|
||||||
// having been (according to documentation) added in Mac OS X 10.7
|
//
|
||||||
#define NSWindowCollectionBehaviorFullScreenNone (1 << 9)
|
static NSUInteger getStyleMask(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
NSUInteger styleMask = NSWindowStyleMaskMiniaturizable;
|
||||||
|
|
||||||
|
if (window->monitor || !window->decorated)
|
||||||
|
styleMask |= NSWindowStyleMaskBorderless;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
styleMask |= NSWindowStyleMaskTitled |
|
||||||
|
NSWindowStyleMaskClosable;
|
||||||
|
|
||||||
|
if (window->resizable)
|
||||||
|
styleMask |= NSWindowStyleMaskResizable;
|
||||||
|
}
|
||||||
|
|
||||||
|
return styleMask;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns whether the cursor is in the content area of the specified window
|
// Returns whether the cursor is in the content area of the specified window
|
||||||
//
|
//
|
||||||
@@ -98,11 +114,10 @@ static void updateCursorMode(_GLFWwindow* window)
|
|||||||
else if (_glfw.ns.disabledCursorWindow == window)
|
else if (_glfw.ns.disabledCursorWindow == window)
|
||||||
{
|
{
|
||||||
_glfw.ns.disabledCursorWindow = NULL;
|
_glfw.ns.disabledCursorWindow = NULL;
|
||||||
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
_glfwPlatformSetCursorPos(window,
|
_glfwPlatformSetCursorPos(window,
|
||||||
_glfw.ns.restoreCursorPosX,
|
_glfw.ns.restoreCursorPosX,
|
||||||
_glfw.ns.restoreCursorPosY);
|
_glfw.ns.restoreCursorPosY);
|
||||||
// NOTE: The matching CGAssociateMouseAndMouseCursorPosition call is
|
|
||||||
// made in _glfwPlatformSetCursorPos as part of a workaround
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorInContentArea(window))
|
if (cursorInContentArea(window))
|
||||||
@@ -228,7 +243,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)windowDidResize:(NSNotification *)notification
|
- (void)windowDidResize:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client != GLFW_NO_API)
|
||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
@@ -263,7 +278,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)windowDidMove:(NSNotification *)notification
|
- (void)windowDidMove:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client != GLFW_NO_API)
|
||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
@@ -345,7 +360,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
markedText = [[NSMutableAttributedString alloc] init];
|
markedText = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
[self updateTrackingAreas];
|
[self updateTrackingAreas];
|
||||||
[self registerForDraggedTypes:@[NSPasteboardTypeURL]];
|
// NOTE: kUTTypeURL corresponds to NSPasteboardTypeURL but is available
|
||||||
|
// on 10.7 without having been deprecated yet
|
||||||
|
[self registerForDraggedTypes:@[(__bridge NSString*) kUTTypeURL]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -380,7 +397,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)updateLayer
|
- (void)updateLayer
|
||||||
{
|
{
|
||||||
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client != GLFW_NO_API)
|
||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
_glfwInputWindowDamage(window);
|
_glfwInputWindowDamage(window);
|
||||||
@@ -503,18 +520,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
{
|
{
|
||||||
const NSRect contentRect = [window->ns.view frame];
|
const NSRect contentRect = [window->ns.view frame];
|
||||||
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
|
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
|
||||||
const float xscale = fbRect.size.width / contentRect.size.width;
|
|
||||||
const float yscale = fbRect.size.height / contentRect.size.height;
|
|
||||||
|
|
||||||
if (xscale != window->ns.xscale || yscale != window->ns.yscale)
|
|
||||||
{
|
|
||||||
if (window->ns.retina && window->ns.layer)
|
|
||||||
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
|
|
||||||
|
|
||||||
window->ns.xscale = xscale;
|
|
||||||
window->ns.yscale = yscale;
|
|
||||||
_glfwInputWindowContentScale(window, xscale, yscale);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fbRect.size.width != window->ns.fbWidth ||
|
if (fbRect.size.width != window->ns.fbWidth ||
|
||||||
fbRect.size.height != window->ns.fbHeight)
|
fbRect.size.height != window->ns.fbHeight)
|
||||||
@@ -523,6 +528,19 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
window->ns.fbHeight = fbRect.size.height;
|
window->ns.fbHeight = fbRect.size.height;
|
||||||
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float xscale = fbRect.size.width / contentRect.size.width;
|
||||||
|
const float yscale = fbRect.size.height / contentRect.size.height;
|
||||||
|
|
||||||
|
if (xscale != window->ns.xscale || yscale != window->ns.yscale)
|
||||||
|
{
|
||||||
|
window->ns.xscale = xscale;
|
||||||
|
window->ns.yscale = yscale;
|
||||||
|
_glfwInputWindowContentScale(window, xscale, yscale);
|
||||||
|
|
||||||
|
if (window->ns.retina && window->ns.layer)
|
||||||
|
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)rect
|
- (void)drawRect:(NSRect)rect
|
||||||
@@ -713,24 +731,14 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
else
|
else
|
||||||
characters = (NSString*) string;
|
characters = (NSString*) string;
|
||||||
|
|
||||||
NSRange range = NSMakeRange(0, [characters length]);
|
const NSUInteger length = [characters length];
|
||||||
while (range.length)
|
for (NSUInteger i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
uint32_t codepoint = 0;
|
const unichar codepoint = [characters characterAtIndex:i];
|
||||||
|
if ((codepoint & 0xff00) == 0xf700)
|
||||||
|
continue;
|
||||||
|
|
||||||
if ([characters getBytes:&codepoint
|
_glfwInputChar(window, codepoint, mods, plain);
|
||||||
maxLength:sizeof(codepoint)
|
|
||||||
usedLength:NULL
|
|
||||||
encoding:NSUTF32StringEncoding
|
|
||||||
options:0
|
|
||||||
range:range
|
|
||||||
remainingRange:&range])
|
|
||||||
{
|
|
||||||
if (codepoint >= 0xf700 && codepoint <= 0xf7ff)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
_glfwInputChar(window, codepoint, mods, plain);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -793,21 +801,9 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
else
|
else
|
||||||
contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height);
|
contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height);
|
||||||
|
|
||||||
NSUInteger styleMask = NSWindowStyleMaskMiniaturizable;
|
|
||||||
|
|
||||||
if (window->monitor || !window->decorated)
|
|
||||||
styleMask |= NSWindowStyleMaskBorderless;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
|
||||||
|
|
||||||
if (window->resizable)
|
|
||||||
styleMask |= NSWindowStyleMaskResizable;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->ns.object = [[GLFWWindow alloc]
|
window->ns.object = [[GLFWWindow alloc]
|
||||||
initWithContentRect:contentRect
|
initWithContentRect:contentRect
|
||||||
styleMask:styleMask
|
styleMask:getStyleMask(window)
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO];
|
defer:NO];
|
||||||
|
|
||||||
@@ -833,12 +829,6 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
NSWindowCollectionBehaviorManaged;
|
NSWindowCollectionBehaviorManaged;
|
||||||
[window->ns.object setCollectionBehavior:behavior];
|
[window->ns.object setCollectionBehavior:behavior];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
const NSWindowCollectionBehavior behavior =
|
|
||||||
NSWindowCollectionBehaviorFullScreenNone;
|
|
||||||
[window->ns.object setCollectionBehavior:behavior];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wndconfig->floating)
|
if (wndconfig->floating)
|
||||||
[window->ns.object setLevel:NSFloatingWindowLevel];
|
[window->ns.object setLevel:NSFloatingWindowLevel];
|
||||||
@@ -902,9 +892,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!_glfw.ns.finishedLaunching)
|
|
||||||
[NSApp run];
|
|
||||||
|
|
||||||
if (!createNativeWindow(window, wndconfig, fbconfig))
|
if (!createNativeWindow(window, wndconfig, fbconfig))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
@@ -919,11 +906,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
|
else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
|
||||||
{
|
{
|
||||||
// EGL implementation on macOS use CALayer* EGLNativeWindowType so we
|
|
||||||
// need to get the layer for EGL window surface creation.
|
|
||||||
[window->ns.view setWantsLayer:YES];
|
|
||||||
window->ns.layer = [window->ns.view layer];
|
|
||||||
|
|
||||||
if (!_glfwInitEGL())
|
if (!_glfwInitEGL())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
||||||
@@ -936,9 +918,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
@@ -946,18 +925,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
_glfwPlatformShowWindow(window);
|
_glfwPlatformShowWindow(window);
|
||||||
_glfwPlatformFocusWindow(window);
|
_glfwPlatformFocusWindow(window);
|
||||||
acquireMonitor(window);
|
acquireMonitor(window);
|
||||||
|
|
||||||
if (wndconfig->centerCursor)
|
|
||||||
_glfwCenterCursorInContentArea(window);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (wndconfig->visible)
|
|
||||||
{
|
|
||||||
_glfwPlatformShowWindow(window);
|
|
||||||
if (wndconfig->focused)
|
|
||||||
_glfwPlatformFocusWindow(window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@@ -1236,10 +1203,9 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
const NSRect contentRect =
|
const NSRect contentRect =
|
||||||
NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height);
|
NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height);
|
||||||
const NSUInteger styleMask = [window->ns.object styleMask];
|
|
||||||
const NSRect frameRect =
|
const NSRect frameRect =
|
||||||
[window->ns.object frameRectForContentRect:contentRect
|
[window->ns.object frameRectForContentRect:contentRect
|
||||||
styleMask:styleMask];
|
styleMask:getStyleMask(window)];
|
||||||
|
|
||||||
[window->ns.object setFrame:frameRect display:YES];
|
[window->ns.object setFrame:frameRect display:YES];
|
||||||
}
|
}
|
||||||
@@ -1256,27 +1222,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
// TODO: Solve this in a less terrible way
|
// TODO: Solve this in a less terrible way
|
||||||
_glfwPlatformPollEvents();
|
_glfwPlatformPollEvents();
|
||||||
|
|
||||||
NSUInteger styleMask = [window->ns.object styleMask];
|
const NSUInteger styleMask = getStyleMask(window);
|
||||||
|
|
||||||
if (window->monitor)
|
|
||||||
{
|
|
||||||
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
|
||||||
styleMask |= NSWindowStyleMaskBorderless;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (window->decorated)
|
|
||||||
{
|
|
||||||
styleMask &= ~NSWindowStyleMaskBorderless;
|
|
||||||
styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->resizable)
|
|
||||||
styleMask |= NSWindowStyleMaskResizable;
|
|
||||||
else
|
|
||||||
styleMask &= ~NSWindowStyleMaskResizable;
|
|
||||||
}
|
|
||||||
|
|
||||||
[window->ns.object setStyleMask:styleMask];
|
[window->ns.object setStyleMask:styleMask];
|
||||||
// HACK: Changing the style mask can cause the first responder to be cleared
|
// HACK: Changing the style mask can cause the first responder to be cleared
|
||||||
[window->ns.object makeFirstResponder:window->ns.view];
|
[window->ns.object makeFirstResponder:window->ns.view];
|
||||||
@@ -1322,20 +1268,6 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
else
|
else
|
||||||
[window->ns.object setLevel:NSNormalWindowLevel];
|
[window->ns.object setLevel:NSNormalWindowLevel];
|
||||||
|
|
||||||
if (window->resizable)
|
|
||||||
{
|
|
||||||
const NSWindowCollectionBehavior behavior =
|
|
||||||
NSWindowCollectionBehaviorFullScreenPrimary |
|
|
||||||
NSWindowCollectionBehaviorManaged;
|
|
||||||
[window->ns.object setCollectionBehavior:behavior];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const NSWindowCollectionBehavior behavior =
|
|
||||||
NSWindowCollectionBehaviorFullScreenNone;
|
|
||||||
[window->ns.object setCollectionBehavior:behavior];
|
|
||||||
}
|
|
||||||
|
|
||||||
[window->ns.object setHasShadow:YES];
|
[window->ns.object setHasShadow:YES];
|
||||||
// HACK: Clearing NSWindowStyleMaskTitled resets and disables the window
|
// HACK: Clearing NSWindowStyleMaskTitled resets and disables the window
|
||||||
// title property but the miniwindow title property is unaffected
|
// title property but the miniwindow title property is unaffected
|
||||||
@@ -1369,12 +1301,7 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|||||||
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
return [window->ns.object isZoomed];
|
||||||
if (window->resizable)
|
|
||||||
return [window->ns.object isZoomed];
|
|
||||||
else
|
|
||||||
return GLFW_FALSE;
|
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1406,46 +1333,15 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
|||||||
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
[window->ns.object setStyleMask:getStyleMask(window)];
|
||||||
const NSUInteger styleMask = [window->ns.object styleMask];
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
[window->ns.object setStyleMask:(styleMask | NSWindowStyleMaskResizable)];
|
|
||||||
const NSWindowCollectionBehavior behavior =
|
|
||||||
NSWindowCollectionBehaviorFullScreenPrimary |
|
|
||||||
NSWindowCollectionBehaviorManaged;
|
|
||||||
[window->ns.object setCollectionBehavior:behavior];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[window->ns.object setStyleMask:(styleMask & ~NSWindowStyleMaskResizable)];
|
|
||||||
const NSWindowCollectionBehavior behavior =
|
|
||||||
NSWindowCollectionBehaviorFullScreenNone;
|
|
||||||
[window->ns.object setCollectionBehavior:behavior];
|
|
||||||
}
|
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
[window->ns.object setStyleMask:getStyleMask(window)];
|
||||||
NSUInteger styleMask = [window->ns.object styleMask];
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
|
||||||
styleMask &= ~NSWindowStyleMaskBorderless;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
styleMask |= NSWindowStyleMaskBorderless;
|
|
||||||
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
|
||||||
}
|
|
||||||
|
|
||||||
[window->ns.object setStyleMask:styleMask];
|
|
||||||
[window->ns.object makeFirstResponder:window->ns.view];
|
[window->ns.object makeFirstResponder:window->ns.view];
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1486,9 +1382,6 @@ void _glfwPlatformPollEvents(void)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!_glfw.ns.finishedLaunching)
|
|
||||||
[NSApp run];
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||||
@@ -1508,9 +1401,6 @@ void _glfwPlatformWaitEvents(void)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!_glfw.ns.finishedLaunching)
|
|
||||||
[NSApp run];
|
|
||||||
|
|
||||||
// I wanted to pass NO to dequeue:, and rely on PollEvents to
|
// I wanted to pass NO to dequeue:, and rely on PollEvents to
|
||||||
// dequeue and send. For reasons not at all clear to me, passing
|
// dequeue and send. For reasons not at all clear to me, passing
|
||||||
// NO to dequeue: causes this method never to return.
|
// NO to dequeue: causes this method never to return.
|
||||||
@@ -1529,9 +1419,6 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!_glfw.ns.finishedLaunching)
|
|
||||||
[NSApp run];
|
|
||||||
|
|
||||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
||||||
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||||
untilDate:date
|
untilDate:date
|
||||||
@@ -1549,9 +1436,6 @@ void _glfwPlatformPostEmptyEvent(void)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (!_glfw.ns.finishedLaunching)
|
|
||||||
[NSApp run];
|
|
||||||
|
|
||||||
NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
|
NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
|
||||||
location:NSMakePoint(0, 0)
|
location:NSMakePoint(0, 0)
|
||||||
modifierFlags:0
|
modifierFlags:0
|
||||||
@@ -1610,11 +1494,6 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
|||||||
_glfwTransformYNS(globalPoint.y)));
|
_glfwTransformYNS(globalPoint.y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: Calling this right after setting the cursor position prevents macOS
|
|
||||||
// from freezing the cursor for a fraction of a second afterwards
|
|
||||||
if (window->cursorMode != GLFW_CURSOR_DISABLED)
|
|
||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1633,7 +1512,13 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (scancode < 0 || scancode > 0xff ||
|
if (scancode < 0 || scancode > 0xff ||
|
||||||
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfw.ns.unicodeData)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Keyboard Unicode data missing");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1680,6 +1565,26 @@ int _glfwPlatformGetKeyScancode(int key)
|
|||||||
return _glfw.ns.scancodes[key];
|
return _glfw.ns.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetKeyboardLayoutName(void)
|
||||||
|
{
|
||||||
|
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource();
|
||||||
|
NSString* name = (__bridge NSString*)
|
||||||
|
TISGetInputSourceProperty(source, kTISPropertyLocalizedName);
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
CFRelease(source);
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to retrieve keyboard layout name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_glfw.ns.keyboardLayoutName);
|
||||||
|
_glfw.ns.keyboardLayoutName = _glfw_strdup([name UTF8String]);
|
||||||
|
|
||||||
|
CFRelease(source);
|
||||||
|
return _glfw.ns.keyboardLayoutName;
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
@@ -1728,23 +1633,49 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (shape == GLFW_ARROW_CURSOR)
|
SEL cursorSelector = NULL;
|
||||||
cursor->ns.object = [NSCursor arrowCursor];
|
|
||||||
else if (shape == GLFW_IBEAM_CURSOR)
|
// HACK: Try to use a private message
|
||||||
cursor->ns.object = [NSCursor IBeamCursor];
|
if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
cursorSelector = NSSelectorFromString(@"_windowResizeEastWestCursor");
|
||||||
cursor->ns.object = [NSCursor crosshairCursor];
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
cursorSelector = NSSelectorFromString(@"_windowResizeNorthSouthCursor");
|
||||||
cursor->ns.object = [NSCursor pointingHandCursor];
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
cursorSelector = NSSelectorFromString(@"_windowResizeNorthWestSouthEastCursor");
|
||||||
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
cursorSelector = NSSelectorFromString(@"_windowResizeNorthEastSouthWestCursor");
|
||||||
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
|
||||||
|
if (cursorSelector && [NSCursor respondsToSelector:cursorSelector])
|
||||||
|
{
|
||||||
|
id object = [NSCursor performSelector:cursorSelector];
|
||||||
|
if ([object isKindOfClass:[NSCursor class]])
|
||||||
|
cursor->ns.object = object;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cursor->ns.object)
|
if (!cursor->ns.object)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
"Cocoa: Failed to retrieve standard 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_POINTING_HAND_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor pointingHandCursor];
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor closedHandCursor];
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor operationNotAllowedCursor];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cursor->ns.object)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
|
"Cocoa: Standard cursor shape unavailable");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-7
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -196,6 +196,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (desired->doublebuffer != current->doublebuffer)
|
||||||
|
{
|
||||||
|
// Double buffering is a hard constraint
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Count number of missing buffers
|
// Count number of missing buffers
|
||||||
{
|
{
|
||||||
missing = 0;
|
missing = 0;
|
||||||
@@ -564,9 +570,7 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
|||||||
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
||||||
window->context.getProcAddress("glClear");
|
window->context.getProcAddress("glClear");
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
window->context.swapBuffers(window);
|
||||||
if (window->doublebuffer)
|
|
||||||
window->context.swapBuffers(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
@@ -609,12 +613,10 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions
|
|||||||
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFWwindow* previous;
|
_GLFWwindow* previous = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
|
|
||||||
|
|
||||||
if (window && window->context.client == GLFW_NO_API)
|
if (window && window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT,
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT,
|
||||||
|
|||||||
+13
-33
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||||||
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||||
|
|
||||||
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
||||||
u->doublebuffer = desired->doublebuffer;
|
u->doublebuffer = GLFW_TRUE;
|
||||||
|
|
||||||
u->handle = (uintptr_t) n;
|
u->handle = (uintptr_t) n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
@@ -230,12 +230,6 @@ static void swapBuffersEGL(_GLFWwindow* window)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_GLFW_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);
|
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,8 +314,6 @@ GLFWbool _glfwInitEGL(void)
|
|||||||
"libEGL.dylib",
|
"libEGL.dylib",
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libEGL-1.so",
|
"libEGL-1.so",
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
"libEGL.so",
|
|
||||||
#else
|
#else
|
||||||
"libEGL.so.1",
|
"libEGL.so.1",
|
||||||
#endif
|
#endif
|
||||||
@@ -434,8 +426,6 @@ GLFWbool _glfwInitEGL(void)
|
|||||||
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
|
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
|
||||||
_glfw.egl.KHR_context_flush_control =
|
_glfw.egl.KHR_context_flush_control =
|
||||||
extensionSupportedEGL("EGL_KHR_context_flush_control");
|
extensionSupportedEGL("EGL_KHR_context_flush_control");
|
||||||
_glfw.egl.EXT_present_opaque =
|
|
||||||
extensionSupportedEGL("EGL_EXT_present_opaque");
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
@@ -598,22 +588,18 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up attributes for surface creation
|
// Set up attributes for surface creation
|
||||||
index = 0;
|
|
||||||
|
|
||||||
if (fbconfig->sRGB)
|
|
||||||
{
|
{
|
||||||
if (_glfw.egl.KHR_gl_colorspace)
|
int index = 0;
|
||||||
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
|
||||||
|
if (fbconfig->sRGB)
|
||||||
|
{
|
||||||
|
if (_glfw.egl.KHR_gl_colorspace)
|
||||||
|
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
||||||
|
}
|
||||||
|
|
||||||
|
setAttrib(EGL_NONE, EGL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fbconfig->doublebuffer)
|
|
||||||
setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
|
||||||
|
|
||||||
if (_glfw.egl.EXT_present_opaque)
|
|
||||||
setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
|
||||||
|
|
||||||
setAttrib(EGL_NONE, EGL_NONE);
|
|
||||||
|
|
||||||
window->context.egl.surface =
|
window->context.egl.surface =
|
||||||
eglCreateWindowSurface(_glfw.egl.display,
|
eglCreateWindowSurface(_glfw.egl.display,
|
||||||
config,
|
config,
|
||||||
@@ -643,8 +629,6 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
"libGLES_CM.dll",
|
"libGLES_CM.dll",
|
||||||
#elif defined(_GLFW_COCOA)
|
#elif defined(_GLFW_COCOA)
|
||||||
"libGLESv1_CM.dylib",
|
"libGLESv1_CM.dylib",
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
"libGLESv1_CM.so",
|
|
||||||
#else
|
#else
|
||||||
"libGLESv1_CM.so.1",
|
"libGLESv1_CM.so.1",
|
||||||
"libGLES_CM.so.1",
|
"libGLES_CM.so.1",
|
||||||
@@ -662,8 +646,6 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
"libGLESv2.dylib",
|
"libGLESv2.dylib",
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libGLESv2-2.so",
|
"libGLESv2-2.so",
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
"libGLESv2.so",
|
|
||||||
#else
|
#else
|
||||||
"libGLESv2.so.2",
|
"libGLESv2.so.2",
|
||||||
#endif
|
#endif
|
||||||
@@ -675,8 +657,6 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
_GLFW_OPENGL_LIBRARY,
|
_GLFW_OPENGL_LIBRARY,
|
||||||
#elif defined(_GLFW_WIN32)
|
#elif defined(_GLFW_WIN32)
|
||||||
#elif defined(_GLFW_COCOA)
|
#elif defined(_GLFW_COCOA)
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
"libGL.so",
|
|
||||||
#else
|
#else
|
||||||
"libGL.so.1",
|
"libGL.so.1",
|
||||||
#endif
|
#endif
|
||||||
@@ -784,7 +764,7 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
|
||||||
|
|
||||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return EGL_NO_CONTEXT;
|
return EGL_NO_CONTEXT;
|
||||||
@@ -798,7 +778,7 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
|
||||||
|
|
||||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return EGL_NO_SURFACE;
|
return EGL_NO_SURFACE;
|
||||||
|
|||||||
+3
-5
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -80,8 +80,6 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||||||
#define EGL_OPENGL_ES_API 0x30a0
|
#define EGL_OPENGL_ES_API 0x30a0
|
||||||
#define EGL_OPENGL_API 0x30a2
|
#define EGL_OPENGL_API 0x30a2
|
||||||
#define EGL_NONE 0x3038
|
#define EGL_NONE 0x3038
|
||||||
#define EGL_RENDER_BUFFER 0x3086
|
|
||||||
#define EGL_SINGLE_BUFFER 0x3085
|
|
||||||
#define EGL_EXTENSIONS 0x3055
|
#define EGL_EXTENSIONS 0x3055
|
||||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||||
#define EGL_NATIVE_VISUAL_ID 0x302e
|
#define EGL_NATIVE_VISUAL_ID 0x302e
|
||||||
@@ -108,7 +106,6 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
|
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
|
||||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
|
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
|
||||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
|
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
|
||||||
#define EGL_PRESENT_OPAQUE_EXT 0x31df
|
|
||||||
|
|
||||||
typedef int EGLint;
|
typedef int EGLint;
|
||||||
typedef unsigned int EGLBoolean;
|
typedef unsigned int EGLBoolean;
|
||||||
@@ -165,6 +162,7 @@ typedef struct _GLFWcontextEGL
|
|||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
|
|
||||||
void* client;
|
void* client;
|
||||||
|
|
||||||
} _GLFWcontextEGL;
|
} _GLFWcontextEGL;
|
||||||
|
|
||||||
// EGL-specific global data
|
// EGL-specific global data
|
||||||
@@ -180,7 +178,6 @@ typedef struct _GLFWlibraryEGL
|
|||||||
GLFWbool KHR_gl_colorspace;
|
GLFWbool KHR_gl_colorspace;
|
||||||
GLFWbool KHR_get_all_proc_addresses;
|
GLFWbool KHR_get_all_proc_addresses;
|
||||||
GLFWbool KHR_context_flush_control;
|
GLFWbool KHR_context_flush_control;
|
||||||
GLFWbool EXT_present_opaque;
|
|
||||||
|
|
||||||
void* handle;
|
void* handle;
|
||||||
|
|
||||||
@@ -200,6 +197,7 @@ typedef struct _GLFWlibraryEGL
|
|||||||
PFN_eglSwapInterval SwapInterval;
|
PFN_eglSwapInterval SwapInterval;
|
||||||
PFN_eglQueryString QueryString;
|
PFN_eglQueryString QueryString;
|
||||||
PFN_eglGetProcAddress GetProcAddress;
|
PFN_eglGetProcAddress GetProcAddress;
|
||||||
|
|
||||||
} _GLFWlibraryEGL;
|
} _GLFWlibraryEGL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010-2016 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2010-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -45,14 +45,14 @@
|
|||||||
// Define this to 1 if building GLFW for OSMesa
|
// Define this to 1 if building GLFW for OSMesa
|
||||||
#cmakedefine _GLFW_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
|
// Define this to 1 to use Vulkan loader linked statically into application
|
||||||
#cmakedefine _GLFW_VULKAN_STATIC
|
#cmakedefine _GLFW_VULKAN_STATIC
|
||||||
|
|
||||||
// Define this to 1 to force use of high-performance GPU on hybrid systems
|
// Define this to 1 to force use of high-performance GPU on hybrid systems
|
||||||
#cmakedefine _GLFW_USE_HYBRID_HPG
|
#cmakedefine _GLFW_USE_HYBRID_HPG
|
||||||
|
|
||||||
|
// Define this to 1 if xkbcommon supports the compose key
|
||||||
|
#cmakedefine HAVE_XKBCOMMON_COMPOSE_H
|
||||||
// Define this to 1 if the libc supports memfd_create()
|
// Define this to 1 if the libc supports memfd_create()
|
||||||
#cmakedefine HAVE_MEMFD_CREATE
|
#cmakedefine HAVE_MEMFD_CREATE
|
||||||
|
|
||||||
|
|||||||
+11
-14
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -92,9 +92,6 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (desired->transparent)
|
if (desired->transparent)
|
||||||
{
|
{
|
||||||
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
||||||
@@ -122,6 +119,8 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
|||||||
|
|
||||||
if (getGLXFBConfigAttrib(n, GLX_STEREO))
|
if (getGLXFBConfigAttrib(n, GLX_STEREO))
|
||||||
u->stereo = GLFW_TRUE;
|
u->stereo = GLFW_TRUE;
|
||||||
|
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER))
|
||||||
|
u->doublebuffer = GLFW_TRUE;
|
||||||
|
|
||||||
if (_glfw.glx.ARB_multisample)
|
if (_glfw.glx.ARB_multisample)
|
||||||
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
|
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
|
||||||
@@ -260,8 +259,6 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
_GLFW_GLX_LIBRARY,
|
_GLFW_GLX_LIBRARY,
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libGL-1.so",
|
"libGL-1.so",
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
"libGL.so",
|
|
||||||
#else
|
#else
|
||||||
"libGL.so.1",
|
"libGL.so.1",
|
||||||
"libGL.so",
|
"libGL.so",
|
||||||
@@ -309,6 +306,10 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
_glfw_dlsym(_glfw.glx.handle, "glXCreateWindow");
|
_glfw_dlsym(_glfw.glx.handle, "glXCreateWindow");
|
||||||
_glfw.glx.DestroyWindow =
|
_glfw.glx.DestroyWindow =
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow");
|
_glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow");
|
||||||
|
_glfw.glx.GetProcAddress =
|
||||||
|
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress");
|
||||||
|
_glfw.glx.GetProcAddressARB =
|
||||||
|
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
|
||||||
_glfw.glx.GetVisualFromFBConfig =
|
_glfw.glx.GetVisualFromFBConfig =
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
|
_glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
|
||||||
|
|
||||||
@@ -324,6 +325,8 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
!_glfw.glx.CreateNewContext ||
|
!_glfw.glx.CreateNewContext ||
|
||||||
!_glfw.glx.CreateWindow ||
|
!_glfw.glx.CreateWindow ||
|
||||||
!_glfw.glx.DestroyWindow ||
|
!_glfw.glx.DestroyWindow ||
|
||||||
|
!_glfw.glx.GetProcAddress ||
|
||||||
|
!_glfw.glx.GetProcAddressARB ||
|
||||||
!_glfw.glx.GetVisualFromFBConfig)
|
!_glfw.glx.GetVisualFromFBConfig)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
@@ -331,12 +334,6 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Unlike GLX 1.3 entry points these are not required to be present
|
|
||||||
_glfw.glx.GetProcAddress = (PFNGLXGETPROCADDRESSPROC)
|
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress");
|
|
||||||
_glfw.glx.GetProcAddressARB = (PFNGLXGETPROCADDRESSPROC)
|
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
|
|
||||||
|
|
||||||
if (!glXQueryExtension(_glfw.x11.display,
|
if (!glXQueryExtension(_glfw.x11.display,
|
||||||
&_glfw.glx.errorBase,
|
&_glfw.glx.errorBase,
|
||||||
&_glfw.glx.eventBase))
|
&_glfw.glx.eventBase))
|
||||||
@@ -676,7 +673,7 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -690,7 +687,7 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||||
|
|
||||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
+3
-1
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -117,6 +117,7 @@ typedef struct _GLFWcontextGLX
|
|||||||
{
|
{
|
||||||
GLXContext handle;
|
GLXContext handle;
|
||||||
GLXWindow window;
|
GLXWindow window;
|
||||||
|
|
||||||
} _GLFWcontextGLX;
|
} _GLFWcontextGLX;
|
||||||
|
|
||||||
// GLX-specific global data
|
// GLX-specific global data
|
||||||
@@ -164,6 +165,7 @@ typedef struct _GLFWlibraryGLX
|
|||||||
GLFWbool EXT_create_context_es2_profile;
|
GLFWbool EXT_create_context_es2_profile;
|
||||||
GLFWbool ARB_create_context_no_error;
|
GLFWbool ARB_create_context_no_error;
|
||||||
GLFWbool ARB_context_flush_control;
|
GLFWbool ARB_context_flush_control;
|
||||||
|
|
||||||
} _GLFWlibraryGLX;
|
} _GLFWlibraryGLX;
|
||||||
|
|
||||||
GLFWbool _glfwInitGLX(void);
|
GLFWbool _glfwInitGLX(void);
|
||||||
|
|||||||
+23
-101
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "mappings.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -36,15 +37,16 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
// NOTE: The global variables below comprise all mutable global data in GLFW
|
// The global variables below comprise all mutable global data in GLFW
|
||||||
// Any other mutable global variable is a bug
|
//
|
||||||
|
// Any other global variable is a bug
|
||||||
|
|
||||||
// This contains all mutable state shared between compilation units of GLFW
|
// Global state shared between compilation units of GLFW
|
||||||
//
|
//
|
||||||
_GLFWlibrary _glfw = { GLFW_FALSE };
|
_GLFWlibrary _glfw = { GLFW_FALSE };
|
||||||
|
|
||||||
// These are outside of _glfw so they can be used before initialization and
|
// These are outside of _glfw so they can be used before initialization and
|
||||||
// after termination without special handling when _glfw is cleared to zero
|
// after termination
|
||||||
//
|
//
|
||||||
static _GLFWerror _glfwMainThreadError;
|
static _GLFWerror _glfwMainThreadError;
|
||||||
static GLFWerrorfun _glfwErrorCallback;
|
static GLFWerrorfun _glfwErrorCallback;
|
||||||
@@ -111,90 +113,6 @@ static void terminate(void)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Encode a Unicode code point to a UTF-8 stream
|
|
||||||
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
|
||||||
//
|
|
||||||
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint)
|
|
||||||
{
|
|
||||||
size_t count = 0;
|
|
||||||
|
|
||||||
if (codepoint < 0x80)
|
|
||||||
s[count++] = (char) codepoint;
|
|
||||||
else if (codepoint < 0x800)
|
|
||||||
{
|
|
||||||
s[count++] = (codepoint >> 6) | 0xc0;
|
|
||||||
s[count++] = (codepoint & 0x3f) | 0x80;
|
|
||||||
}
|
|
||||||
else if (codepoint < 0x10000)
|
|
||||||
{
|
|
||||||
s[count++] = (codepoint >> 12) | 0xe0;
|
|
||||||
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
|
|
||||||
s[count++] = (codepoint & 0x3f) | 0x80;
|
|
||||||
}
|
|
||||||
else if (codepoint < 0x110000)
|
|
||||||
{
|
|
||||||
s[count++] = (codepoint >> 18) | 0xf0;
|
|
||||||
s[count++] = ((codepoint >> 12) & 0x3f) | 0x80;
|
|
||||||
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
|
|
||||||
s[count++] = (codepoint & 0x3f) | 0x80;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Splits and translates a text/uri-list into separate file paths
|
|
||||||
// NOTE: This function destroys the provided string
|
|
||||||
//
|
|
||||||
char** _glfwParseUriList(char* text, int* count)
|
|
||||||
{
|
|
||||||
const char* prefix = "file://";
|
|
||||||
char** paths = NULL;
|
|
||||||
char* line;
|
|
||||||
|
|
||||||
*count = 0;
|
|
||||||
|
|
||||||
while ((line = strtok(text, "\r\n")))
|
|
||||||
{
|
|
||||||
char* path;
|
|
||||||
|
|
||||||
text = NULL;
|
|
||||||
|
|
||||||
if (line[0] == '#')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (strncmp(line, prefix, strlen(prefix)) == 0)
|
|
||||||
{
|
|
||||||
line += strlen(prefix);
|
|
||||||
// TODO: Validate hostname
|
|
||||||
while (*line != '/')
|
|
||||||
line++;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*count)++;
|
|
||||||
|
|
||||||
path = calloc(strlen(line) + 1, 1);
|
|
||||||
paths = realloc(paths, *count * sizeof(char*));
|
|
||||||
paths[*count - 1] = path;
|
|
||||||
|
|
||||||
while (*line)
|
|
||||||
{
|
|
||||||
if (line[0] == '%' && line[1] && line[2])
|
|
||||||
{
|
|
||||||
const char digits[3] = { line[1], line[2], '\0' };
|
|
||||||
*path = (char) strtol(digits, NULL, 16);
|
|
||||||
line += 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*path = *line;
|
|
||||||
|
|
||||||
path++;
|
|
||||||
line++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return paths;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* _glfw_strdup(const char* source)
|
char* _glfw_strdup(const char* source)
|
||||||
{
|
{
|
||||||
const size_t length = strlen(source);
|
const size_t length = strlen(source);
|
||||||
@@ -203,16 +121,6 @@ char* _glfw_strdup(const char* source)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfw_min(int a, int b)
|
|
||||||
{
|
|
||||||
return a < b ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _glfw_max(int a, int b)
|
|
||||||
{
|
|
||||||
return a > b ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
float _glfw_fminf(float a, float b)
|
float _glfw_fminf(float a, float b)
|
||||||
{
|
{
|
||||||
if (a != a)
|
if (a != a)
|
||||||
@@ -281,6 +189,8 @@ void _glfwInputError(int code, const char* format, ...)
|
|||||||
strcpy(description, "The requested format is unavailable");
|
strcpy(description, "The requested format is unavailable");
|
||||||
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
||||||
strcpy(description, "The specified window has no context");
|
strcpy(description, "The specified window has no context");
|
||||||
|
else if (code == GLFW_CURSOR_UNAVAILABLE)
|
||||||
|
strcpy(description, "The specified cursor shape is unavailable");
|
||||||
else
|
else
|
||||||
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
||||||
}
|
}
|
||||||
@@ -337,12 +247,24 @@ GLFWAPI int glfwInit(void)
|
|||||||
|
|
||||||
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
|
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
|
||||||
|
|
||||||
_glfwInitGamepadMappings();
|
|
||||||
|
|
||||||
_glfw.initialized = GLFW_TRUE;
|
_glfw.initialized = GLFW_TRUE;
|
||||||
_glfw.timer.offset = _glfwPlatformGetTimerValue();
|
_glfw.timer.offset = _glfwPlatformGetTimerValue();
|
||||||
|
|
||||||
glfwDefaultWindowHints();
|
glfwDefaultWindowHints();
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; _glfwDefaultMappings[i]; i++)
|
||||||
|
{
|
||||||
|
if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i]))
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+58
-57
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "mappings.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
@@ -86,13 +85,25 @@ static _GLFWmapping* findValidMapping(const _GLFWjoystick* js)
|
|||||||
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
|
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
|
||||||
{
|
{
|
||||||
if (!isValidElementForJoystick(mapping->buttons + i, js))
|
if (!isValidElementForJoystick(mapping->buttons + i, js))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Invalid button in gamepad mapping %s (%s)",
|
||||||
|
mapping->guid,
|
||||||
|
mapping->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
|
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
|
||||||
{
|
{
|
||||||
if (!isValidElementForJoystick(mapping->axes + i, js))
|
if (!isValidElementForJoystick(mapping->axes + i, js))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Invalid axis in gamepad mapping %s (%s)",
|
||||||
|
mapping->guid,
|
||||||
|
mapping->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,6 +256,14 @@ static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string)
|
|||||||
////// GLFW event API //////
|
////// GLFW event API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Notifies shared code of a keyboard layout change event
|
||||||
|
//
|
||||||
|
void _glfwInputKeyboardLayout(void)
|
||||||
|
{
|
||||||
|
if (_glfw.callbacks.layout)
|
||||||
|
_glfw.callbacks.layout();
|
||||||
|
}
|
||||||
|
|
||||||
// Notifies shared code of a physical key event
|
// Notifies shared code of a physical key event
|
||||||
//
|
//
|
||||||
void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
|
void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
@@ -278,7 +297,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
|||||||
// Notifies shared code of a Unicode codepoint input event
|
// Notifies shared code of a Unicode codepoint input event
|
||||||
// The 'plain' parameter determines whether to emit a regular character event
|
// The 'plain' parameter determines whether to emit a regular character event
|
||||||
//
|
//
|
||||||
void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain)
|
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain)
|
||||||
{
|
{
|
||||||
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
||||||
return;
|
return;
|
||||||
@@ -360,11 +379,6 @@ void _glfwInputJoystick(_GLFWjoystick* js, int event)
|
|||||||
{
|
{
|
||||||
const int jid = (int) (js - _glfw.joysticks);
|
const int jid = (int) (js - _glfw.joysticks);
|
||||||
|
|
||||||
if (event == GLFW_CONNECTED)
|
|
||||||
js->connected = GLFW_TRUE;
|
|
||||||
else if (event == GLFW_DISCONNECTED)
|
|
||||||
js->connected = GLFW_FALSE;
|
|
||||||
|
|
||||||
if (_glfw.callbacks.joystick)
|
if (_glfw.callbacks.joystick)
|
||||||
_glfw.callbacks.joystick(jid, event);
|
_glfw.callbacks.joystick(jid, event);
|
||||||
}
|
}
|
||||||
@@ -402,29 +416,6 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Adds the built-in set of gamepad mappings
|
|
||||||
//
|
|
||||||
void _glfwInitGamepadMappings(void)
|
|
||||||
{
|
|
||||||
int jid;
|
|
||||||
size_t i;
|
|
||||||
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
|
|
||||||
_glfw.mappings = calloc(count, sizeof(_GLFWmapping));
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
|
|
||||||
_glfw.mappingCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
||||||
{
|
|
||||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
|
||||||
if (js->connected)
|
|
||||||
js->mapping = findValidMapping(js);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns an available joystick object with arrays and name allocated
|
// Returns an available joystick object with arrays and name allocated
|
||||||
//
|
//
|
||||||
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||||
@@ -438,7 +429,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
if (!_glfw.joysticks[jid].allocated)
|
if (!_glfw.joysticks[jid].present)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +437,8 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
js->allocated = GLFW_TRUE;
|
js->present = GLFW_TRUE;
|
||||||
|
js->name = _glfw_strdup(name);
|
||||||
js->axes = calloc(axisCount, sizeof(float));
|
js->axes = calloc(axisCount, sizeof(float));
|
||||||
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
||||||
js->hats = calloc(hatCount, 1);
|
js->hats = calloc(hatCount, 1);
|
||||||
@@ -454,7 +446,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
js->buttonCount = buttonCount;
|
js->buttonCount = buttonCount;
|
||||||
js->hatCount = hatCount;
|
js->hatCount = hatCount;
|
||||||
|
|
||||||
strncpy(js->name, name, sizeof(js->name) - 1);
|
|
||||||
strncpy(js->guid, guid, sizeof(js->guid) - 1);
|
strncpy(js->guid, guid, sizeof(js->guid) - 1);
|
||||||
js->mapping = findValidMapping(js);
|
js->mapping = findValidMapping(js);
|
||||||
|
|
||||||
@@ -465,6 +456,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
//
|
//
|
||||||
void _glfwFreeJoystick(_GLFWjoystick* js)
|
void _glfwFreeJoystick(_GLFWjoystick* js)
|
||||||
{
|
{
|
||||||
|
free(js->name);
|
||||||
free(js->axes);
|
free(js->axes);
|
||||||
free(js->buttons);
|
free(js->buttons);
|
||||||
free(js->hats);
|
free(js->hats);
|
||||||
@@ -642,6 +634,19 @@ GLFWAPI int glfwGetKeyScancode(int key)
|
|||||||
return _glfwPlatformGetKeyScancode(key);
|
return _glfwPlatformGetKeyScancode(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetKeyboardLayoutName(void)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return _glfwPlatformGetKeyboardLayoutName();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWkeyboardlayoutfun glfwSetKeyboardLayoutCallback(GLFWkeyboardlayoutfun cbfun)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(_glfw.callbacks.layout, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
@@ -748,16 +753,9 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
|
|||||||
_GLFWcursor* cursor;
|
_GLFWcursor* cursor;
|
||||||
|
|
||||||
assert(image != NULL);
|
assert(image != NULL);
|
||||||
assert(image->pixels != NULL);
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
if (image->width <= 0 || image->height <= 0)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid image dimensions for cursor");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor = calloc(1, sizeof(_GLFWcursor));
|
cursor = calloc(1, sizeof(_GLFWcursor));
|
||||||
cursor->next = _glfw.cursorListHead;
|
cursor->next = _glfw.cursorListHead;
|
||||||
_glfw.cursorListHead = cursor;
|
_glfw.cursorListHead = cursor;
|
||||||
@@ -780,9 +778,13 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
|
|||||||
if (shape != GLFW_ARROW_CURSOR &&
|
if (shape != GLFW_ARROW_CURSOR &&
|
||||||
shape != GLFW_IBEAM_CURSOR &&
|
shape != GLFW_IBEAM_CURSOR &&
|
||||||
shape != GLFW_CROSSHAIR_CURSOR &&
|
shape != GLFW_CROSSHAIR_CURSOR &&
|
||||||
shape != GLFW_HAND_CURSOR &&
|
shape != GLFW_POINTING_HAND_CURSOR &&
|
||||||
shape != GLFW_HRESIZE_CURSOR &&
|
shape != GLFW_RESIZE_EW_CURSOR &&
|
||||||
shape != GLFW_VRESIZE_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);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -949,7 +951,7 @@ GLFWAPI int glfwJoystickPresent(int jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
|
return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
|
||||||
@@ -974,7 +976,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES))
|
||||||
@@ -1003,7 +1005,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
|
||||||
@@ -1036,7 +1038,7 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
|
||||||
@@ -1062,7 +1064,7 @@ GLFWAPI const char* glfwGetJoystickName(int jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
||||||
@@ -1087,7 +1089,7 @@ GLFWAPI const char* glfwGetJoystickGUID(int jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
||||||
@@ -1106,7 +1108,7 @@ GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer)
|
|||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->allocated)
|
if (!js->present)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
js->userPointer = pointer;
|
js->userPointer = pointer;
|
||||||
@@ -1122,7 +1124,7 @@ GLFWAPI void* glfwGetJoystickUserPointer(int jid)
|
|||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->allocated)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return js->userPointer;
|
return js->userPointer;
|
||||||
@@ -1188,7 +1190,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
|
|||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
if (js->connected)
|
if (js->present)
|
||||||
js->mapping = findValidMapping(js);
|
js->mapping = findValidMapping(js);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1211,7 +1213,7 @@ GLFWAPI int glfwJoystickIsGamepad(int jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
||||||
@@ -1236,7 +1238,7 @@ GLFWAPI const char* glfwGetGamepadName(int jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
|
||||||
@@ -1268,7 +1270,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (!js->connected)
|
if (!js->present)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL))
|
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL))
|
||||||
@@ -1377,4 +1379,3 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void)
|
|||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
return _glfwPlatformGetTimerFrequency();
|
return _glfwPlatformGetTimerFrequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+29
-31
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -275,6 +275,9 @@ struct _GLFWwndconfig
|
|||||||
char className[256];
|
char className[256];
|
||||||
char instanceName[256];
|
char instanceName[256];
|
||||||
} x11;
|
} x11;
|
||||||
|
struct {
|
||||||
|
GLFWbool keymenu;
|
||||||
|
} win32;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Context configuration
|
// Context configuration
|
||||||
@@ -342,9 +345,9 @@ struct _GLFWcontext
|
|||||||
int robustness;
|
int robustness;
|
||||||
int release;
|
int release;
|
||||||
|
|
||||||
PFNGLGETSTRINGIPROC GetStringi;
|
PFNGLGETSTRINGIPROC GetStringi;
|
||||||
PFNGLGETINTEGERVPROC GetIntegerv;
|
PFNGLGETINTEGERVPROC GetIntegerv;
|
||||||
PFNGLGETSTRINGPROC GetString;
|
PFNGLGETSTRINGPROC GetString;
|
||||||
|
|
||||||
_GLFWmakecontextcurrentfun makeCurrent;
|
_GLFWmakecontextcurrentfun makeCurrent;
|
||||||
_GLFWswapbuffersfun swapBuffers;
|
_GLFWswapbuffersfun swapBuffers;
|
||||||
@@ -375,7 +378,6 @@ struct _GLFWwindow
|
|||||||
GLFWbool focusOnShow;
|
GLFWbool focusOnShow;
|
||||||
GLFWbool shouldClose;
|
GLFWbool shouldClose;
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
GLFWbool doublebuffer;
|
|
||||||
GLFWvidmode videoMode;
|
GLFWvidmode videoMode;
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
_GLFWcursor* cursor;
|
_GLFWcursor* cursor;
|
||||||
@@ -397,23 +399,23 @@ struct _GLFWwindow
|
|||||||
_GLFWcontext context;
|
_GLFWcontext context;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
GLFWwindowposfun pos;
|
GLFWwindowposfun pos;
|
||||||
GLFWwindowsizefun size;
|
GLFWwindowsizefun size;
|
||||||
GLFWwindowclosefun close;
|
GLFWwindowclosefun close;
|
||||||
GLFWwindowrefreshfun refresh;
|
GLFWwindowrefreshfun refresh;
|
||||||
GLFWwindowfocusfun focus;
|
GLFWwindowfocusfun focus;
|
||||||
GLFWwindowiconifyfun iconify;
|
GLFWwindowiconifyfun iconify;
|
||||||
GLFWwindowmaximizefun maximize;
|
GLFWwindowmaximizefun maximize;
|
||||||
GLFWframebuffersizefun fbsize;
|
GLFWframebuffersizefun fbsize;
|
||||||
GLFWwindowcontentscalefun scale;
|
GLFWwindowcontentscalefun scale;
|
||||||
GLFWmousebuttonfun mouseButton;
|
GLFWmousebuttonfun mouseButton;
|
||||||
GLFWcursorposfun cursorPos;
|
GLFWcursorposfun cursorPos;
|
||||||
GLFWcursorenterfun cursorEnter;
|
GLFWcursorenterfun cursorEnter;
|
||||||
GLFWscrollfun scroll;
|
GLFWscrollfun scroll;
|
||||||
GLFWkeyfun key;
|
GLFWkeyfun key;
|
||||||
GLFWcharfun character;
|
GLFWcharfun character;
|
||||||
GLFWcharmodsfun charmods;
|
GLFWcharmodsfun charmods;
|
||||||
GLFWdropfun drop;
|
GLFWdropfun drop;
|
||||||
} callbacks;
|
} callbacks;
|
||||||
|
|
||||||
// This is defined in the window API's platform.h
|
// This is defined in the window API's platform.h
|
||||||
@@ -424,7 +426,7 @@ struct _GLFWwindow
|
|||||||
//
|
//
|
||||||
struct _GLFWmonitor
|
struct _GLFWmonitor
|
||||||
{
|
{
|
||||||
char name[128];
|
char* name;
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
|
|
||||||
// Physical dimensions in millimeters.
|
// Physical dimensions in millimeters.
|
||||||
@@ -478,15 +480,14 @@ struct _GLFWmapping
|
|||||||
//
|
//
|
||||||
struct _GLFWjoystick
|
struct _GLFWjoystick
|
||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool present;
|
||||||
GLFWbool connected;
|
|
||||||
float* axes;
|
float* axes;
|
||||||
int axisCount;
|
int axisCount;
|
||||||
unsigned char* buttons;
|
unsigned char* buttons;
|
||||||
int buttonCount;
|
int buttonCount;
|
||||||
unsigned char* hats;
|
unsigned char* hats;
|
||||||
int hatCount;
|
int hatCount;
|
||||||
char name[128];
|
char* name;
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
char guid[33];
|
char guid[33];
|
||||||
_GLFWmapping* mapping;
|
_GLFWmapping* mapping;
|
||||||
@@ -571,6 +572,7 @@ struct _GLFWlibrary
|
|||||||
struct {
|
struct {
|
||||||
GLFWmonitorfun monitor;
|
GLFWmonitorfun monitor;
|
||||||
GLFWjoystickfun joystick;
|
GLFWjoystickfun joystick;
|
||||||
|
GLFWkeyboardlayoutfun layout;
|
||||||
} callbacks;
|
} callbacks;
|
||||||
|
|
||||||
// This is defined in the window API's platform.h
|
// This is defined in the window API's platform.h
|
||||||
@@ -611,6 +613,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
|
|||||||
|
|
||||||
const char* _glfwPlatformGetScancodeName(int scancode);
|
const char* _glfwPlatformGetScancodeName(int scancode);
|
||||||
int _glfwPlatformGetKeyScancode(int key);
|
int _glfwPlatformGetKeyScancode(int key);
|
||||||
|
const char* _glfwPlatformGetKeyboardLayoutName(void);
|
||||||
|
|
||||||
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
|
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
|
||||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
|
||||||
@@ -716,10 +719,11 @@ void _glfwInputWindowDamage(_GLFWwindow* window);
|
|||||||
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
|
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
|
||||||
void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor);
|
void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
void _glfwInputKeyboardLayout(void);
|
||||||
void _glfwInputKey(_GLFWwindow* window,
|
void _glfwInputKey(_GLFWwindow* window,
|
||||||
int key, int scancode, int action, int mods);
|
int key, int scancode, int action, int mods);
|
||||||
void _glfwInputChar(_GLFWwindow* window,
|
void _glfwInputChar(_GLFWwindow* window,
|
||||||
uint32_t codepoint, int mods, GLFWbool plain);
|
unsigned int codepoint, int mods, GLFWbool plain);
|
||||||
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
|
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
|
||||||
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
|
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
|
||||||
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
||||||
@@ -762,7 +766,6 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
|
|||||||
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
|
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
|
||||||
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
||||||
|
|
||||||
void _glfwInitGamepadMappings(void);
|
|
||||||
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||||
const char* guid,
|
const char* guid,
|
||||||
int axisCount,
|
int axisCount,
|
||||||
@@ -775,12 +778,7 @@ GLFWbool _glfwInitVulkan(int mode);
|
|||||||
void _glfwTerminateVulkan(void);
|
void _glfwTerminateVulkan(void);
|
||||||
const char* _glfwGetVulkanResultString(VkResult result);
|
const char* _glfwGetVulkanResultString(VkResult result);
|
||||||
|
|
||||||
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint);
|
|
||||||
char** _glfwParseUriList(char* text, int* count);
|
|
||||||
|
|
||||||
char* _glfw_strdup(const char* source);
|
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_fminf(float a, float b);
|
||||||
float _glfw_fmaxf(float a, float b);
|
float _glfw_fmaxf(float a, float b);
|
||||||
|
|
||||||
|
|||||||
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -128,7 +128,7 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
{
|
{
|
||||||
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
if (!_glfw.joysticks[jid].connected)
|
if (!_glfw.joysticks[jid].present)
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
@@ -245,9 +245,9 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
//
|
//
|
||||||
static void closeJoystick(_GLFWjoystick* js)
|
static void closeJoystick(_GLFWjoystick* js)
|
||||||
{
|
{
|
||||||
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
|
||||||
close(js->linjs.fd);
|
close(js->linjs.fd);
|
||||||
_glfwFreeJoystick(js);
|
_glfwFreeJoystick(js);
|
||||||
|
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lexically compare joysticks by name; used by qsort
|
// Lexically compare joysticks by name; used by qsort
|
||||||
@@ -329,7 +329,7 @@ void _glfwTerminateJoysticksLinux(void)
|
|||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
if (js->connected)
|
if (js->present)
|
||||||
closeJoystick(js);
|
closeJoystick(js);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
handleAbsEvent(js, e.code, e.value);
|
handleAbsEvent(js, e.code, e.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return js->connected;
|
return js->present;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
|
|||||||
@@ -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>
|
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_MAPPING_NAME "Linux"
|
#define _GLFW_PLATFORM_MAPPING_NAME "Linux"
|
||||||
#define GLFW_BUILD_LINUX_MAPPINGS
|
|
||||||
|
|
||||||
// Linux-specific joystick data
|
// Linux-specific joystick data
|
||||||
//
|
//
|
||||||
|
|||||||
+297
-822
File diff suppressed because it is too large
Load Diff
+4
-13
@@ -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>
|
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
// all available in SDL_GameControllerDB. Do not edit this file. Any gamepad
|
// all available in SDL_GameControllerDB. Do not edit this file. Any gamepad
|
||||||
// mappings not specific to GLFW should be submitted to SDL_GameControllerDB.
|
// mappings not specific to GLFW should be submitted to SDL_GameControllerDB.
|
||||||
// This file can be re-generated from mappings.h.in and the upstream
|
// This file can be re-generated from mappings.h.in and the upstream
|
||||||
// gamecontrollerdb.txt with the 'update_mappings' CMake target.
|
// gamecontrollerdb.txt with the GenerateMappings.cmake script.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
// All gamepad mappings not labeled GLFW are copied from the
|
// All gamepad mappings not labeled GLFW are copied from the
|
||||||
@@ -60,8 +60,7 @@
|
|||||||
|
|
||||||
const char* _glfwDefaultMappings[] =
|
const char* _glfwDefaultMappings[] =
|
||||||
{
|
{
|
||||||
#if defined(GLFW_BUILD_WIN32_MAPPINGS)
|
@GLFW_GAMEPAD_MAPPINGS@
|
||||||
@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,",
|
"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,",
|
"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,",
|
||||||
"78696e70757403000000000000000000,XInput Arcade Stick (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,",
|
"78696e70757403000000000000000000,XInput Arcade Stick (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 +68,6 @@ const char* _glfwDefaultMappings[] =
|
|||||||
"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,",
|
"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,",
|
"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,",
|
"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
|
NULL
|
||||||
|
|
||||||
#if defined(GLFW_BUILD_COCOA_MAPPINGS)
|
|
||||||
@GLFW_COCOA_MAPPINGS@
|
|
||||||
#endif // GLFW_BUILD_COCOA_MAPPINGS
|
|
||||||
|
|
||||||
#if defined(GLFW_BUILD_LINUX_MAPPINGS)
|
|
||||||
@GLFW_LINUX_MAPPINGS@
|
|
||||||
#endif // GLFW_BUILD_LINUX_MAPPINGS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -170,7 +170,8 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
|||||||
monitor->widthMM = widthMM;
|
monitor->widthMM = widthMM;
|
||||||
monitor->heightMM = heightMM;
|
monitor->heightMM = heightMM;
|
||||||
|
|
||||||
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
if (name)
|
||||||
|
monitor->name = _glfw_strdup(name);
|
||||||
|
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
@@ -188,6 +189,7 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
|||||||
_glfwFreeGammaArrays(&monitor->currentRamp);
|
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||||
|
|
||||||
free(monitor->modes);
|
free(monitor->modes);
|
||||||
|
free(monitor->name);
|
||||||
free(monitor);
|
free(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,8 +523,6 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
|||||||
assert(ramp->green != NULL);
|
assert(ramp->green != NULL);
|
||||||
assert(ramp->blue != NULL);
|
assert(ramp->blue != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
|
||||||
|
|
||||||
if (ramp->size <= 0)
|
if (ramp->size <= 0)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
@@ -531,6 +531,8 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (!monitor->originalRamp.size)
|
if (!monitor->originalRamp.size)
|
||||||
{
|
{
|
||||||
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))
|
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))
|
||||||
|
|||||||
+5
-5
@@ -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>
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -25,10 +25,8 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||||
// SDK versions where one is unavailable or deprecated.
|
// SDK versions where one is unavailable or the other deprecated
|
||||||
// We use the newer names in code and replace them with the older names if
|
// We use the newer names in code and these macros to handle compatibility
|
||||||
// the base SDK does not provide the newer names.
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||||
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||||
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||||
@@ -46,6 +44,7 @@ typedef struct _GLFWcontextNSGL
|
|||||||
{
|
{
|
||||||
id pixelFormat;
|
id pixelFormat;
|
||||||
id object;
|
id object;
|
||||||
|
|
||||||
} _GLFWcontextNSGL;
|
} _GLFWcontextNSGL;
|
||||||
|
|
||||||
// NSGL-specific global data
|
// NSGL-specific global data
|
||||||
@@ -54,6 +53,7 @@ typedef struct _GLFWlibraryNSGL
|
|||||||
{
|
{
|
||||||
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
|
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
|
||||||
CFBundleRef framework;
|
CFBundleRef framework;
|
||||||
|
|
||||||
} _GLFWlibraryNSGL;
|
} _GLFWlibraryNSGL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-9
@@ -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>
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -174,13 +174,6 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||||||
"NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
|
"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;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Context robustness modes (GL_KHR_robustness) are not yet supported by
|
// Context robustness modes (GL_KHR_robustness) are not yet supported by
|
||||||
@@ -365,7 +358,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||||
|
|
||||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return nil;
|
return nil;
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2016 Google Inc.
|
// Copyright (c) 2016 Google Inc.
|
||||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|||||||
+1
-1
@@ -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>
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -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>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2016 Google Inc.
|
// Copyright (c) 2016 Google Inc.
|
||||||
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2016 Google Inc.
|
// Copyright (c) 2016 Google Inc.
|
||||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|||||||
+6
-4
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2016 Google Inc.
|
// Copyright (c) 2016 Google Inc.
|
||||||
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -67,9 +67,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
_glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@@ -313,6 +310,11 @@ int _glfwPlatformGetKeyScancode(int key)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetKeyboardLayoutName(void)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
|
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-16
@@ -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 Google Inc.
|
||||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -124,8 +124,6 @@ GLFWbool _glfwInitOSMesa(void)
|
|||||||
"libOSMesa.8.dylib",
|
"libOSMesa.8.dylib",
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libOSMesa-8.so",
|
"libOSMesa-8.so",
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
"libOSMesa.so",
|
|
||||||
#else
|
#else
|
||||||
"libOSMesa.so.8",
|
"libOSMesa.so.8",
|
||||||
"libOSMesa.so.6",
|
"libOSMesa.so.6",
|
||||||
@@ -304,12 +302,6 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width,
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!OSMesaGetColorBuffer(window->context.osmesa.handle,
|
if (!OSMesaGetColorBuffer(window->context.osmesa.handle,
|
||||||
&mesaWidth, &mesaHeight,
|
&mesaWidth, &mesaHeight,
|
||||||
&mesaFormat, &mesaBuffer))
|
&mesaFormat, &mesaBuffer))
|
||||||
@@ -343,12 +335,6 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle,
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!OSMesaGetDepthBuffer(window->context.osmesa.handle,
|
if (!OSMesaGetDepthBuffer(window->context.osmesa.handle,
|
||||||
&mesaWidth, &mesaHeight,
|
&mesaWidth, &mesaHeight,
|
||||||
&mesaBytes, &mesaBuffer))
|
&mesaBytes, &mesaBuffer))
|
||||||
@@ -375,7 +361,7 @@ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -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 Google Inc.
|
||||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -66,6 +66,7 @@ typedef struct _GLFWcontextOSMesa
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
void* buffer;
|
void* buffer;
|
||||||
|
|
||||||
} _GLFWcontextOSMesa;
|
} _GLFWcontextOSMesa;
|
||||||
|
|
||||||
// OSMesa-specific global data
|
// OSMesa-specific global data
|
||||||
@@ -81,6 +82,7 @@ typedef struct _GLFWlibraryOSMesa
|
|||||||
PFN_OSMesaGetColorBuffer GetColorBuffer;
|
PFN_OSMesaGetColorBuffer GetColorBuffer;
|
||||||
PFN_OSMesaGetDepthBuffer GetDepthBuffer;
|
PFN_OSMesaGetDepthBuffer GetDepthBuffer;
|
||||||
PFN_OSMesaGetProcAddress GetProcAddress;
|
PFN_OSMesaGetProcAddress GetProcAddress;
|
||||||
|
|
||||||
} _GLFWlibraryOSMesa;
|
} _GLFWlibraryOSMesa;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|||||||
+3
-1
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -37,6 +37,7 @@ typedef struct _GLFWtlsPOSIX
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
pthread_key_t key;
|
pthread_key_t key;
|
||||||
|
|
||||||
} _GLFWtlsPOSIX;
|
} _GLFWtlsPOSIX;
|
||||||
|
|
||||||
// POSIX-specific mutex data
|
// POSIX-specific mutex data
|
||||||
@@ -45,5 +46,6 @@ typedef struct _GLFWmutexPOSIX
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
pthread_mutex_t handle;
|
pthread_mutex_t handle;
|
||||||
|
|
||||||
} _GLFWmutexPOSIX;
|
} _GLFWmutexPOSIX;
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -27,8 +27,11 @@
|
|||||||
// It is fine to use C99 in this file because it will not be built with VS
|
// It is fine to use C99 in this file because it will not be built with VS
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
|
#define _POSIX_C_SOURCE 199309L
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -41,7 +44,7 @@
|
|||||||
//
|
//
|
||||||
void _glfwInitTimerPOSIX(void)
|
void _glfwInitTimerPOSIX(void)
|
||||||
{
|
{
|
||||||
#if defined(CLOCK_MONOTONIC)
|
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
||||||
@@ -64,7 +67,7 @@ void _glfwInitTimerPOSIX(void)
|
|||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerValue(void)
|
uint64_t _glfwPlatformGetTimerValue(void)
|
||||||
{
|
{
|
||||||
#if defined(CLOCK_MONOTONIC)
|
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
|
||||||
if (_glfw.timer.posix.monotonic)
|
if (_glfw.timer.posix.monotonic)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|||||||
+2
-1
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -36,6 +36,7 @@ typedef struct _GLFWtimerPOSIX
|
|||||||
{
|
{
|
||||||
GLFWbool monotonic;
|
GLFWbool monotonic;
|
||||||
uint64_t frequency;
|
uint64_t frequency;
|
||||||
|
|
||||||
} _GLFWtimerPOSIX;
|
} _GLFWtimerPOSIX;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -59,8 +59,6 @@ GLFWbool _glfwInitVulkan(int mode)
|
|||||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
|
_glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
|
||||||
if (!_glfw.vk.handle)
|
if (!_glfw.vk.handle)
|
||||||
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
|
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
|
_glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-8
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -165,9 +165,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
|
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
u->redBits = findAttribValue(WGL_RED_BITS_ARB);
|
u->redBits = findAttribValue(WGL_RED_BITS_ARB);
|
||||||
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
|
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
|
||||||
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
|
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
|
||||||
@@ -185,6 +182,8 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (findAttribValue(WGL_STEREO_ARB))
|
if (findAttribValue(WGL_STEREO_ARB))
|
||||||
u->stereo = GLFW_TRUE;
|
u->stereo = GLFW_TRUE;
|
||||||
|
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB))
|
||||||
|
u->doublebuffer = GLFW_TRUE;
|
||||||
|
|
||||||
if (_glfw.wgl.ARB_multisample)
|
if (_glfw.wgl.ARB_multisample)
|
||||||
u->samples = findAttribValue(WGL_SAMPLES_ARB);
|
u->samples = findAttribValue(WGL_SAMPLES_ARB);
|
||||||
@@ -240,9 +239,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
if (pfd.iPixelType != PFD_TYPE_RGBA)
|
if (pfd.iPixelType != PFD_TYPE_RGBA)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
u->redBits = pfd.cRedBits;
|
u->redBits = pfd.cRedBits;
|
||||||
u->greenBits = pfd.cGreenBits;
|
u->greenBits = pfd.cGreenBits;
|
||||||
u->blueBits = pfd.cBlueBits;
|
u->blueBits = pfd.cBlueBits;
|
||||||
@@ -260,6 +256,8 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (pfd.dwFlags & PFD_STEREO)
|
if (pfd.dwFlags & PFD_STEREO)
|
||||||
u->stereo = GLFW_TRUE;
|
u->stereo = GLFW_TRUE;
|
||||||
|
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
|
||||||
|
u->doublebuffer = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->handle = pixelFormat;
|
u->handle = pixelFormat;
|
||||||
@@ -787,7 +785,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
+3
-1
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -115,6 +115,7 @@ typedef struct _GLFWcontextWGL
|
|||||||
HDC dc;
|
HDC dc;
|
||||||
HGLRC handle;
|
HGLRC handle;
|
||||||
int interval;
|
int interval;
|
||||||
|
|
||||||
} _GLFWcontextWGL;
|
} _GLFWcontextWGL;
|
||||||
|
|
||||||
// WGL-specific global data
|
// WGL-specific global data
|
||||||
@@ -147,6 +148,7 @@ typedef struct _GLFWlibraryWGL
|
|||||||
GLFWbool ARB_create_context_robustness;
|
GLFWbool ARB_create_context_robustness;
|
||||||
GLFWbool ARB_create_context_no_error;
|
GLFWbool ARB_create_context_no_error;
|
||||||
GLFWbool ARB_context_flush_control;
|
GLFWbool ARB_context_flush_control;
|
||||||
|
|
||||||
} _GLFWlibraryWGL;
|
} _GLFWlibraryWGL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-21
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -39,10 +39,6 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID =
|
|||||||
|
|
||||||
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
|
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
|
||||||
|
|
||||||
#if defined(_GLFW_BUILD_DLL)
|
|
||||||
#pragma message("These symbols must be exported by the executable and have no effect in a DLL")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Executables (but not DLLs) exporting this symbol with this value will be
|
// Executables (but not DLLs) exporting this symbol with this value will be
|
||||||
// automatically directed to the high-performance GPU on Nvidia Optimus systems
|
// automatically directed to the high-performance GPU on Nvidia Optimus systems
|
||||||
// with up-to-date drivers
|
// with up-to-date drivers
|
||||||
@@ -72,16 +68,17 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
|||||||
//
|
//
|
||||||
static GLFWbool loadLibraries(void)
|
static GLFWbool loadLibraries(void)
|
||||||
{
|
{
|
||||||
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
|
_glfw.win32.winmm.instance = LoadLibraryA("winmm.dll");
|
||||||
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
if (!_glfw.win32.winmm.instance)
|
||||||
(const WCHAR*) &_glfw,
|
|
||||||
(HMODULE*) &_glfw.win32.instance))
|
|
||||||
{
|
{
|
||||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve own module handle");
|
"Win32: Failed to load winmm.dll");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfw.win32.winmm.GetTime = (PFN_timeGetTime)
|
||||||
|
GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime");
|
||||||
|
|
||||||
_glfw.win32.user32.instance = LoadLibraryA("user32.dll");
|
_glfw.win32.user32.instance = LoadLibraryA("user32.dll");
|
||||||
if (!_glfw.win32.user32.instance)
|
if (!_glfw.win32.user32.instance)
|
||||||
{
|
{
|
||||||
@@ -102,8 +99,6 @@ static GLFWbool loadLibraries(void)
|
|||||||
GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow");
|
GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow");
|
||||||
_glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi)
|
_glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi)
|
||||||
GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
|
GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
|
||||||
_glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
|
|
||||||
GetProcAddress(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
|
|
||||||
|
|
||||||
_glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll");
|
_glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll");
|
||||||
if (_glfw.win32.dinput8.instance)
|
if (_glfw.win32.dinput8.instance)
|
||||||
@@ -148,8 +143,6 @@ static GLFWbool loadLibraries(void)
|
|||||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
|
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
|
||||||
_glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
|
_glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
|
||||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
|
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
|
||||||
_glfw.win32.dwmapi.GetColorizationColor = (PFN_DwmGetColorizationColor)
|
|
||||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
|
_glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
|
||||||
@@ -181,6 +174,9 @@ static void freeLibraries(void)
|
|||||||
if (_glfw.win32.dinput8.instance)
|
if (_glfw.win32.dinput8.instance)
|
||||||
FreeLibrary(_glfw.win32.dinput8.instance);
|
FreeLibrary(_glfw.win32.dinput8.instance);
|
||||||
|
|
||||||
|
if (_glfw.win32.winmm.instance)
|
||||||
|
FreeLibrary(_glfw.win32.winmm.instance);
|
||||||
|
|
||||||
if (_glfw.win32.user32.instance)
|
if (_glfw.win32.user32.instance)
|
||||||
FreeLibrary(_glfw.win32.user32.instance);
|
FreeLibrary(_glfw.win32.user32.instance);
|
||||||
|
|
||||||
@@ -264,6 +260,7 @@ static void createKeyTables(void)
|
|||||||
_glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN;
|
_glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN;
|
||||||
_glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP;
|
_glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP;
|
||||||
_glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE;
|
_glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE;
|
||||||
|
_glfw.win32.keycodes[0x146] = GLFW_KEY_PAUSE;
|
||||||
_glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE;
|
_glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE;
|
||||||
_glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB;
|
_glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB;
|
||||||
_glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK;
|
_glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK;
|
||||||
@@ -345,7 +342,7 @@ static GLFWbool createHelperWindow(void)
|
|||||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||||
0, 0, 1, 1,
|
0, 0, 1, 1,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_glfw.win32.instance,
|
GetModuleHandleW(NULL),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!_glfw.win32.helperWindowHandle)
|
if (!_glfw.win32.helperWindowHandle)
|
||||||
@@ -495,7 +492,7 @@ void _glfwUpdateKeyNamesWin32(void)
|
|||||||
vk = vks[key - GLFW_KEY_KP_0];
|
vk = vks[key - GLFW_KEY_KP_0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vk = MapVirtualKeyW(scancode, MAPVK_VSC_TO_VK);
|
vk = MapVirtualKey(scancode, MAPVK_VSC_TO_VK);
|
||||||
|
|
||||||
length = ToUnicode(vk, scancode, state,
|
length = ToUnicode(vk, scancode, state,
|
||||||
chars, sizeof(chars) / sizeof(WCHAR),
|
chars, sizeof(chars) / sizeof(WCHAR),
|
||||||
@@ -503,8 +500,6 @@ void _glfwUpdateKeyNamesWin32(void)
|
|||||||
|
|
||||||
if (length == -1)
|
if (length == -1)
|
||||||
{
|
{
|
||||||
// This is a dead key, so we need a second simulated key press
|
|
||||||
// to make it output its own character (usually a diacritic)
|
|
||||||
length = ToUnicode(vk, scancode, state,
|
length = ToUnicode(vk, scancode, state,
|
||||||
chars, sizeof(chars) / sizeof(WCHAR),
|
chars, sizeof(chars) / sizeof(WCHAR),
|
||||||
0);
|
0);
|
||||||
@@ -520,8 +515,7 @@ void _glfwUpdateKeyNamesWin32(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replacement for IsWindowsVersionOrGreater, as we cannot rely on the
|
// Replacement for IsWindowsVersionOrGreater as MinGW lacks versionhelpers.h
|
||||||
// application having a correct embedded manifest
|
|
||||||
//
|
//
|
||||||
BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
||||||
{
|
{
|
||||||
@@ -608,11 +602,11 @@ void _glfwPlatformTerminate(void)
|
|||||||
SPIF_SENDCHANGE);
|
SPIF_SENDCHANGE);
|
||||||
|
|
||||||
free(_glfw.win32.clipboardString);
|
free(_glfw.win32.clipboardString);
|
||||||
|
free(_glfw.win32.keyboardLayoutName);
|
||||||
free(_glfw.win32.rawInput);
|
free(_glfw.win32.rawInput);
|
||||||
|
|
||||||
_glfwTerminateWGL();
|
_glfwTerminateWGL();
|
||||||
_glfwTerminateEGL();
|
_glfwTerminateEGL();
|
||||||
_glfwTerminateOSMesa();
|
|
||||||
|
|
||||||
_glfwTerminateJoysticksWin32();
|
_glfwTerminateJoysticksWin32();
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -256,8 +256,6 @@ static GLFWbool supportsXInput(const GUID* guid)
|
|||||||
//
|
//
|
||||||
static void closeJoystick(_GLFWjoystick* js)
|
static void closeJoystick(_GLFWjoystick* js)
|
||||||
{
|
{
|
||||||
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
|
||||||
|
|
||||||
if (js->win32.device)
|
if (js->win32.device)
|
||||||
{
|
{
|
||||||
IDirectInputDevice8_Unacquire(js->win32.device);
|
IDirectInputDevice8_Unacquire(js->win32.device);
|
||||||
@@ -265,7 +263,9 @@ static void closeJoystick(_GLFWjoystick* js)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(js->win32.objects);
|
free(js->win32.objects);
|
||||||
|
|
||||||
_glfwFreeJoystick(js);
|
_glfwFreeJoystick(js);
|
||||||
|
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DirectInput device object enumeration callback
|
// DirectInput device object enumeration callback
|
||||||
@@ -356,8 +356,8 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
js = _glfw.joysticks + jid;
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
if (js->connected)
|
if (js->present)
|
||||||
{
|
{
|
||||||
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
|
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
|
||||||
return DIENUM_CONTINUE;
|
return DIENUM_CONTINUE;
|
||||||
@@ -497,7 +497,7 @@ void _glfwInitJoysticksWin32(void)
|
|||||||
{
|
{
|
||||||
if (_glfw.win32.dinput8.instance)
|
if (_glfw.win32.dinput8.instance)
|
||||||
{
|
{
|
||||||
if (FAILED(DirectInput8Create(_glfw.win32.instance,
|
if (FAILED(DirectInput8Create(GetModuleHandle(NULL),
|
||||||
DIRECTINPUT_VERSION,
|
DIRECTINPUT_VERSION,
|
||||||
&IID_IDirectInput8W,
|
&IID_IDirectInput8W,
|
||||||
(void**) &_glfw.win32.dinput8.api,
|
(void**) &_glfw.win32.dinput8.api,
|
||||||
@@ -541,7 +541,7 @@ void _glfwDetectJoystickConnectionWin32(void)
|
|||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
if (_glfw.joysticks[jid].connected &&
|
if (_glfw.joysticks[jid].present &&
|
||||||
_glfw.joysticks[jid].win32.device == NULL &&
|
_glfw.joysticks[jid].win32.device == NULL &&
|
||||||
_glfw.joysticks[jid].win32.index == index)
|
_glfw.joysticks[jid].win32.index == index)
|
||||||
{
|
{
|
||||||
@@ -593,7 +593,7 @@ void _glfwDetectJoystickDisconnectionWin32(void)
|
|||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
if (js->connected)
|
if (js->present)
|
||||||
_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
|
_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
{
|
{
|
||||||
int i, ai = 0, bi = 0, pi = 0;
|
int i, ai = 0, bi = 0, pi = 0;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DIJOYSTATE state = {0};
|
DIJOYSTATE state;
|
||||||
|
|
||||||
IDirectInputDevice8_Poll(js->win32.device);
|
IDirectInputDevice8_Poll(js->win32.device);
|
||||||
result = IDirectInputDevice8_GetDeviceState(js->win32.device,
|
result = IDirectInputDevice8_GetDeviceState(js->win32.device,
|
||||||
@@ -672,11 +672,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Screams of horror are appropriate at this point
|
// Screams of horror are appropriate at this point
|
||||||
int stateIndex = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
|
int state = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
|
||||||
if (stateIndex < 0 || stateIndex > 8)
|
if (state < 0 || state > 8)
|
||||||
stateIndex = 8;
|
state = 8;
|
||||||
|
|
||||||
_glfwInputJoystickHat(js, pi, states[stateIndex]);
|
_glfwInputJoystickHat(js, pi, states[state]);
|
||||||
pi++;
|
pi++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
//
|
//
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
||||||
#define GLFW_BUILD_WIN32_MAPPINGS
|
|
||||||
|
|
||||||
// Joystick element (axis, button or slider)
|
// Joystick element (axis, button or slider)
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-16
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -185,8 +185,6 @@ void _glfwPollMonitorsWin32(void)
|
|||||||
display.DeviceName) == 0)
|
display.DeviceName) == 0)
|
||||||
{
|
{
|
||||||
disconnected[i] = NULL;
|
disconnected[i] = NULL;
|
||||||
// handle may have changed, update
|
|
||||||
EnumDisplayMonitors(NULL, NULL, monitorCallback, (LPARAM) _glfw.monitors[i]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,19 +316,8 @@ void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* ysc
|
|||||||
{
|
{
|
||||||
UINT xdpi, ydpi;
|
UINT xdpi, ydpi;
|
||||||
|
|
||||||
if (xscale)
|
|
||||||
*xscale = 0.f;
|
|
||||||
if (yscale)
|
|
||||||
*yscale = 0.f;
|
|
||||||
|
|
||||||
if (IsWindows8Point1OrGreater())
|
if (IsWindows8Point1OrGreater())
|
||||||
{
|
GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi);
|
||||||
if (GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query monitor DPI");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const HDC dc = GetDC(NULL);
|
const HDC dc = GetDC(NULL);
|
||||||
@@ -382,7 +369,7 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
|
|||||||
int* width, int* height)
|
int* width, int* height)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
GetMonitorInfoW(monitor->win32.handle, &mi);
|
GetMonitorInfo(monitor->win32.handle, &mi);
|
||||||
|
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = mi.rcWork.left;
|
*xpos = mi.rcWork.left;
|
||||||
|
|||||||
+24
-22
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
// example to allow applications to correctly declare a GL_ARB_debug_output
|
||||||
// but windows.h assumes no one will define APIENTRY before it does
|
// callback) but windows.h assumes no one will define APIENTRY before it does
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
|
|
||||||
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
||||||
@@ -77,9 +77,6 @@
|
|||||||
#ifndef WM_DWMCOMPOSITIONCHANGED
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
||||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
||||||
#endif
|
#endif
|
||||||
#ifndef WM_DWMCOLORIZATIONCOLORCHANGED
|
|
||||||
#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
|
|
||||||
#endif
|
|
||||||
#ifndef WM_COPYGLOBALDATA
|
#ifndef WM_COPYGLOBALDATA
|
||||||
#define WM_COPYGLOBALDATA 0x0049
|
#define WM_COPYGLOBALDATA 0x0049
|
||||||
#endif
|
#endif
|
||||||
@@ -102,7 +99,7 @@
|
|||||||
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32_WINNT_WINBLUE
|
#ifndef _WIN32_WINNT_WINBLUE
|
||||||
#define _WIN32_WINNT_WINBLUE 0x0603
|
#define _WIN32_WINNT_WINBLUE 0x0602
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32_WINNT_WIN8
|
#ifndef _WIN32_WINNT_WIN8
|
||||||
#define _WIN32_WINNT_WIN8 0x0602
|
#define _WIN32_WINNT_WIN8 0x0602
|
||||||
@@ -162,9 +159,7 @@ typedef enum
|
|||||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
|
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
|
||||||
#endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
|
#endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
|
||||||
|
|
||||||
// Replacement for versionhelpers.h macros, as we cannot rely on the
|
// HACK: Define versionhelpers.h functions manually as MinGW lacks the header
|
||||||
// application having a correct embedded manifest
|
|
||||||
//
|
|
||||||
#define IsWindowsXPOrGreater() \
|
#define IsWindowsXPOrGreater() \
|
||||||
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \
|
||||||
LOBYTE(_WIN32_WINNT_WINXP), 0)
|
LOBYTE(_WIN32_WINNT_WINXP), 0)
|
||||||
@@ -220,6 +215,10 @@ typedef enum
|
|||||||
#define DIDFT_OPTIONAL 0x80000000
|
#define DIDFT_OPTIONAL 0x80000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// winmm.dll function pointer typedefs
|
||||||
|
typedef DWORD (WINAPI * PFN_timeGetTime)(void);
|
||||||
|
#define timeGetTime _glfw.win32.winmm.GetTime
|
||||||
|
|
||||||
// xinput.dll function pointer typedefs
|
// xinput.dll function pointer typedefs
|
||||||
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
|
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
|
||||||
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
|
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
|
||||||
@@ -237,24 +236,20 @@ typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND);
|
|||||||
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
|
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
|
||||||
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
|
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
|
||||||
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
|
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
|
||||||
typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT);
|
|
||||||
#define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
|
#define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
|
||||||
#define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
|
#define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
|
||||||
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
|
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
|
||||||
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
|
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
|
||||||
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
|
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
|
||||||
#define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
|
#define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
|
||||||
#define GetSystemMetricsForDpi _glfw.win32.user32.GetSystemMetricsForDpi_
|
|
||||||
|
|
||||||
// dwmapi.dll function pointer typedefs
|
// dwmapi.dll function pointer typedefs
|
||||||
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
||||||
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
|
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
|
||||||
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
|
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
|
||||||
typedef HRESULT (WINAPI * PFN_DwmGetColorizationColor)(DWORD*,BOOL*);
|
|
||||||
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
|
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
|
||||||
#define DwmFlush _glfw.win32.dwmapi.Flush
|
#define DwmFlush _glfw.win32.dwmapi.Flush
|
||||||
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
|
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
|
||||||
#define DwmGetColorizationColor _glfw.win32.dwmapi.GetColorizationColor
|
|
||||||
|
|
||||||
// shcore.dll function pointer typedefs
|
// shcore.dll function pointer typedefs
|
||||||
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
|
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
|
||||||
@@ -320,26 +315,23 @@ typedef struct _GLFWwindowWin32
|
|||||||
// Whether to enable framebuffer transparency on DWM
|
// Whether to enable framebuffer transparency on DWM
|
||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
GLFWbool scaleToMonitor;
|
GLFWbool scaleToMonitor;
|
||||||
|
GLFWbool keymenu;
|
||||||
// Cached size used to filter out duplicate events
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
// The last received cursor position, regardless of source
|
// The last received cursor position, regardless of source
|
||||||
int lastCursorPosX, lastCursorPosY;
|
int lastCursorPosX, lastCursorPosY;
|
||||||
// The last recevied high surrogate when decoding pairs of UTF-16 messages
|
|
||||||
WCHAR highSurrogate;
|
|
||||||
} _GLFWwindowWin32;
|
} _GLFWwindowWin32;
|
||||||
|
|
||||||
// Win32-specific global data
|
// Win32-specific global data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWlibraryWin32
|
typedef struct _GLFWlibraryWin32
|
||||||
{
|
{
|
||||||
HINSTANCE instance;
|
|
||||||
HWND helperWindowHandle;
|
HWND helperWindowHandle;
|
||||||
HDEVNOTIFY deviceNotificationHandle;
|
HDEVNOTIFY deviceNotificationHandle;
|
||||||
DWORD foregroundLockTimeout;
|
DWORD foregroundLockTimeout;
|
||||||
int acquiredMonitorCount;
|
int acquiredMonitorCount;
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
char* keyboardLayoutName;
|
||||||
short int keycodes[512];
|
short int keycodes[512];
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
char keynames[GLFW_KEY_LAST + 1][5];
|
char keynames[GLFW_KEY_LAST + 1][5];
|
||||||
@@ -351,6 +343,11 @@ typedef struct _GLFWlibraryWin32
|
|||||||
int rawInputSize;
|
int rawInputSize;
|
||||||
UINT mouseTrailSize;
|
UINT mouseTrailSize;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
HINSTANCE instance;
|
||||||
|
PFN_timeGetTime GetTime;
|
||||||
|
} winmm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
HINSTANCE instance;
|
HINSTANCE instance;
|
||||||
PFN_DirectInput8Create Create;
|
PFN_DirectInput8Create Create;
|
||||||
@@ -371,7 +368,6 @@ typedef struct _GLFWlibraryWin32
|
|||||||
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
|
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
|
||||||
PFN_GetDpiForWindow GetDpiForWindow_;
|
PFN_GetDpiForWindow GetDpiForWindow_;
|
||||||
PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
|
PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
|
||||||
PFN_GetSystemMetricsForDpi GetSystemMetricsForDpi_;
|
|
||||||
} user32;
|
} user32;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -379,7 +375,6 @@ typedef struct _GLFWlibraryWin32
|
|||||||
PFN_DwmIsCompositionEnabled IsCompositionEnabled;
|
PFN_DwmIsCompositionEnabled IsCompositionEnabled;
|
||||||
PFN_DwmFlush Flush;
|
PFN_DwmFlush Flush;
|
||||||
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
|
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
|
||||||
PFN_DwmGetColorizationColor GetColorizationColor;
|
|
||||||
} dwmapi;
|
} dwmapi;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -392,6 +387,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
HINSTANCE instance;
|
HINSTANCE instance;
|
||||||
PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
|
PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
|
||||||
} ntdll;
|
} ntdll;
|
||||||
|
|
||||||
} _GLFWlibraryWin32;
|
} _GLFWlibraryWin32;
|
||||||
|
|
||||||
// Win32-specific per-monitor data
|
// Win32-specific per-monitor data
|
||||||
@@ -406,6 +402,7 @@ typedef struct _GLFWmonitorWin32
|
|||||||
char publicDisplayName[32];
|
char publicDisplayName[32];
|
||||||
GLFWbool modesPruned;
|
GLFWbool modesPruned;
|
||||||
GLFWbool modeChanged;
|
GLFWbool modeChanged;
|
||||||
|
|
||||||
} _GLFWmonitorWin32;
|
} _GLFWmonitorWin32;
|
||||||
|
|
||||||
// Win32-specific per-cursor data
|
// Win32-specific per-cursor data
|
||||||
@@ -413,13 +410,16 @@ typedef struct _GLFWmonitorWin32
|
|||||||
typedef struct _GLFWcursorWin32
|
typedef struct _GLFWcursorWin32
|
||||||
{
|
{
|
||||||
HCURSOR handle;
|
HCURSOR handle;
|
||||||
|
|
||||||
} _GLFWcursorWin32;
|
} _GLFWcursorWin32;
|
||||||
|
|
||||||
// Win32-specific global timer data
|
// Win32-specific global timer data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWtimerWin32
|
typedef struct _GLFWtimerWin32
|
||||||
{
|
{
|
||||||
|
GLFWbool hasPC;
|
||||||
uint64_t frequency;
|
uint64_t frequency;
|
||||||
|
|
||||||
} _GLFWtimerWin32;
|
} _GLFWtimerWin32;
|
||||||
|
|
||||||
// Win32-specific thread local storage data
|
// Win32-specific thread local storage data
|
||||||
@@ -428,6 +428,7 @@ typedef struct _GLFWtlsWin32
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
DWORD index;
|
DWORD index;
|
||||||
|
|
||||||
} _GLFWtlsWin32;
|
} _GLFWtlsWin32;
|
||||||
|
|
||||||
// Win32-specific mutex data
|
// Win32-specific mutex data
|
||||||
@@ -436,6 +437,7 @@ typedef struct _GLFWmutexWin32
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
CRITICAL_SECTION section;
|
CRITICAL_SECTION section;
|
||||||
|
|
||||||
} _GLFWmutexWin32;
|
} _GLFWmutexWin32;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|||||||
+21
-5
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -38,7 +38,18 @@
|
|||||||
//
|
//
|
||||||
void _glfwInitTimerWin32(void)
|
void _glfwInitTimerWin32(void)
|
||||||
{
|
{
|
||||||
QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency);
|
uint64_t frequency;
|
||||||
|
|
||||||
|
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
|
||||||
|
{
|
||||||
|
_glfw.timer.win32.hasPC = GLFW_TRUE;
|
||||||
|
_glfw.timer.win32.frequency = frequency;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfw.timer.win32.hasPC = GLFW_FALSE;
|
||||||
|
_glfw.timer.win32.frequency = 1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,9 +59,14 @@ void _glfwInitTimerWin32(void)
|
|||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerValue(void)
|
uint64_t _glfwPlatformGetTimerValue(void)
|
||||||
{
|
{
|
||||||
uint64_t value;
|
if (_glfw.timer.win32.hasPC)
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
{
|
||||||
return value;
|
uint64_t value;
|
||||||
|
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (uint64_t) timeGetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerFrequency(void)
|
uint64_t _glfwPlatformGetTimerFrequency(void)
|
||||||
|
|||||||
+142
-230
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -377,17 +377,12 @@ static void updateWindowStyles(const _GLFWwindow* window)
|
|||||||
//
|
//
|
||||||
static void updateFramebufferTransparency(const _GLFWwindow* window)
|
static void updateFramebufferTransparency(const _GLFWwindow* window)
|
||||||
{
|
{
|
||||||
BOOL composition, opaque;
|
BOOL enabled;
|
||||||
DWORD color;
|
|
||||||
|
|
||||||
if (!IsWindowsVistaOrGreater())
|
if (!IsWindowsVistaOrGreater())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
|
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
|
||||||
return;
|
|
||||||
|
|
||||||
if (IsWindows8OrGreater() ||
|
|
||||||
(SUCCEEDED(DwmGetColorizationColor(&color, &opaque)) && !opaque))
|
|
||||||
{
|
{
|
||||||
HRGN region = CreateRectRgn(0, 0, -1, -1);
|
HRGN region = CreateRectRgn(0, 0, -1, -1);
|
||||||
DWM_BLURBEHIND bb = {0};
|
DWM_BLURBEHIND bb = {0};
|
||||||
@@ -395,18 +390,37 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
|
|||||||
bb.hRgnBlur = region;
|
bb.hRgnBlur = region;
|
||||||
bb.fEnable = TRUE;
|
bb.fEnable = TRUE;
|
||||||
|
|
||||||
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
|
if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb)))
|
||||||
|
{
|
||||||
|
// Decorated windows don't repaint the transparent background
|
||||||
|
// leaving a trail behind animations
|
||||||
|
// HACK: Making the window layered with a transparency color key
|
||||||
|
// seems to fix this. Normally, when specifying
|
||||||
|
// a transparency color key to be used when composing the
|
||||||
|
// layered window, all pixels painted by the window in this
|
||||||
|
// color will be transparent. That doesn't seem to be the
|
||||||
|
// case anymore, at least when used with blur behind window
|
||||||
|
// plus negative region.
|
||||||
|
LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
||||||
|
exStyle |= WS_EX_LAYERED;
|
||||||
|
SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
|
||||||
|
|
||||||
|
// Using a color key not equal to black to fix the trailing
|
||||||
|
// issue. When set to black, something is making the hit test
|
||||||
|
// not resize with the window frame.
|
||||||
|
SetLayeredWindowAttributes(window->win32.handle,
|
||||||
|
RGB(255, 0, 255), 255, LWA_COLORKEY);
|
||||||
|
}
|
||||||
|
|
||||||
DeleteObject(region);
|
DeleteObject(region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// HACK: Disable framebuffer transparency on Windows 7 when the
|
LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
||||||
// colorization color is opaque, because otherwise the window
|
exStyle &= ~WS_EX_LAYERED;
|
||||||
// contents is blended additively with the previous frame instead
|
SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
|
||||||
// of replacing it
|
RedrawWindow(window->win32.handle, NULL, NULL,
|
||||||
DWM_BLURBEHIND bb = {0};
|
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
|
||||||
bb.dwFlags = DWM_BB_ENABLE;
|
|
||||||
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +449,7 @@ static int getKeyMods(void)
|
|||||||
static void fitToMonitor(_GLFWwindow* window)
|
static void fitToMonitor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
GetMonitorInfoW(window->monitor->win32.handle, &mi);
|
GetMonitorInfo(window->monitor->win32.handle, &mi);
|
||||||
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
||||||
mi.rcMonitor.left,
|
mi.rcMonitor.left,
|
||||||
mi.rcMonitor.top,
|
mi.rcMonitor.top,
|
||||||
@@ -456,8 +470,8 @@ static void acquireMonitor(_GLFWwindow* window)
|
|||||||
// the OpenGL ICD switches to page flipping
|
// the OpenGL ICD switches to page flipping
|
||||||
if (IsWindowsXPOrGreater())
|
if (IsWindowsXPOrGreater())
|
||||||
{
|
{
|
||||||
SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
|
SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
|
||||||
SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0);
|
SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,63 +496,13 @@ static void releaseMonitor(_GLFWwindow* window)
|
|||||||
|
|
||||||
// HACK: Restore mouse trail length saved in acquireMonitor
|
// HACK: Restore mouse trail length saved in acquireMonitor
|
||||||
if (IsWindowsXPOrGreater())
|
if (IsWindowsXPOrGreater())
|
||||||
SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
|
SystemParametersInfo(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputMonitorWindow(window->monitor, NULL);
|
_glfwInputMonitorWindow(window->monitor, NULL);
|
||||||
_glfwRestoreVideoModeWin32(window->monitor);
|
_glfwRestoreVideoModeWin32(window->monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually maximize the window, for when SW_MAXIMIZE cannot be used
|
|
||||||
//
|
|
||||||
static void maximizeWindowManually(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
RECT rect;
|
|
||||||
DWORD style;
|
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
|
||||||
|
|
||||||
GetMonitorInfoW(MonitorFromWindow(window->win32.handle,
|
|
||||||
MONITOR_DEFAULTTONEAREST), &mi);
|
|
||||||
|
|
||||||
rect = mi.rcWork;
|
|
||||||
|
|
||||||
if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
|
|
||||||
{
|
|
||||||
rect.right = _glfw_min(rect.right, rect.left + window->maxwidth);
|
|
||||||
rect.bottom = _glfw_min(rect.bottom, rect.top + window->maxheight);
|
|
||||||
}
|
|
||||||
|
|
||||||
style = GetWindowLongW(window->win32.handle, GWL_STYLE);
|
|
||||||
style |= WS_MAXIMIZE;
|
|
||||||
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
|
|
||||||
|
|
||||||
if (window->decorated)
|
|
||||||
{
|
|
||||||
const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
|
||||||
|
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
|
||||||
{
|
|
||||||
const UINT dpi = GetDpiForWindow(window->win32.handle);
|
|
||||||
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
|
|
||||||
OffsetRect(&rect, 0, GetSystemMetricsForDpi(SM_CYCAPTION, dpi));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
|
||||||
OffsetRect(&rect, 0, GetSystemMetrics(SM_CYCAPTION));
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.bottom = _glfw_min(rect.bottom, mi.rcWork.bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetWindowPos(window->win32.handle, HWND_TOP,
|
|
||||||
rect.left,
|
|
||||||
rect.top,
|
|
||||||
rect.right - rect.left,
|
|
||||||
rect.bottom - rect.top,
|
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Window callback function (handles window messages)
|
// Window callback function (handles window messages)
|
||||||
//
|
//
|
||||||
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
@@ -555,17 +519,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_NCCREATE:
|
case WM_NCCREATE:
|
||||||
{
|
{
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
{
|
EnableNonClientDpiScaling(hWnd);
|
||||||
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;
|
break;
|
||||||
}
|
}
|
||||||
@@ -672,7 +626,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
// User trying to access application menu using ALT?
|
// User trying to access application menu using ALT?
|
||||||
case SC_KEYMENU:
|
case SC_KEYMENU:
|
||||||
return 0;
|
{
|
||||||
|
if (!window->win32.keymenu)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -686,40 +645,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_INPUTLANGCHANGE:
|
case WM_INPUTLANGCHANGE:
|
||||||
{
|
{
|
||||||
_glfwUpdateKeyNamesWin32();
|
_glfwUpdateKeyNamesWin32();
|
||||||
|
_glfwInputKeyboardLayout();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
case WM_SYSCHAR:
|
case WM_SYSCHAR:
|
||||||
{
|
|
||||||
if (wParam >= 0xd800 && wParam <= 0xdbff)
|
|
||||||
window->win32.highSurrogate = (WCHAR) wParam;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint32_t codepoint = 0;
|
|
||||||
|
|
||||||
if (wParam >= 0xdc00 && wParam <= 0xdfff)
|
|
||||||
{
|
|
||||||
if (window->win32.highSurrogate)
|
|
||||||
{
|
|
||||||
codepoint += (window->win32.highSurrogate - 0xd800) << 10;
|
|
||||||
codepoint += (WCHAR) wParam - 0xdc00;
|
|
||||||
codepoint += 0x10000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
codepoint = (WCHAR) wParam;
|
|
||||||
|
|
||||||
window->win32.highSurrogate = 0;
|
|
||||||
_glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
case WM_UNICHAR:
|
case WM_UNICHAR:
|
||||||
{
|
{
|
||||||
if (wParam == UNICODE_NOCHAR)
|
const GLFWbool plain = (uMsg != WM_SYSCHAR);
|
||||||
|
|
||||||
|
if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR)
|
||||||
{
|
{
|
||||||
// WM_UNICHAR is not sent by Windows, but is sent by some
|
// WM_UNICHAR is not sent by Windows, but is sent by some
|
||||||
// third-party input method engine
|
// third-party input method engine
|
||||||
@@ -727,7 +663,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputChar(window, (uint32_t) wParam, getKeyMods(), GLFW_TRUE);
|
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
||||||
|
|
||||||
|
if (uMsg == WM_SYSCHAR && window->win32.keymenu)
|
||||||
|
break;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -748,18 +688,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
|
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: Alt+PrtSc has a different scancode than just PrtSc
|
|
||||||
if (scancode == 0x54)
|
|
||||||
scancode = 0x137;
|
|
||||||
|
|
||||||
// HACK: Ctrl+Pause has a different scancode than just Pause
|
|
||||||
if (scancode == 0x146)
|
|
||||||
scancode = 0x45;
|
|
||||||
|
|
||||||
// HACK: CJK IME sets the extended bit for right Shift
|
|
||||||
if (scancode == 0x136)
|
|
||||||
scancode = 0x36;
|
|
||||||
|
|
||||||
key = _glfw.win32.keycodes[scancode];
|
key = _glfw.win32.keycodes[scancode];
|
||||||
|
|
||||||
// The Ctrl keys require special handling
|
// The Ctrl keys require special handling
|
||||||
@@ -1026,8 +954,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
const int width = LOWORD(lParam);
|
|
||||||
const int height = HIWORD(lParam);
|
|
||||||
const GLFWbool iconified = wParam == SIZE_MINIMIZED;
|
const GLFWbool iconified = wParam == SIZE_MINIMIZED;
|
||||||
const GLFWbool maximized = wParam == SIZE_MAXIMIZED ||
|
const GLFWbool maximized = wParam == SIZE_MAXIMIZED ||
|
||||||
(window->win32.maximized &&
|
(window->win32.maximized &&
|
||||||
@@ -1042,14 +968,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
if (window->win32.maximized != maximized)
|
if (window->win32.maximized != maximized)
|
||||||
_glfwInputWindowMaximize(window, maximized);
|
_glfwInputWindowMaximize(window, maximized);
|
||||||
|
|
||||||
if (width != window->win32.width || height != window->win32.height)
|
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
|
||||||
{
|
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
|
||||||
window->win32.width = width;
|
|
||||||
window->win32.height = height;
|
|
||||||
|
|
||||||
_glfwInputFramebufferSize(window, width, height);
|
|
||||||
_glfwInputWindowSize(window, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->monitor && window->win32.iconified != iconified)
|
if (window->monitor && window->win32.iconified != iconified)
|
||||||
{
|
{
|
||||||
@@ -1129,7 +1049,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
ZeroMemory(&mi, sizeof(mi));
|
ZeroMemory(&mi, sizeof(mi));
|
||||||
mi.cbSize = sizeof(mi);
|
mi.cbSize = sizeof(mi);
|
||||||
GetMonitorInfoW(mh, &mi);
|
GetMonitorInfo(mh, &mi);
|
||||||
|
|
||||||
mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left;
|
mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left;
|
||||||
mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top;
|
mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top;
|
||||||
@@ -1163,7 +1083,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_DWMCOMPOSITIONCHANGED:
|
case WM_DWMCOMPOSITIONCHANGED:
|
||||||
case WM_DWMCOLORIZATIONCOLORCHANGED:
|
|
||||||
{
|
{
|
||||||
if (window->win32.transparent)
|
if (window->win32.transparent)
|
||||||
updateFramebufferTransparency(window);
|
updateFramebufferTransparency(window);
|
||||||
@@ -1203,11 +1122,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
||||||
const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
||||||
|
|
||||||
// Resize windowed mode windows that either permit rescaling or that
|
// Only apply the suggested size if the OS is new enough to have
|
||||||
// need it to compensate for non-client area scaling
|
// sent a WM_GETDPISCALEDSIZE before this
|
||||||
if (!window->monitor &&
|
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32())
|
||||||
(window->win32.scaleToMonitor ||
|
|
||||||
_glfwIsWindows10CreatorsUpdateOrGreaterWin32()))
|
|
||||||
{
|
{
|
||||||
RECT* suggested = (RECT*) lParam;
|
RECT* suggested = (RECT*) lParam;
|
||||||
SetWindowPos(window->win32.handle, HWND_TOP,
|
SetWindowPos(window->win32.handle, HWND_TOP,
|
||||||
@@ -1284,16 +1201,15 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
GLFWvidmode mode;
|
||||||
GetMonitorInfoW(window->monitor->win32.handle, &mi);
|
|
||||||
|
|
||||||
// NOTE: This window placement is temporary and approximate, as the
|
// NOTE: This window placement is temporary and approximate, as the
|
||||||
// correct position and size cannot be known until the monitor
|
// correct position and size cannot be known until the monitor
|
||||||
// video mode has been picked in _glfwSetVideoModeWin32
|
// video mode has been picked in _glfwSetVideoModeWin32
|
||||||
xpos = mi.rcMonitor.left;
|
_glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos);
|
||||||
ypos = mi.rcMonitor.top;
|
_glfwPlatformGetVideoMode(window->monitor, &mode);
|
||||||
fullWidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
fullWidth = mode.width;
|
||||||
fullHeight = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
fullHeight = mode.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1322,8 +1238,8 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
fullWidth, fullHeight,
|
fullWidth, fullHeight,
|
||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
NULL, // No window menu
|
NULL, // No window menu
|
||||||
_glfw.win32.instance,
|
GetModuleHandleW(NULL),
|
||||||
(LPVOID) wndconfig);
|
NULL);
|
||||||
|
|
||||||
free(wideTitle);
|
free(wideTitle);
|
||||||
|
|
||||||
@@ -1347,31 +1263,27 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||||
|
window->win32.keymenu = wndconfig->win32.keymenu;
|
||||||
|
|
||||||
|
// Adjust window rect to account for DPI scaling of the window frame and
|
||||||
|
// (if enabled) DPI scaling of the content area
|
||||||
|
// This cannot be done until we know what monitor the window was placed on
|
||||||
if (!window->monitor)
|
if (!window->monitor)
|
||||||
{
|
{
|
||||||
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
||||||
WINDOWPLACEMENT wp = { sizeof(wp) };
|
WINDOWPLACEMENT wp = { sizeof(wp) };
|
||||||
const HMONITOR mh = MonitorFromWindow(window->win32.handle,
|
|
||||||
MONITOR_DEFAULTTONEAREST);
|
|
||||||
|
|
||||||
// Adjust window rect to account for DPI scaling of the window frame and
|
|
||||||
// (if enabled) DPI scaling of the content area
|
|
||||||
// This cannot be done until we know what monitor the window was placed on
|
|
||||||
// Only update the restored window rect as the window may be maximized
|
|
||||||
|
|
||||||
if (wndconfig->scaleToMonitor)
|
if (wndconfig->scaleToMonitor)
|
||||||
{
|
{
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
_glfwGetMonitorContentScaleWin32(mh, &xscale, &yscale);
|
_glfwPlatformGetWindowContentScale(window, &xscale, &yscale);
|
||||||
|
rect.right = (int) (rect.right * xscale);
|
||||||
if (xscale > 0.f && yscale > 0.f)
|
rect.bottom = (int) (rect.bottom * yscale);
|
||||||
{
|
|
||||||
rect.right = (int) (rect.right * xscale);
|
|
||||||
rect.bottom = (int) (rect.bottom * yscale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientToScreen(window->win32.handle, (POINT*) &rect.left);
|
||||||
|
ClientToScreen(window->win32.handle, (POINT*) &rect.right);
|
||||||
|
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
{
|
{
|
||||||
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle,
|
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle,
|
||||||
@@ -1380,30 +1292,11 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
else
|
else
|
||||||
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
||||||
|
|
||||||
|
// Only update the restored window rect as the window may be maximized
|
||||||
GetWindowPlacement(window->win32.handle, &wp);
|
GetWindowPlacement(window->win32.handle, &wp);
|
||||||
OffsetRect(&rect,
|
|
||||||
wp.rcNormalPosition.left - rect.left,
|
|
||||||
wp.rcNormalPosition.top - rect.top);
|
|
||||||
|
|
||||||
wp.rcNormalPosition = rect;
|
wp.rcNormalPosition = rect;
|
||||||
wp.showCmd = SW_HIDE;
|
wp.showCmd = SW_HIDE;
|
||||||
SetWindowPlacement(window->win32.handle, &wp);
|
SetWindowPlacement(window->win32.handle, &wp);
|
||||||
|
|
||||||
// Adjust rect of maximized undecorated window, because by default Windows will
|
|
||||||
// make such a window cover the whole monitor instead of its workarea
|
|
||||||
|
|
||||||
if (wndconfig->maximized && !wndconfig->decorated)
|
|
||||||
{
|
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
|
||||||
GetMonitorInfoW(mh, &mi);
|
|
||||||
|
|
||||||
SetWindowPos(window->win32.handle, HWND_TOP,
|
|
||||||
mi.rcWork.left,
|
|
||||||
mi.rcWork.top,
|
|
||||||
mi.rcWork.right - mi.rcWork.left,
|
|
||||||
mi.rcWork.bottom - mi.rcWork.top,
|
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DragAcceptFiles(window->win32.handle, TRUE);
|
DragAcceptFiles(window->win32.handle, TRUE);
|
||||||
@@ -1414,8 +1307,6 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
window->win32.transparent = GLFW_TRUE;
|
window->win32.transparent = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height);
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1433,8 +1324,8 @@ GLFWbool _glfwRegisterWindowClassWin32(void)
|
|||||||
ZeroMemory(&wc, sizeof(wc));
|
ZeroMemory(&wc, sizeof(wc));
|
||||||
wc.cbSize = sizeof(wc);
|
wc.cbSize = sizeof(wc);
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||||
wc.lpfnWndProc = windowProc;
|
wc.lpfnWndProc = (WNDPROC) windowProc;
|
||||||
wc.hInstance = _glfw.win32.instance;
|
wc.hInstance = GetModuleHandleW(NULL);
|
||||||
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||||
wc.lpszClassName = _GLFW_WNDCLASSNAME;
|
wc.lpszClassName = _GLFW_WNDCLASSNAME;
|
||||||
|
|
||||||
@@ -1464,7 +1355,7 @@ GLFWbool _glfwRegisterWindowClassWin32(void)
|
|||||||
//
|
//
|
||||||
void _glfwUnregisterWindowClassWin32(void)
|
void _glfwUnregisterWindowClassWin32(void)
|
||||||
{
|
{
|
||||||
UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance);
|
UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1503,9 +1394,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
@@ -1514,18 +1402,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
_glfwPlatformFocusWindow(window);
|
_glfwPlatformFocusWindow(window);
|
||||||
acquireMonitor(window);
|
acquireMonitor(window);
|
||||||
fitToMonitor(window);
|
fitToMonitor(window);
|
||||||
|
|
||||||
if (wndconfig->centerCursor)
|
|
||||||
_glfwCenterCursorInContentArea(window);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (wndconfig->visible)
|
|
||||||
{
|
|
||||||
_glfwPlatformShowWindow(window);
|
|
||||||
if (wndconfig->focused)
|
|
||||||
_glfwPlatformFocusWindow(window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@@ -1589,8 +1465,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||||||
smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
|
smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
|
SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
|
||||||
SendMessageW(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);
|
SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);
|
||||||
|
|
||||||
if (window->win32.bigIcon)
|
if (window->win32.bigIcon)
|
||||||
DestroyIcon(window->win32.bigIcon);
|
DestroyIcon(window->win32.bigIcon);
|
||||||
@@ -1770,10 +1646,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (IsWindowVisible(window->win32.handle))
|
ShowWindow(window->win32.handle, SW_MAXIMIZE);
|
||||||
ShowWindow(window->win32.handle, SW_MAXIMIZE);
|
|
||||||
else
|
|
||||||
maximizeWindowManually(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
@@ -1860,7 +1733,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
|
|
||||||
acquireMonitor(window);
|
acquireMonitor(window);
|
||||||
|
|
||||||
GetMonitorInfoW(window->monitor->win32.handle, &mi);
|
GetMonitorInfo(window->monitor->win32.handle, &mi);
|
||||||
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
||||||
mi.rcMonitor.left,
|
mi.rcMonitor.left,
|
||||||
mi.rcMonitor.top,
|
mi.rcMonitor.top,
|
||||||
@@ -1935,8 +1808,7 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
|
|||||||
|
|
||||||
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
BOOL composition, opaque;
|
BOOL enabled;
|
||||||
DWORD color;
|
|
||||||
|
|
||||||
if (!window->win32.transparent)
|
if (!window->win32.transparent)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
@@ -1944,20 +1816,7 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
|||||||
if (!IsWindowsVistaOrGreater())
|
if (!IsWindowsVistaOrGreater())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
|
return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled;
|
||||||
return GLFW_FALSE;
|
|
||||||
|
|
||||||
if (!IsWindows8OrGreater())
|
|
||||||
{
|
|
||||||
// HACK: Disable framebuffer transparency on Windows 7 when the
|
|
||||||
// colorization color is opaque, because otherwise the window
|
|
||||||
// contents is blended additively with the previous frame instead
|
|
||||||
// of replacing it
|
|
||||||
if (FAILED(DwmGetColorizationColor(&color, &opaque)) || opaque)
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
||||||
@@ -2124,7 +1983,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||||||
|
|
||||||
void _glfwPlatformPostEmptyEvent(void)
|
void _glfwPlatformPostEmptyEvent(void)
|
||||||
{
|
{
|
||||||
PostMessageW(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0);
|
PostMessage(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||||
@@ -2172,7 +2031,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
||||||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2184,6 +2043,48 @@ int _glfwPlatformGetKeyScancode(int key)
|
|||||||
return _glfw.win32.scancodes[key];
|
return _glfw.win32.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetKeyboardLayoutName(void)
|
||||||
|
{
|
||||||
|
WCHAR klid[KL_NAMELENGTH];
|
||||||
|
int size;
|
||||||
|
LCID lcid;
|
||||||
|
WCHAR* language;
|
||||||
|
|
||||||
|
if (!GetKeyboardLayoutNameW(klid))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to retrieve keyboard layout name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: We only care about the language part of the keyboard layout ID
|
||||||
|
lcid = MAKELCID(LANGIDFROMLCID(wcstoul(klid, NULL, 16)), 0);
|
||||||
|
|
||||||
|
size = GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, NULL, 0);
|
||||||
|
if (!size)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to retrieve keyboard layout name length");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
language = calloc(size, sizeof(WCHAR));
|
||||||
|
|
||||||
|
if (!GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, language, size))
|
||||||
|
{
|
||||||
|
free(language);
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to translate keyboard layout name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_glfw.win32.keyboardLayoutName);
|
||||||
|
_glfw.win32.keyboardLayoutName = _glfwCreateUTF8FromWideStringWin32(language);
|
||||||
|
free(language);
|
||||||
|
|
||||||
|
return _glfw.win32.keyboardLayoutName;
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
@@ -2205,14 +2106,25 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
id = OCR_IBEAM;
|
id = OCR_IBEAM;
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
id = OCR_CROSS;
|
id = OCR_CROSS;
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
id = OCR_HAND;
|
id = OCR_HAND;
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
id = OCR_SIZEWE;
|
id = OCR_SIZEWE;
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
id = OCR_SIZENS;
|
id = OCR_SIZENS;
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
id = OCR_SIZENWSE;
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
id = OCR_SIZENESW;
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
id = OCR_SIZEALL;
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
id = OCR_NO;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
cursor->win32.handle = LoadImageW(NULL,
|
cursor->win32.handle = LoadImageW(NULL,
|
||||||
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
|
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
|
||||||
@@ -2368,7 +2280,7 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
|
|||||||
|
|
||||||
memset(&sci, 0, sizeof(sci));
|
memset(&sci, 0, sizeof(sci));
|
||||||
sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||||
sci.hinstance = _glfw.win32.instance;
|
sci.hinstance = GetModuleHandle(NULL);
|
||||||
sci.hwnd = window->win32.handle;
|
sci.hwnd = window->win32.handle;
|
||||||
|
|
||||||
err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface);
|
err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface);
|
||||||
|
|||||||
+28
-25
@@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.3 - www.glfw.org
|
// GLFW 3.4 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -205,8 +205,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
window->focusOnShow = wndconfig.focusOnShow;
|
window->focusOnShow = wndconfig.focusOnShow;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
|
|
||||||
window->doublebuffer = fbconfig.doublebuffer;
|
|
||||||
|
|
||||||
window->minwidth = GLFW_DONT_CARE;
|
window->minwidth = GLFW_DONT_CARE;
|
||||||
window->minheight = GLFW_DONT_CARE;
|
window->minheight = GLFW_DONT_CARE;
|
||||||
window->maxwidth = GLFW_DONT_CARE;
|
window->maxwidth = GLFW_DONT_CARE;
|
||||||
@@ -221,6 +219,30 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctxconfig.client != GLFW_NO_API)
|
||||||
|
{
|
||||||
|
if (!_glfwRefreshContextAttribs(window, &ctxconfig))
|
||||||
|
{
|
||||||
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->monitor)
|
||||||
|
{
|
||||||
|
if (wndconfig.centerCursor)
|
||||||
|
_glfwCenterCursorInContentArea(window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (wndconfig.visible)
|
||||||
|
{
|
||||||
|
_glfwPlatformShowWindow(window);
|
||||||
|
if (wndconfig.focused)
|
||||||
|
_glfwPlatformFocusWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (GLFWwindow*) window;
|
return (GLFWwindow*) window;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,6 +363,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
|||||||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
|
case GLFW_WIN32_KEYBOARD_MENU:
|
||||||
|
_glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
|
return;
|
||||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
@@ -480,33 +505,12 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
|
|||||||
GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle,
|
GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle,
|
||||||
int count, const GLFWimage* images)
|
int count, const GLFWimage* images)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
assert(count >= 0);
|
assert(count >= 0);
|
||||||
assert(count == 0 || images != NULL);
|
assert(count == 0 || images != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (count < 0)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid image count for window icon");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
assert(images[i].pixels != NULL);
|
|
||||||
|
|
||||||
if (images[i].width <= 0 || images[i].height <= 0)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
|
||||||
"Invalid image dimensions for window icon");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwPlatformSetWindowIcon(window, count, images);
|
_glfwPlatformSetWindowIcon(window, count, images);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1098,4 +1102,3 @@ GLFWAPI void glfwPostEmptyEvent(void)
|
|||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformPostEmptyEvent();
|
_glfwPlatformPostEmptyEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+788
-55
File diff suppressed because it is too large
Load Diff
+25
-71
@@ -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>
|
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
static void outputHandleGeometry(void* userData,
|
static void outputHandleGeometry(void* data,
|
||||||
struct wl_output* output,
|
struct wl_output* output,
|
||||||
int32_t x,
|
int32_t x,
|
||||||
int32_t y,
|
int32_t y,
|
||||||
@@ -46,25 +46,26 @@ static void outputHandleGeometry(void* userData,
|
|||||||
const char* model,
|
const char* model,
|
||||||
int32_t transform)
|
int32_t transform)
|
||||||
{
|
{
|
||||||
struct _GLFWmonitor* monitor = userData;
|
struct _GLFWmonitor *monitor = data;
|
||||||
|
char name[1024];
|
||||||
|
|
||||||
monitor->wl.x = x;
|
monitor->wl.x = x;
|
||||||
monitor->wl.y = y;
|
monitor->wl.y = y;
|
||||||
monitor->widthMM = physicalWidth;
|
monitor->widthMM = physicalWidth;
|
||||||
monitor->heightMM = physicalHeight;
|
monitor->heightMM = physicalHeight;
|
||||||
|
|
||||||
if (strlen(monitor->name) == 0)
|
snprintf(name, sizeof(name), "%s %s", make, model);
|
||||||
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
monitor->name = _glfw_strdup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputHandleMode(void* userData,
|
static void outputHandleMode(void* data,
|
||||||
struct wl_output* output,
|
struct wl_output* output,
|
||||||
uint32_t flags,
|
uint32_t flags,
|
||||||
int32_t width,
|
int32_t width,
|
||||||
int32_t height,
|
int32_t height,
|
||||||
int32_t refresh)
|
int32_t refresh)
|
||||||
{
|
{
|
||||||
struct _GLFWmonitor* monitor = userData;
|
struct _GLFWmonitor *monitor = data;
|
||||||
GLFWvidmode mode;
|
GLFWvidmode mode;
|
||||||
|
|
||||||
mode.width = width;
|
mode.width = width;
|
||||||
@@ -83,75 +84,27 @@ static void outputHandleMode(void* userData,
|
|||||||
monitor->wl.currentMode = monitor->modeCount - 1;
|
monitor->wl.currentMode = monitor->modeCount - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputHandleDone(void* userData, struct wl_output* output)
|
static void outputHandleDone(void* data, struct wl_output* output)
|
||||||
{
|
{
|
||||||
struct _GLFWmonitor* monitor = userData;
|
struct _GLFWmonitor *monitor = data;
|
||||||
|
|
||||||
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
|
|
||||||
{
|
|
||||||
// If Wayland does not provide a physical size, assume the default 96 DPI
|
|
||||||
const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode];
|
|
||||||
monitor->widthMM = (int) (mode->width * 25.4f / 96.f);
|
|
||||||
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < _glfw.monitorCount; i++)
|
|
||||||
{
|
|
||||||
if (_glfw.monitors[i] == monitor)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputHandleScale(void* userData,
|
static void outputHandleScale(void* data,
|
||||||
struct wl_output* output,
|
struct wl_output* output,
|
||||||
int32_t factor)
|
int32_t factor)
|
||||||
{
|
{
|
||||||
struct _GLFWmonitor* monitor = userData;
|
struct _GLFWmonitor *monitor = data;
|
||||||
|
|
||||||
monitor->wl.scale = factor;
|
monitor->wl.scale = factor;
|
||||||
|
|
||||||
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < window->wl.monitorsCount; i++)
|
|
||||||
{
|
|
||||||
if (window->wl.monitors[i] == monitor)
|
|
||||||
{
|
|
||||||
_glfwUpdateContentScaleWayland(window);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
static const struct wl_output_listener outputListener = {
|
||||||
|
|
||||||
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
|
|
||||||
{
|
|
||||||
struct _GLFWmonitor* monitor = userData;
|
|
||||||
|
|
||||||
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void outputHandleDescription(void* userData,
|
|
||||||
struct wl_output* wl_output,
|
|
||||||
const char* description)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // WL_OUTPUT_NAME_SINCE_VERSION
|
|
||||||
|
|
||||||
static const struct wl_output_listener outputListener =
|
|
||||||
{
|
|
||||||
outputHandleGeometry,
|
outputHandleGeometry,
|
||||||
outputHandleMode,
|
outputHandleMode,
|
||||||
outputHandleDone,
|
outputHandleDone,
|
||||||
outputHandleScale,
|
outputHandleScale,
|
||||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
|
||||||
outputHandleName,
|
|
||||||
outputHandleDescription,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -161,6 +114,9 @@ static const struct wl_output_listener outputListener =
|
|||||||
|
|
||||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
||||||
{
|
{
|
||||||
|
_GLFWmonitor *monitor;
|
||||||
|
struct wl_output *output;
|
||||||
|
|
||||||
if (version < 2)
|
if (version < 2)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
@@ -168,21 +124,19 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
// The actual name of this output will be set in the geometry handler.
|
||||||
version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
|
monitor = _glfwAllocMonitor(NULL, 0, 0);
|
||||||
#else
|
|
||||||
version = 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
|
output = wl_registry_bind(_glfw.wl.registry,
|
||||||
name,
|
name,
|
||||||
&wl_output_interface,
|
&wl_output_interface,
|
||||||
version);
|
2);
|
||||||
if (!output)
|
if (!output)
|
||||||
|
{
|
||||||
|
_glfwFreeMonitor(monitor);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// The actual name of this output will be set in the geometry handler
|
|
||||||
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
|
|
||||||
monitor->wl.scale = 1;
|
monitor->wl.scale = 1;
|
||||||
monitor->wl.output = output;
|
monitor->wl.output = output;
|
||||||
monitor->wl.name = name;
|
monitor->wl.name = name;
|
||||||
|
|||||||
+47
-58
@@ -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>
|
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,9 @@
|
|||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
|
#endif
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
||||||
@@ -65,7 +67,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
|||||||
#define _glfw_dlclose(handle) dlclose(handle)
|
#define _glfw_dlclose(handle) dlclose(handle)
|
||||||
#define _glfw_dlsym(handle, name) dlsym(handle, name)
|
#define _glfw_dlsym(handle, name) dlsym(handle, name)
|
||||||
|
|
||||||
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.egl.window)
|
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native)
|
||||||
#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display)
|
#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display)
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl
|
||||||
@@ -110,27 +112,26 @@ typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context
|
|||||||
typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*);
|
typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*);
|
||||||
typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*);
|
typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*);
|
||||||
typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t);
|
typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t);
|
||||||
typedef int (* PFN_xkb_keymap_key_get_syms_by_level)(struct xkb_keymap*,xkb_keycode_t,xkb_layout_index_t,xkb_level_index_t,const xkb_keysym_t**);
|
|
||||||
typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*);
|
typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*);
|
||||||
typedef void (* PFN_xkb_state_unref)(struct xkb_state*);
|
typedef void (* PFN_xkb_state_unref)(struct xkb_state*);
|
||||||
typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**);
|
typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**);
|
||||||
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
||||||
typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t);
|
typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum xkb_state_component);
|
||||||
typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component);
|
typedef const char * (* PFN_xkb_keymap_layout_get_name)(struct xkb_keymap*,xkb_layout_index_t);
|
||||||
#define xkb_context_new _glfw.wl.xkb.context_new
|
#define xkb_context_new _glfw.wl.xkb.context_new
|
||||||
#define xkb_context_unref _glfw.wl.xkb.context_unref
|
#define xkb_context_unref _glfw.wl.xkb.context_unref
|
||||||
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
|
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
|
||||||
#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref
|
#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref
|
||||||
#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index
|
#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index
|
||||||
#define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats
|
#define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats
|
||||||
#define xkb_keymap_key_get_syms_by_level _glfw.wl.xkb.keymap_key_get_syms_by_level
|
|
||||||
#define xkb_state_new _glfw.wl.xkb.state_new
|
#define xkb_state_new _glfw.wl.xkb.state_new
|
||||||
#define xkb_state_unref _glfw.wl.xkb.state_unref
|
#define xkb_state_unref _glfw.wl.xkb.state_unref
|
||||||
#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms
|
#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms
|
||||||
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
|
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
|
||||||
#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout
|
#define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods
|
||||||
#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active
|
#define xkb_keymap_layout_get_name _glfw.wl.xkb.keymap_layout_get_name
|
||||||
|
|
||||||
|
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
||||||
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
|
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
|
||||||
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
|
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
|
||||||
typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags);
|
typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags);
|
||||||
@@ -145,6 +146,12 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
|
|||||||
#define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed
|
#define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed
|
||||||
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
||||||
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _GLFW_DECORATION_WIDTH 4
|
||||||
|
#define _GLFW_DECORATION_TOP 24
|
||||||
|
#define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH)
|
||||||
|
#define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH)
|
||||||
|
|
||||||
typedef enum _GLFWdecorationSideWayland
|
typedef enum _GLFWdecorationSideWayland
|
||||||
{
|
{
|
||||||
@@ -153,6 +160,7 @@ typedef enum _GLFWdecorationSideWayland
|
|||||||
leftDecoration,
|
leftDecoration,
|
||||||
rightDecoration,
|
rightDecoration,
|
||||||
bottomDecoration,
|
bottomDecoration,
|
||||||
|
|
||||||
} _GLFWdecorationSideWayland;
|
} _GLFWdecorationSideWayland;
|
||||||
|
|
||||||
typedef struct _GLFWdecorationWayland
|
typedef struct _GLFWdecorationWayland
|
||||||
@@ -160,14 +168,8 @@ typedef struct _GLFWdecorationWayland
|
|||||||
struct wl_surface* surface;
|
struct wl_surface* surface;
|
||||||
struct wl_subsurface* subsurface;
|
struct wl_subsurface* subsurface;
|
||||||
struct wp_viewport* viewport;
|
struct wp_viewport* viewport;
|
||||||
} _GLFWdecorationWayland;
|
|
||||||
|
|
||||||
typedef struct _GLFWofferWayland
|
} _GLFWdecorationWayland;
|
||||||
{
|
|
||||||
struct wl_data_offer* offer;
|
|
||||||
GLFWbool text_plain_utf8;
|
|
||||||
GLFWbool text_uri_list;
|
|
||||||
} _GLFWofferWayland;
|
|
||||||
|
|
||||||
// Wayland-specific per-window data
|
// Wayland-specific per-window data
|
||||||
//
|
//
|
||||||
@@ -176,30 +178,16 @@ typedef struct _GLFWwindowWayland
|
|||||||
int width, height;
|
int width, height;
|
||||||
GLFWbool visible;
|
GLFWbool visible;
|
||||||
GLFWbool maximized;
|
GLFWbool maximized;
|
||||||
GLFWbool activated;
|
|
||||||
GLFWbool fullscreen;
|
|
||||||
GLFWbool hovered;
|
GLFWbool hovered;
|
||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
struct wl_surface* surface;
|
struct wl_surface* surface;
|
||||||
|
struct wl_egl_window* native;
|
||||||
struct wl_callback* callback;
|
struct wl_callback* callback;
|
||||||
|
|
||||||
struct {
|
|
||||||
struct wl_egl_window* window;
|
|
||||||
} egl;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
int width, height;
|
|
||||||
GLFWbool maximized;
|
|
||||||
GLFWbool iconified;
|
|
||||||
GLFWbool activated;
|
|
||||||
GLFWbool fullscreen;
|
|
||||||
} pending;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct xdg_surface* surface;
|
struct xdg_surface* surface;
|
||||||
struct xdg_toplevel* toplevel;
|
struct xdg_toplevel* toplevel;
|
||||||
struct zxdg_toplevel_decoration_v1* decoration;
|
struct zxdg_toplevel_decoration_v1* decoration;
|
||||||
uint32_t decorationMode;
|
|
||||||
} xdg;
|
} xdg;
|
||||||
|
|
||||||
_GLFWcursor* currentCursor;
|
_GLFWcursor* currentCursor;
|
||||||
@@ -221,11 +209,15 @@ typedef struct _GLFWwindowWayland
|
|||||||
|
|
||||||
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
||||||
|
|
||||||
|
GLFWbool wasFullscreen;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
GLFWbool serverSide;
|
||||||
struct wl_buffer* buffer;
|
struct wl_buffer* buffer;
|
||||||
_GLFWdecorationWayland top, left, right, bottom;
|
_GLFWdecorationWayland top, left, right, bottom;
|
||||||
_GLFWdecorationSideWayland focus;
|
int focus;
|
||||||
} decorations;
|
} decorations;
|
||||||
|
|
||||||
} _GLFWwindowWayland;
|
} _GLFWwindowWayland;
|
||||||
|
|
||||||
// Wayland-specific global data
|
// Wayland-specific global data
|
||||||
@@ -242,6 +234,8 @@ typedef struct _GLFWlibraryWayland
|
|||||||
struct wl_keyboard* keyboard;
|
struct wl_keyboard* keyboard;
|
||||||
struct wl_data_device_manager* dataDeviceManager;
|
struct wl_data_device_manager* dataDeviceManager;
|
||||||
struct wl_data_device* dataDevice;
|
struct wl_data_device* dataDevice;
|
||||||
|
struct wl_data_offer* dataOffer;
|
||||||
|
struct wl_data_source* dataSource;
|
||||||
struct xdg_wm_base* wmBase;
|
struct xdg_wm_base* wmBase;
|
||||||
struct zxdg_decoration_manager_v1* decorationManager;
|
struct zxdg_decoration_manager_v1* decorationManager;
|
||||||
struct wp_viewporter* viewporter;
|
struct wp_viewporter* viewporter;
|
||||||
@@ -249,16 +243,6 @@ typedef struct _GLFWlibraryWayland
|
|||||||
struct zwp_pointer_constraints_v1* pointerConstraints;
|
struct zwp_pointer_constraints_v1* pointerConstraints;
|
||||||
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
|
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
|
||||||
|
|
||||||
_GLFWofferWayland* offers;
|
|
||||||
unsigned int offerCount;
|
|
||||||
|
|
||||||
struct wl_data_offer* selectionOffer;
|
|
||||||
struct wl_data_source* selectionSource;
|
|
||||||
|
|
||||||
struct wl_data_offer* dragOffer;
|
|
||||||
_GLFWwindow* dragFocus;
|
|
||||||
uint32_t dragSerial;
|
|
||||||
|
|
||||||
int compositorVersion;
|
int compositorVersion;
|
||||||
int seatVersion;
|
int seatVersion;
|
||||||
|
|
||||||
@@ -268,32 +252,38 @@ typedef struct _GLFWlibraryWayland
|
|||||||
const char* cursorPreviousName;
|
const char* cursorPreviousName;
|
||||||
int cursorTimerfd;
|
int cursorTimerfd;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
uint32_t pointerEnterSerial;
|
|
||||||
|
|
||||||
int32_t keyboardRepeatRate;
|
int32_t keyboardRepeatRate;
|
||||||
int32_t keyboardRepeatDelay;
|
int32_t keyboardRepeatDelay;
|
||||||
int keyboardLastKey;
|
int keyboardLastKey;
|
||||||
int keyboardLastScancode;
|
int keyboardLastScancode;
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
size_t clipboardSize;
|
||||||
|
char* clipboardSendString;
|
||||||
|
size_t clipboardSendSize;
|
||||||
|
char* keyboardLayoutName;
|
||||||
int timerfd;
|
int timerfd;
|
||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
char keynames[GLFW_KEY_LAST + 1][5];
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
void* handle;
|
void* handle;
|
||||||
struct xkb_context* context;
|
struct xkb_context* context;
|
||||||
struct xkb_keymap* keymap;
|
struct xkb_keymap* keymap;
|
||||||
struct xkb_state* state;
|
struct xkb_state* state;
|
||||||
struct xkb_compose_state* composeState;
|
|
||||||
|
|
||||||
xkb_mod_index_t controlIndex;
|
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
||||||
xkb_mod_index_t altIndex;
|
struct xkb_compose_state* composeState;
|
||||||
xkb_mod_index_t shiftIndex;
|
#endif
|
||||||
xkb_mod_index_t superIndex;
|
|
||||||
xkb_mod_index_t capsLockIndex;
|
xkb_mod_mask_t controlMask;
|
||||||
xkb_mod_index_t numLockIndex;
|
xkb_mod_mask_t altMask;
|
||||||
|
xkb_mod_mask_t shiftMask;
|
||||||
|
xkb_mod_mask_t superMask;
|
||||||
|
xkb_mod_mask_t capsLockMask;
|
||||||
|
xkb_mod_mask_t numLockMask;
|
||||||
unsigned int modifiers;
|
unsigned int modifiers;
|
||||||
|
xkb_layout_index_t group;
|
||||||
|
|
||||||
PFN_xkb_context_new context_new;
|
PFN_xkb_context_new context_new;
|
||||||
PFN_xkb_context_unref context_unref;
|
PFN_xkb_context_unref context_unref;
|
||||||
@@ -301,14 +291,14 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_xkb_keymap_unref keymap_unref;
|
PFN_xkb_keymap_unref keymap_unref;
|
||||||
PFN_xkb_keymap_mod_get_index keymap_mod_get_index;
|
PFN_xkb_keymap_mod_get_index keymap_mod_get_index;
|
||||||
PFN_xkb_keymap_key_repeats keymap_key_repeats;
|
PFN_xkb_keymap_key_repeats keymap_key_repeats;
|
||||||
PFN_xkb_keymap_key_get_syms_by_level keymap_key_get_syms_by_level;
|
|
||||||
PFN_xkb_state_new state_new;
|
PFN_xkb_state_new state_new;
|
||||||
PFN_xkb_state_unref state_unref;
|
PFN_xkb_state_unref state_unref;
|
||||||
PFN_xkb_state_key_get_syms state_key_get_syms;
|
PFN_xkb_state_key_get_syms state_key_get_syms;
|
||||||
PFN_xkb_state_update_mask state_update_mask;
|
PFN_xkb_state_update_mask state_update_mask;
|
||||||
PFN_xkb_state_key_get_layout state_key_get_layout;
|
PFN_xkb_state_serialize_mods state_serialize_mods;
|
||||||
PFN_xkb_state_mod_index_is_active state_mod_index_is_active;
|
PFN_xkb_keymap_layout_get_name keymap_layout_get_name;
|
||||||
|
|
||||||
|
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
||||||
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
|
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
|
||||||
PFN_xkb_compose_table_unref compose_table_unref;
|
PFN_xkb_compose_table_unref compose_table_unref;
|
||||||
PFN_xkb_compose_state_new compose_state_new;
|
PFN_xkb_compose_state_new compose_state_new;
|
||||||
@@ -316,6 +306,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_xkb_compose_state_feed compose_state_feed;
|
PFN_xkb_compose_state_feed compose_state_feed;
|
||||||
PFN_xkb_compose_state_get_status compose_state_get_status;
|
PFN_xkb_compose_state_get_status compose_state_get_status;
|
||||||
PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym;
|
PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym;
|
||||||
|
#endif
|
||||||
} xkb;
|
} xkb;
|
||||||
|
|
||||||
_GLFWwindow* pointerFocus;
|
_GLFWwindow* pointerFocus;
|
||||||
@@ -337,6 +328,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_wl_egl_window_destroy window_destroy;
|
PFN_wl_egl_window_destroy window_destroy;
|
||||||
PFN_wl_egl_window_resize window_resize;
|
PFN_wl_egl_window_resize window_resize;
|
||||||
} egl;
|
} egl;
|
||||||
|
|
||||||
} _GLFWlibraryWayland;
|
} _GLFWlibraryWayland;
|
||||||
|
|
||||||
// Wayland-specific per-monitor data
|
// Wayland-specific per-monitor data
|
||||||
@@ -350,6 +342,7 @@ typedef struct _GLFWmonitorWayland
|
|||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int scale;
|
int scale;
|
||||||
|
|
||||||
} _GLFWmonitorWayland;
|
} _GLFWmonitorWayland;
|
||||||
|
|
||||||
// Wayland-specific per-cursor data
|
// Wayland-specific per-cursor data
|
||||||
@@ -364,10 +357,6 @@ typedef struct _GLFWcursorWayland
|
|||||||
int currentImage;
|
int currentImage;
|
||||||
} _GLFWcursorWayland;
|
} _GLFWcursorWayland;
|
||||||
|
|
||||||
|
|
||||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
||||||
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
|
|
||||||
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode);
|
|
||||||
|
|
||||||
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
|
|
||||||
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
|
|
||||||
|
|
||||||
|
|||||||
+655
-1672
File diff suppressed because it is too large
Load Diff
+297
-94
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -29,17 +29,12 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <X11/Xresource.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
|
|
||||||
// Translate the X11 KeySyms for a key to a GLFW key code
|
// Translate the X11 KeySyms for a key to a GLFW key code
|
||||||
@@ -460,15 +455,49 @@ static GLFWbool hasUsableInputMethodStyle(void)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether the specified atom is supported
|
// Check whether the specified atom is supported
|
||||||
//
|
//
|
||||||
static Atom getAtomIfSupported(Atom* supportedAtoms,
|
static Atom getSupportedAtom(Atom* supportedAtoms,
|
||||||
unsigned long atomCount,
|
unsigned long atomCount,
|
||||||
const char* atomName)
|
const char* atomName)
|
||||||
{
|
{
|
||||||
const Atom atom = XInternAtom(_glfw.x11.display, atomName, False);
|
const Atom atom = XInternAtom(_glfw.x11.display, atomName, False);
|
||||||
|
|
||||||
for (unsigned long i = 0; i < atomCount; i++)
|
for (unsigned int i = 0; i < atomCount; i++)
|
||||||
{
|
{
|
||||||
if (supportedAtoms[i] == atom)
|
if (supportedAtoms[i] == atom)
|
||||||
return atom;
|
return atom;
|
||||||
@@ -536,33 +565,33 @@ static void detectEWMH(void)
|
|||||||
// See which of the atoms we support that are supported by the WM
|
// See which of the atoms we support that are supported by the WM
|
||||||
|
|
||||||
_glfw.x11.NET_WM_STATE =
|
_glfw.x11.NET_WM_STATE =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
||||||
_glfw.x11.NET_WM_STATE_ABOVE =
|
_glfw.x11.NET_WM_STATE_ABOVE =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
|
||||||
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
|
||||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT =
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT");
|
||||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ =
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ");
|
||||||
_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION =
|
_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION");
|
||||||
_glfw.x11.NET_WM_FULLSCREEN_MONITORS =
|
_glfw.x11.NET_WM_FULLSCREEN_MONITORS =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
|
||||||
_glfw.x11.NET_WM_WINDOW_TYPE =
|
_glfw.x11.NET_WM_WINDOW_TYPE =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
|
||||||
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
|
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL");
|
||||||
_glfw.x11.NET_WORKAREA =
|
_glfw.x11.NET_WORKAREA =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WORKAREA");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WORKAREA");
|
||||||
_glfw.x11.NET_CURRENT_DESKTOP =
|
_glfw.x11.NET_CURRENT_DESKTOP =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP");
|
||||||
_glfw.x11.NET_ACTIVE_WINDOW =
|
_glfw.x11.NET_ACTIVE_WINDOW =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
||||||
_glfw.x11.NET_FRAME_EXTENTS =
|
_glfw.x11.NET_FRAME_EXTENTS =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS");
|
||||||
_glfw.x11.NET_REQUEST_FRAME_EXTENTS =
|
_glfw.x11.NET_REQUEST_FRAME_EXTENTS =
|
||||||
getAtomIfSupported(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS");
|
||||||
|
|
||||||
if (supportedAtoms)
|
if (supportedAtoms)
|
||||||
XFree(supportedAtoms);
|
XFree(supportedAtoms);
|
||||||
@@ -572,11 +601,7 @@ static void detectEWMH(void)
|
|||||||
//
|
//
|
||||||
static GLFWbool initExtensions(void)
|
static GLFWbool initExtensions(void)
|
||||||
{
|
{
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so");
|
|
||||||
#else
|
|
||||||
_glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1");
|
_glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1");
|
||||||
#endif
|
|
||||||
if (_glfw.x11.vidmode.handle)
|
if (_glfw.x11.vidmode.handle)
|
||||||
{
|
{
|
||||||
_glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension)
|
_glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension)
|
||||||
@@ -596,8 +621,6 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so");
|
_glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so");
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.xi.handle = _glfw_dlopen("libXi.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6");
|
_glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6");
|
||||||
#endif
|
#endif
|
||||||
@@ -628,8 +651,6 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so");
|
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so");
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2");
|
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2");
|
||||||
#endif
|
#endif
|
||||||
@@ -722,8 +743,6 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so");
|
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so");
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1");
|
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -735,12 +754,16 @@ static GLFWbool initExtensions(void)
|
|||||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
|
||||||
_glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
|
_glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
|
||||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
|
||||||
|
_glfw.x11.xcursor.GetTheme = (PFN_XcursorGetTheme)
|
||||||
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorGetTheme");
|
||||||
|
_glfw.x11.xcursor.GetDefaultSize = (PFN_XcursorGetDefaultSize)
|
||||||
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorGetDefaultSize");
|
||||||
|
_glfw.x11.xcursor.LibraryLoadImage = (PFN_XcursorLibraryLoadImage)
|
||||||
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorLibraryLoadImage");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so");
|
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so");
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1");
|
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -782,18 +805,17 @@ static GLFWbool initExtensions(void)
|
|||||||
_glfw.x11.xkb.detectable = GLFW_TRUE;
|
_glfw.x11.xkb.detectable = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfw.x11.xkb.group = 0;
|
||||||
XkbStateRec state;
|
XkbStateRec state;
|
||||||
if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success)
|
if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success)
|
||||||
|
{
|
||||||
|
XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
|
||||||
_glfw.x11.xkb.group = (unsigned int)state.group;
|
_glfw.x11.xkb.group = (unsigned int)state.group;
|
||||||
|
}
|
||||||
XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify,
|
|
||||||
XkbGroupStateMask, XkbGroupStateMask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");
|
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1");
|
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -805,8 +827,6 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so");
|
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so");
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so");
|
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1");
|
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -972,37 +992,6 @@ static Window createHelperWindow(void)
|
|||||||
CWEventMask, &wa);
|
CWEventMask, &wa);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the pipe for empty events without assumuing the OS has pipe2(2)
|
|
||||||
//
|
|
||||||
static GLFWbool createEmptyEventPipe(void)
|
|
||||||
{
|
|
||||||
if (pipe(_glfw.x11.emptyEventPipe) != 0)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"X11: Failed to create empty event pipe: %s",
|
|
||||||
strerror(errno));
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
const int sf = fcntl(_glfw.x11.emptyEventPipe[i], F_GETFL, 0);
|
|
||||||
const int df = fcntl(_glfw.x11.emptyEventPipe[i], F_GETFD, 0);
|
|
||||||
|
|
||||||
if (sf == -1 || df == -1 ||
|
|
||||||
fcntl(_glfw.x11.emptyEventPipe[i], F_SETFL, sf | O_NONBLOCK) == -1 ||
|
|
||||||
fcntl(_glfw.x11.emptyEventPipe[i], F_SETFD, df | FD_CLOEXEC) == -1)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"X11: Failed to set flags for empty event pipe: %s",
|
|
||||||
strerror(errno));
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// X error handler
|
// X error handler
|
||||||
//
|
//
|
||||||
static int errorHandler(Display *display, XErrorEvent* event)
|
static int errorHandler(Display *display, XErrorEvent* event)
|
||||||
@@ -1023,9 +1012,8 @@ static int errorHandler(Display *display, XErrorEvent* event)
|
|||||||
//
|
//
|
||||||
void _glfwGrabErrorHandlerX11(void)
|
void _glfwGrabErrorHandlerX11(void)
|
||||||
{
|
{
|
||||||
assert(_glfw.x11.errorHandler == NULL);
|
|
||||||
_glfw.x11.errorCode = Success;
|
_glfw.x11.errorCode = Success;
|
||||||
_glfw.x11.errorHandler = XSetErrorHandler(errorHandler);
|
XSetErrorHandler(errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clears the X error handler callback
|
// Clears the X error handler callback
|
||||||
@@ -1034,8 +1022,7 @@ void _glfwReleaseErrorHandlerX11(void)
|
|||||||
{
|
{
|
||||||
// Synchronize to make sure all commands are processed
|
// Synchronize to make sure all commands are processed
|
||||||
XSync(_glfw.x11.display, False);
|
XSync(_glfw.x11.display, False);
|
||||||
XSetErrorHandler(_glfw.x11.errorHandler);
|
XSetErrorHandler(NULL);
|
||||||
_glfw.x11.errorHandler = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reports the specified error, appending information about the last X error
|
// Reports the specified error, appending information about the last X error
|
||||||
@@ -1099,6 +1086,222 @@ int _glfwPlatformInit(void)
|
|||||||
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
|
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
|
#if defined(__CYGWIN__)
|
||||||
|
_glfw.x11.xlib.handle = _glfw_dlopen("libX11-6.so");
|
||||||
|
#else
|
||||||
|
_glfw.x11.xlib.handle = _glfw_dlopen("libX11.so.6");
|
||||||
|
#endif
|
||||||
|
if (!_glfw.x11.xlib.handle)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to load Xlib");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.x11.xlib.AllocClassHint = (PFN_XAllocClassHint)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XAllocClassHint");
|
||||||
|
_glfw.x11.xlib.AllocSizeHints = (PFN_XAllocSizeHints)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XAllocSizeHints");
|
||||||
|
_glfw.x11.xlib.AllocWMHints = (PFN_XAllocWMHints)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XAllocWMHints");
|
||||||
|
_glfw.x11.xlib.ChangeProperty = (PFN_XChangeProperty)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XChangeProperty");
|
||||||
|
_glfw.x11.xlib.ChangeWindowAttributes = (PFN_XChangeWindowAttributes)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XChangeWindowAttributes");
|
||||||
|
_glfw.x11.xlib.CheckIfEvent = (PFN_XCheckIfEvent)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCheckIfEvent");
|
||||||
|
_glfw.x11.xlib.CheckTypedWindowEvent = (PFN_XCheckTypedWindowEvent)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCheckTypedWindowEvent");
|
||||||
|
_glfw.x11.xlib.CloseDisplay = (PFN_XCloseDisplay)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCloseDisplay");
|
||||||
|
_glfw.x11.xlib.CloseIM = (PFN_XCloseIM)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCloseIM");
|
||||||
|
_glfw.x11.xlib.ConvertSelection = (PFN_XConvertSelection)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XConvertSelection");
|
||||||
|
_glfw.x11.xlib.CreateColormap = (PFN_XCreateColormap)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateColormap");
|
||||||
|
_glfw.x11.xlib.CreateFontCursor = (PFN_XCreateFontCursor)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateFontCursor");
|
||||||
|
_glfw.x11.xlib.CreateIC = (PFN_XCreateIC)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateIC");
|
||||||
|
_glfw.x11.xlib.CreateWindow = (PFN_XCreateWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateWindow");
|
||||||
|
_glfw.x11.xlib.DefineCursor = (PFN_XDefineCursor)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XDefineCursor");
|
||||||
|
_glfw.x11.xlib.DeleteContext = (PFN_XDeleteContext)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XDeleteContext");
|
||||||
|
_glfw.x11.xlib.DeleteProperty = (PFN_XDeleteProperty)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XDeleteProperty");
|
||||||
|
_glfw.x11.xlib.DestroyIC = (PFN_XDestroyIC)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XDestroyIC");
|
||||||
|
_glfw.x11.xlib.DestroyWindow = (PFN_XDestroyWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XDestroyWindow");
|
||||||
|
_glfw.x11.xlib.DisplayKeycodes = (PFN_XDisplayKeycodes)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XDisplayKeycodes");
|
||||||
|
_glfw.x11.xlib.EventsQueued = (PFN_XEventsQueued)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XEventsQueued");
|
||||||
|
_glfw.x11.xlib.FilterEvent = (PFN_XFilterEvent)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFilterEvent");
|
||||||
|
_glfw.x11.xlib.FindContext = (PFN_XFindContext)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFindContext");
|
||||||
|
_glfw.x11.xlib.Flush = (PFN_XFlush)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFlush");
|
||||||
|
_glfw.x11.xlib.Free = (PFN_XFree)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFree");
|
||||||
|
_glfw.x11.xlib.FreeColormap = (PFN_XFreeColormap)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFreeColormap");
|
||||||
|
_glfw.x11.xlib.FreeCursor = (PFN_XFreeCursor)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFreeCursor");
|
||||||
|
_glfw.x11.xlib.FreeEventData = (PFN_XFreeEventData)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XFreeEventData");
|
||||||
|
_glfw.x11.xlib.GetAtomName = (PFN_XGetAtomName)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetAtomName");
|
||||||
|
_glfw.x11.xlib.GetErrorText = (PFN_XGetErrorText)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetErrorText");
|
||||||
|
_glfw.x11.xlib.GetEventData = (PFN_XGetEventData)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetEventData");
|
||||||
|
_glfw.x11.xlib.GetICValues = (PFN_XGetICValues)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetICValues");
|
||||||
|
_glfw.x11.xlib.GetIMValues = (PFN_XGetIMValues)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetIMValues");
|
||||||
|
_glfw.x11.xlib.GetInputFocus = (PFN_XGetInputFocus)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetInputFocus");
|
||||||
|
_glfw.x11.xlib.GetKeyboardMapping = (PFN_XGetKeyboardMapping)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetKeyboardMapping");
|
||||||
|
_glfw.x11.xlib.GetScreenSaver = (PFN_XGetScreenSaver)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetScreenSaver");
|
||||||
|
_glfw.x11.xlib.GetSelectionOwner = (PFN_XGetSelectionOwner)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetSelectionOwner");
|
||||||
|
_glfw.x11.xlib.GetVisualInfo = (PFN_XGetVisualInfo)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetVisualInfo");
|
||||||
|
_glfw.x11.xlib.GetWMNormalHints = (PFN_XGetWMNormalHints)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetWMNormalHints");
|
||||||
|
_glfw.x11.xlib.GetWindowAttributes = (PFN_XGetWindowAttributes)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetWindowAttributes");
|
||||||
|
_glfw.x11.xlib.GetWindowProperty = (PFN_XGetWindowProperty)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetWindowProperty");
|
||||||
|
_glfw.x11.xlib.GrabPointer = (PFN_XGrabPointer)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XGrabPointer");
|
||||||
|
_glfw.x11.xlib.IconifyWindow = (PFN_XIconifyWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XIconifyWindow");
|
||||||
|
_glfw.x11.xlib.InitThreads = (PFN_XInitThreads)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XInitThreads");
|
||||||
|
_glfw.x11.xlib.InternAtom = (PFN_XInternAtom)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XInternAtom");
|
||||||
|
_glfw.x11.xlib.LookupString = (PFN_XLookupString)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XLookupString");
|
||||||
|
_glfw.x11.xlib.MapRaised = (PFN_XMapRaised)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XMapRaised");
|
||||||
|
_glfw.x11.xlib.MapWindow = (PFN_XMapWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XMapWindow");
|
||||||
|
_glfw.x11.xlib.MoveResizeWindow = (PFN_XMoveResizeWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XMoveResizeWindow");
|
||||||
|
_glfw.x11.xlib.MoveWindow = (PFN_XMoveWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XMoveWindow");
|
||||||
|
_glfw.x11.xlib.NextEvent = (PFN_XNextEvent)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XNextEvent");
|
||||||
|
_glfw.x11.xlib.OpenDisplay = (PFN_XOpenDisplay)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XOpenDisplay");
|
||||||
|
_glfw.x11.xlib.OpenIM = (PFN_XOpenIM)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XOpenIM");
|
||||||
|
_glfw.x11.xlib.PeekEvent = (PFN_XPeekEvent)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XPeekEvent");
|
||||||
|
_glfw.x11.xlib.Pending = (PFN_XPending)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XPending");
|
||||||
|
_glfw.x11.xlib.QueryExtension = (PFN_XQueryExtension)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XQueryExtension");
|
||||||
|
_glfw.x11.xlib.QueryPointer = (PFN_XQueryPointer)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XQueryPointer");
|
||||||
|
_glfw.x11.xlib.RaiseWindow = (PFN_XRaiseWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XRaiseWindow");
|
||||||
|
_glfw.x11.xlib.RegisterIMInstantiateCallback = (PFN_XRegisterIMInstantiateCallback)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XRegisterIMInstantiateCallback");
|
||||||
|
_glfw.x11.xlib.ResizeWindow = (PFN_XResizeWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XResizeWindow");
|
||||||
|
_glfw.x11.xlib.ResourceManagerString = (PFN_XResourceManagerString)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XResourceManagerString");
|
||||||
|
_glfw.x11.xlib.SaveContext = (PFN_XSaveContext)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSaveContext");
|
||||||
|
_glfw.x11.xlib.SelectInput = (PFN_XSelectInput)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSelectInput");
|
||||||
|
_glfw.x11.xlib.SendEvent = (PFN_XSendEvent)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSendEvent");
|
||||||
|
_glfw.x11.xlib.SetClassHint = (PFN_XSetClassHint)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetClassHint");
|
||||||
|
_glfw.x11.xlib.SetErrorHandler = (PFN_XSetErrorHandler)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetErrorHandler");
|
||||||
|
_glfw.x11.xlib.SetICFocus = (PFN_XSetICFocus)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetICFocus");
|
||||||
|
_glfw.x11.xlib.SetIMValues = (PFN_XSetIMValues)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetIMValues");
|
||||||
|
_glfw.x11.xlib.SetInputFocus = (PFN_XSetInputFocus)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetInputFocus");
|
||||||
|
_glfw.x11.xlib.SetLocaleModifiers = (PFN_XSetLocaleModifiers)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetLocaleModifiers");
|
||||||
|
_glfw.x11.xlib.SetScreenSaver = (PFN_XSetScreenSaver)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetScreenSaver");
|
||||||
|
_glfw.x11.xlib.SetSelectionOwner = (PFN_XSetSelectionOwner)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetSelectionOwner");
|
||||||
|
_glfw.x11.xlib.SetWMHints = (PFN_XSetWMHints)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetWMHints");
|
||||||
|
_glfw.x11.xlib.SetWMNormalHints = (PFN_XSetWMNormalHints)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetWMNormalHints");
|
||||||
|
_glfw.x11.xlib.SetWMProtocols = (PFN_XSetWMProtocols)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetWMProtocols");
|
||||||
|
_glfw.x11.xlib.SupportsLocale = (PFN_XSupportsLocale)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSupportsLocale");
|
||||||
|
_glfw.x11.xlib.Sync = (PFN_XSync)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XSync");
|
||||||
|
_glfw.x11.xlib.TranslateCoordinates = (PFN_XTranslateCoordinates)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XTranslateCoordinates");
|
||||||
|
_glfw.x11.xlib.UndefineCursor = (PFN_XUndefineCursor)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XUndefineCursor");
|
||||||
|
_glfw.x11.xlib.UngrabPointer = (PFN_XUngrabPointer)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XUngrabPointer");
|
||||||
|
_glfw.x11.xlib.UnmapWindow = (PFN_XUnmapWindow)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XUnmapWindow");
|
||||||
|
_glfw.x11.xlib.UnsetICFocus = (PFN_XUnsetICFocus)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XUnsetICFocus");
|
||||||
|
_glfw.x11.xlib.VisualIDFromVisual = (PFN_XVisualIDFromVisual)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XVisualIDFromVisual");
|
||||||
|
_glfw.x11.xlib.WarpPointer = (PFN_XWarpPointer)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XWarpPointer");
|
||||||
|
_glfw.x11.xkb.AllocKeyboard = (PFN_XkbAllocKeyboard)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbAllocKeyboard");
|
||||||
|
_glfw.x11.xkb.FreeKeyboard = (PFN_XkbFreeKeyboard)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbFreeKeyboard");
|
||||||
|
_glfw.x11.xkb.FreeNames = (PFN_XkbFreeNames)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbFreeNames");
|
||||||
|
_glfw.x11.xkb.GetMap = (PFN_XkbGetMap)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbGetMap");
|
||||||
|
_glfw.x11.xkb.GetNames = (PFN_XkbGetNames)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbGetNames");
|
||||||
|
_glfw.x11.xkb.GetState = (PFN_XkbGetState)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbGetState");
|
||||||
|
_glfw.x11.xkb.KeycodeToKeysym = (PFN_XkbKeycodeToKeysym)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbKeycodeToKeysym");
|
||||||
|
_glfw.x11.xkb.QueryExtension = (PFN_XkbQueryExtension)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbQueryExtension");
|
||||||
|
_glfw.x11.xkb.SelectEventDetails = (PFN_XkbSelectEventDetails)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbSelectEventDetails");
|
||||||
|
_glfw.x11.xkb.SetDetectableAutoRepeat = (PFN_XkbSetDetectableAutoRepeat)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbSetDetectableAutoRepeat");
|
||||||
|
_glfw.x11.xrm.DestroyDatabase = (PFN_XrmDestroyDatabase)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmDestroyDatabase");
|
||||||
|
_glfw.x11.xrm.GetResource = (PFN_XrmGetResource)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmGetResource");
|
||||||
|
_glfw.x11.xrm.GetStringDatabase = (PFN_XrmGetStringDatabase)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmGetStringDatabase");
|
||||||
|
_glfw.x11.xrm.Initialize = (PFN_XrmInitialize)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmInitialize");
|
||||||
|
_glfw.x11.xrm.UniqueQuark = (PFN_XrmUniqueQuark)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmUniqueQuark");
|
||||||
|
_glfw.x11.xlib.UnregisterIMInstantiateCallback = (PFN_XUnregisterIMInstantiateCallback)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "XUnregisterIMInstantiateCallback");
|
||||||
|
_glfw.x11.xlib.utf8LookupString = (PFN_Xutf8LookupString)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "Xutf8LookupString");
|
||||||
|
_glfw.x11.xlib.utf8SetWMProperties = (PFN_Xutf8SetWMProperties)
|
||||||
|
_glfw_dlsym(_glfw.x11.xlib.handle, "Xutf8SetWMProperties");
|
||||||
|
|
||||||
XInitThreads();
|
XInitThreads();
|
||||||
XrmInitialize();
|
XrmInitialize();
|
||||||
|
|
||||||
@@ -1126,9 +1329,6 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY);
|
getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY);
|
||||||
|
|
||||||
if (!createEmptyEventPipe())
|
|
||||||
return GLFW_FALSE;
|
|
||||||
|
|
||||||
if (!initExtensions())
|
if (!initExtensions())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
@@ -1139,15 +1339,11 @@ int _glfwPlatformInit(void)
|
|||||||
{
|
{
|
||||||
XSetLocaleModifiers("");
|
XSetLocaleModifiers("");
|
||||||
|
|
||||||
_glfw.x11.im = XOpenIM(_glfw.x11.display, 0, NULL, NULL);
|
// If an IM is already present our callback will be called right away
|
||||||
if (_glfw.x11.im)
|
XRegisterIMInstantiateCallback(_glfw.x11.display,
|
||||||
{
|
NULL, NULL, NULL,
|
||||||
if (!hasUsableInputMethodStyle())
|
inputMethodInstantiateCallback,
|
||||||
{
|
NULL);
|
||||||
XCloseIM(_glfw.x11.im);
|
|
||||||
_glfw.x11.im = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
@@ -1184,6 +1380,14 @@ void _glfwPlatformTerminate(void)
|
|||||||
free(_glfw.x11.primarySelectionString);
|
free(_glfw.x11.primarySelectionString);
|
||||||
free(_glfw.x11.clipboardString);
|
free(_glfw.x11.clipboardString);
|
||||||
|
|
||||||
|
if (_glfw.x11.keyboardLayoutName)
|
||||||
|
XFree(_glfw.x11.keyboardLayoutName);
|
||||||
|
|
||||||
|
XUnregisterIMInstantiateCallback(_glfw.x11.display,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
inputMethodInstantiateCallback,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (_glfw.x11.im)
|
if (_glfw.x11.im)
|
||||||
{
|
{
|
||||||
XCloseIM(_glfw.x11.im);
|
XCloseIM(_glfw.x11.im);
|
||||||
@@ -1238,7 +1442,6 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfw.x11.xi.handle = NULL;
|
_glfw.x11.xi.handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwTerminateOSMesa();
|
|
||||||
// NOTE: These need to be unloaded after XCloseDisplay, as they register
|
// NOTE: These need to be unloaded after XCloseDisplay, as they register
|
||||||
// cleanup callbacks that get called by that function
|
// cleanup callbacks that get called by that function
|
||||||
_glfwTerminateEGL();
|
_glfwTerminateEGL();
|
||||||
@@ -1248,10 +1451,10 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfwTerminateJoysticksLinux();
|
_glfwTerminateJoysticksLinux();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_glfw.x11.emptyEventPipe[0] || _glfw.x11.emptyEventPipe[1])
|
if (_glfw.x11.xlib.handle)
|
||||||
{
|
{
|
||||||
close(_glfw.x11.emptyEventPipe[0]);
|
_glfw_dlclose(_glfw.x11.xlib.handle);
|
||||||
close(_glfw.x11.emptyEventPipe[1]);
|
_glfw.x11.xlib.handle = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
@@ -164,7 +164,7 @@ void _glfwPollMonitorsX11(void)
|
|||||||
if (widthMM <= 0 || heightMM <= 0)
|
if (widthMM <= 0 || heightMM <= 0)
|
||||||
{
|
{
|
||||||
// HACK: If RandR does not provide a physical size, assume the
|
// HACK: If RandR does not provide a physical size, assume the
|
||||||
// X11 default 96 DPI and calculate from the CRTC viewport
|
// X11 default 96 DPI and calcuate from the CRTC viewport
|
||||||
// NOTE: These members are affected by rotation, unlike the mode
|
// NOTE: These members are affected by rotation, unlike the mode
|
||||||
// info and output info members
|
// info and output info members
|
||||||
widthMM = (int) (ci->width * 25.4f / 96.f);
|
widthMM = (int) (ci->width * 25.4f / 96.f);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user