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-vs2019:
|
|
||||||
name: Win32 (Windows, VS2019)
|
|
||||||
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 16 2019"
|
|
||||||
- name: Build static library
|
|
||||||
run: cmake --build build-static --parallel
|
|
||||||
|
|
||||||
- name: Configure shared library
|
|
||||||
run: cmake -S . -B build-shared -G "Visual Studio 16 2019" -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)
|
||||||
|
|||||||
+22
-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.5 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,7 +238,7 @@ 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}")
|
||||||
@@ -269,7 +248,7 @@ if (_GLFW_WAYLAND)
|
|||||||
check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H)
|
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}")
|
||||||
@@ -283,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()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -324,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)
|
||||||
@@ -333,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
|
||||||
@@ -372,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
|
||||||
|
|||||||
-220
@@ -1,220 +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
|
|
||||||
- Doug Binks
|
|
||||||
- blanco
|
|
||||||
- Waris Boonyasiriwat
|
|
||||||
- Kyle Brenneman
|
|
||||||
- Rok Breulj
|
|
||||||
- Kai Burjack
|
|
||||||
- Martin Capitanio
|
|
||||||
- Nicolas Caramelli
|
|
||||||
- David Carlier
|
|
||||||
- Arturo Castro
|
|
||||||
- Chi-kwan Chan
|
|
||||||
- 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
|
|
||||||
- Jarrod Davis
|
|
||||||
- Olivier Delannoy
|
|
||||||
- Paul R. Deppe
|
|
||||||
- Michael Dickens
|
|
||||||
- Роман Донченко
|
|
||||||
- Mario Dorn
|
|
||||||
- Wolfgang Draxinger
|
|
||||||
- Jonathan Dummer
|
|
||||||
- Ralph Eastwood
|
|
||||||
- Fredrik Ehnbom
|
|
||||||
- Robin Eklind
|
|
||||||
- Siavash Eliasi
|
|
||||||
- TheExileFox
|
|
||||||
- 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
|
|
||||||
- hdf89shfdfs
|
|
||||||
- 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
|
|
||||||
- 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
|
|
||||||
- Jeff Molofee
|
|
||||||
- Alexander Monakov
|
|
||||||
- Pierre Morel
|
|
||||||
- Jon Morton
|
|
||||||
- Pierre Moulon
|
|
||||||
- Martins Mozeiko
|
|
||||||
- Julian Møller
|
|
||||||
- ndogxj
|
|
||||||
- Kristian Nielsen
|
|
||||||
- Kamil Nowakowski
|
|
||||||
- onox
|
|
||||||
- Denis Ovod
|
|
||||||
- Ozzy
|
|
||||||
- Andri Pálsson
|
|
||||||
- Peoro
|
|
||||||
- Braden Pellett
|
|
||||||
- Christopher Pelloux
|
|
||||||
- Arturo J. Pérez
|
|
||||||
- Vladimir Perminov
|
|
||||||
- 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
|
|
||||||
- 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
|
|
||||||
- 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
|
|
||||||
- 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
|
|
||||||
- Richard A. Wilkes
|
|
||||||
- Tatsuya Yatagawa
|
|
||||||
- Ryogo Yoshimura
|
|
||||||
- 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,36 +119,89 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Updated gamepad mappings from upstream
|
- Added `glfwGetKeyboardLayoutName` for querying the name of the current
|
||||||
- Bugfix: Buffers were swapped at creation on single-buffered windows (#1873)
|
keyboard layout (#1201)
|
||||||
- Bugfix: Gamepad mapping updates could spam `GLFW_INVALID_VALUE` due to
|
- Added `glfwSetKeyboardLayoutCallback` and `GLFWkeyboardlayoutfun` for
|
||||||
incompatible controllers sharing hardware ID (#1763)
|
receiving keyboard layout events (#1201)
|
||||||
- Bugfix: Native access functions for context handles did not check that the API matched
|
- Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`,
|
||||||
- [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
|
`GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427)
|
||||||
later (#1783,#1796)
|
- Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427)
|
||||||
- [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
|
- Added `GLFW_RESIZE_NS_CURSOR` alias for `GLFW_VRESIZE_CURSOR` (#427)
|
||||||
- [Cocoa] Bugfix: The MoltenVK layer contents scale was updated only after
|
- Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427)
|
||||||
related events were emitted
|
- Updated the minimum required CMake version to 3.1
|
||||||
- [Cocoa] Bugfix: Moving the cursor programmatically would freeze it for
|
- Disabled tests and examples by default when built as a CMake subdirectory
|
||||||
a fraction of a second (#1962)
|
- Bugfix: The CMake config-file package used an absolute path and was not
|
||||||
- [Cocoa] Bugfix: `kIOMasterPortDefault` was deprecated in macOS 12.0 (#1980)
|
relocatable (#1470)
|
||||||
- [X11] Bugfix: Changing `GLFW_FLOATING` could leak memory
|
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
|
||||||
- [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908)
|
- Bugfix: Compiling with -Wextra-semi caused warnings (#1440)
|
||||||
- [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899)
|
- Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583)
|
||||||
- [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
|
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
|
||||||
- [NSGL] Bugfix: Defining `GL_SILENCE_DEPRECATION` externally caused
|
to the window menu
|
||||||
a duplicate definition warning (#1840)
|
- [Win32] Added a version info resource to the GLFW DLL
|
||||||
- [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
|
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
||||||
|
symbol redefinition (#1524)
|
||||||
|
- [Win32] Bugfix: The cursor position event was emitted before its cursor enter
|
||||||
|
event (#1490)
|
||||||
|
- [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
|
||||||
|
window (#1499)
|
||||||
|
- [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions
|
||||||
|
- [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622)
|
||||||
|
- [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an
|
||||||
|
invalid pointer
|
||||||
|
- [Win32] Bugfix: Some synthetic key events were reported as `GLFW_KEY_UNKNOWN`
|
||||||
|
(#1623)
|
||||||
|
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
||||||
|
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
||||||
|
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
||||||
|
- [Cocoa] Removed dependency on the CoreVideo framework
|
||||||
|
- [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
|
||||||
|
- [Cocoa] Bugfix: Window remained on screen after destruction until event poll
|
||||||
|
(#1412)
|
||||||
|
- [Cocoa] Bugfix: Event processing before window creation would assert (#1543)
|
||||||
|
- [Cocoa] Bugfix: Undecorated windows could not be iconified on recent macOS
|
||||||
|
- [Cocoa] Bugfix: Touching event queue from secondary thread before main thread
|
||||||
|
would abort (#1649)
|
||||||
|
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
|
||||||
|
- [X11] Bugfix: Key names were not updated when the keyboard layout changed
|
||||||
|
(#1462,#1528)
|
||||||
|
- [X11] Bugfix: Decorations could not be enabled after window creation (#1566)
|
||||||
|
- [X11] Bugfix: Content scale fallback value could be inconsistent (#1578)
|
||||||
|
- [X11] Bugfix: `glfwMaximizeWindow` had no effect on hidden windows
|
||||||
|
- [X11] Bugfix: Clearing `GLFW_FLOATING` on a hidden window caused invalid read
|
||||||
|
- [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail
|
||||||
|
- [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows
|
||||||
|
- [X11] Bugfix: Monitor physical dimensions could be reported as zero mm
|
||||||
|
- [X11] Bugfix: Window position events were not emitted during resizing (#1613)
|
||||||
|
- [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
|
||||||
|
- [X11] Bugfix: Querying a disconnected monitor could segfault (#1602)
|
||||||
|
- [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
|
||||||
|
- [X11] Bugfix: Termination would segfault if the IM had been destroyed
|
||||||
|
- [X11] Bugfix: Any IM started after initialization would not be detected
|
||||||
|
- [X11] Bugfix: Xlib errors caused by other parts of the application could be
|
||||||
|
reported as GLFW errors
|
||||||
|
- [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633)
|
||||||
|
- [X11] Bugfix: XKB path used keysyms instead of physical locations for
|
||||||
|
non-printable keys (#1598)
|
||||||
|
- [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout
|
||||||
|
combinaitons (#1598)
|
||||||
|
- [Wayland] Removed support for `wl_shell` (#1443)
|
||||||
|
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||||
|
- [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
|
||||||
@@ -161,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
+124
-77
@@ -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);
|
||||||
|
|
||||||
@@ -220,7 +240,7 @@ static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z,
|
|||||||
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];
|
||||||
@@ -276,7 +295,7 @@ static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
|
|||||||
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;
|
||||||
@@ -298,17 +317,12 @@ 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]);
|
|
||||||
|
|
||||||
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]);
|
vec3_norm(R[2], R[2]);
|
||||||
|
|
||||||
s = vec3_mul_inner(R[1], R[2]);
|
s = vec3_mul_inner(R[1], R[2]);
|
||||||
@@ -316,13 +330,17 @@ static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M)
|
|||||||
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;
|
||||||
@@ -338,7 +356,7 @@ static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t,
|
|||||||
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;
|
||||||
@@ -354,11 +372,11 @@ static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, fl
|
|||||||
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 s;
|
|
||||||
vec3 t;
|
|
||||||
|
|
||||||
vec3_sub(f, center, eye);
|
vec3_sub(f, center, eye);
|
||||||
vec3_norm(f, f);
|
vec3_norm(f, f);
|
||||||
|
|
||||||
|
vec3 s;
|
||||||
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];
|
||||||
@@ -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
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
|
|||||||
@@ -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 to 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
-7
@@ -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,11 +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. If the running compositor
|
wayland-protocols 1.12, and is mandatory for GLFW to display a window.
|
||||||
does not support this protocol, the older [wl_shell
|
|
||||||
interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972)
|
|
||||||
will be used instead. This will result in a worse integration with the
|
|
||||||
desktop, especially on tiling compositors.
|
|
||||||
|
|
||||||
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)
|
||||||
@@ -234,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
-208
@@ -10,171 +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 `xorgproto` package in the Devel section of the GUI installer will
|
|
||||||
install the headers and other development related files for all of 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.
|
||||||
@@ -184,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
|
||||||
@@ -232,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.
|
||||||
|
|
||||||
@@ -358,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,79 +1,79 @@
|
|||||||
// 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 {
|
||||||
@@ -82,24 +82,24 @@ $box-todo-color: hsl(200,80%,85%);
|
|||||||
}
|
}
|
||||||
|
|
||||||
.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,15 +128,15 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,30 +159,24 @@ h3 {
|
|||||||
|
|
||||||
.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,17 +206,19 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -241,29 +233,21 @@ address.footer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#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-->
|
||||||
|
|||||||
+31
-7
@@ -230,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
|
||||||
|
|
||||||
@@ -373,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
|
||||||
|
|
||||||
@@ -645,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.
|
||||||
|
|
||||||
|
|
||||||
@@ -794,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.
|
||||||
|
|||||||
+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
-821
@@ -5,859 +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).
|
|
||||||
|
|
||||||
|
|
||||||
@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 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
|
||||||
|
|||||||
+1
-1
@@ -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.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+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
|
||||||
|
|||||||
@@ -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);
|
||||||
+281
-124
@@ -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__*/
|
||||||
|
|
||||||
@@ -279,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 5
|
#define GLFW_VERSION_REVISION 0
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@@ -786,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
|
||||||
@@ -978,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
|
||||||
@@ -1032,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
|
||||||
@@ -1067,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.
|
||||||
@@ -1082,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
|
||||||
@@ -1219,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.
|
||||||
*
|
*
|
||||||
@@ -1242,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.
|
||||||
*
|
*
|
||||||
@@ -1264,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.
|
||||||
*
|
*
|
||||||
@@ -1284,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.
|
||||||
*
|
*
|
||||||
@@ -1304,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.
|
||||||
*
|
*
|
||||||
@@ -1325,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.
|
||||||
*
|
*
|
||||||
@@ -1346,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.
|
||||||
*
|
*
|
||||||
@@ -1357,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
|
||||||
@@ -1367,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.
|
||||||
*
|
*
|
||||||
@@ -1388,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.
|
||||||
*
|
*
|
||||||
@@ -1409,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.
|
||||||
*
|
*
|
||||||
@@ -1435,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.
|
||||||
*
|
*
|
||||||
@@ -1458,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.
|
||||||
*
|
*
|
||||||
@@ -1479,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.
|
||||||
*
|
*
|
||||||
@@ -1500,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.
|
||||||
*
|
*
|
||||||
@@ -1526,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.
|
||||||
*
|
*
|
||||||
@@ -1547,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.
|
||||||
@@ -1574,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.
|
||||||
*
|
*
|
||||||
@@ -1598,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.
|
||||||
*
|
*
|
||||||
@@ -1619,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.
|
||||||
*
|
*
|
||||||
@@ -1640,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.
|
||||||
*
|
*
|
||||||
@@ -1782,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.
|
||||||
@@ -1809,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.
|
||||||
@@ -2128,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.
|
||||||
*
|
*
|
||||||
@@ -2283,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
|
||||||
@@ -2616,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.
|
||||||
@@ -2629,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)
|
||||||
@@ -2644,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
|
||||||
@@ -3227,8 +3290,8 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
|
|||||||
* @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 There is no concept of iconification in wl_shell, this
|
* @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t
|
||||||
* function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated
|
* be able to restore it. This is a design decision of the xdg-shell
|
||||||
* protocol.
|
* 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.
|
||||||
@@ -3805,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 wl_shell protocol has no concept of iconification,
|
|
||||||
* this callback will never be called when using this deprecated 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
|
||||||
@@ -4222,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`.
|
||||||
@@ -4229,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.
|
||||||
*
|
*
|
||||||
@@ -4269,6 +4331,73 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -4456,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.
|
||||||
@@ -5661,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.
|
||||||
@@ -5711,8 +5867,9 @@ 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 GLFW currently supports both the `VK_MVK_macos_surface` and
|
* @remark @macos This function currently supports either the
|
||||||
* the newer `VK_EXT_metal_surface` extensions.
|
* `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
|
||||||
@@ -5795,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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -83,8 +83,8 @@ extern "C" {
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
// example to allow applications to correctly declare a GL_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
|
||||||
#if defined(GLFW_APIENTRY_DEFINED)
|
#if defined(GLFW_APIENTRY_DEFINED)
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
#undef GLFW_APIENTRY_DEFINED
|
#undef GLFW_APIENTRY_DEFINED
|
||||||
@@ -132,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.
|
||||||
*
|
*
|
||||||
@@ -149,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.
|
||||||
*
|
*
|
||||||
@@ -165,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.
|
||||||
*
|
*
|
||||||
@@ -191,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.
|
||||||
*
|
*
|
||||||
@@ -218,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.
|
||||||
*
|
*
|
||||||
@@ -234,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.
|
||||||
*
|
*
|
||||||
@@ -252,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.
|
||||||
*
|
*
|
||||||
@@ -271,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.
|
||||||
*
|
*
|
||||||
@@ -287,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.
|
||||||
*
|
*
|
||||||
@@ -303,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.
|
||||||
*
|
*
|
||||||
@@ -319,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.
|
||||||
*
|
*
|
||||||
@@ -387,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.
|
||||||
*
|
*
|
||||||
@@ -404,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.
|
||||||
*
|
*
|
||||||
@@ -423,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.
|
||||||
*
|
*
|
||||||
@@ -439,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.
|
||||||
*
|
*
|
||||||
@@ -455,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.
|
||||||
*
|
*
|
||||||
@@ -473,8 +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.
|
|
||||||
*
|
|
||||||
* @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.
|
||||||
*
|
*
|
||||||
@@ -489,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.
|
||||||
*
|
*
|
||||||
@@ -506,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.
|
||||||
*
|
*
|
||||||
@@ -532,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.
|
||||||
*
|
*
|
||||||
@@ -556,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.
|
||||||
*
|
*
|
||||||
@@ -573,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.
|
||||||
*
|
*
|
||||||
|
|||||||
+91
-107
@@ -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()
|
||||||
|
|||||||
+61
-45
@@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,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];
|
||||||
@@ -560,6 +565,10 @@ int _glfwPlatformInit(void)
|
|||||||
_glfwInitJoysticksNS();
|
_glfwInitJoysticksNS();
|
||||||
|
|
||||||
_glfwPollMonitorsNS();
|
_glfwPollMonitorsNS();
|
||||||
|
|
||||||
|
if (![[NSRunningApplication currentApplication] isFinishedLaunching])
|
||||||
|
[NSApp run];
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
@@ -569,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)
|
||||||
@@ -605,6 +620,7 @@ 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();
|
||||||
_glfwTerminateJoysticksNS();
|
_glfwTerminateJoysticksNS();
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
+46
-65
@@ -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(kIOMainPortDefault,
|
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)
|
||||||
@@ -101,7 +88,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Cocoa: Failed to find service port for display");
|
"Cocoa: Failed to find service port for display");
|
||||||
return _glfw_strdup("Display");
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFDictionaryRef names =
|
CFDictionaryRef names =
|
||||||
@@ -114,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 =
|
||||||
@@ -222,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)
|
||||||
@@ -231,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(kIOMainPortDefault,
|
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
||||||
IOServiceMatching("IOFramebuffer"),
|
IOServiceMatching("IOFramebuffer"),
|
||||||
&it) != 0)
|
&it) != 0)
|
||||||
{
|
{
|
||||||
@@ -265,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;
|
||||||
|
|
||||||
if (clockRef)
|
|
||||||
{
|
|
||||||
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
||||||
CFRelease(clockRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (countRef)
|
|
||||||
{
|
|
||||||
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
||||||
|
CFRelease(clockRef);
|
||||||
CFRelease(countRef);
|
CFRelease(countRef);
|
||||||
}
|
|
||||||
|
|
||||||
if (clock > 0 && count > 0)
|
if (clock > 0 && count > 0)
|
||||||
refreshRate = clock / (double) count;
|
refreshRate = clock / (double) count;
|
||||||
@@ -322,46 +328,27 @@ void _glfwPollMonitorsNS(void)
|
|||||||
if (CGDisplayIsAsleep(displays[i]))
|
if (CGDisplayIsAsleep(displays[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// HACK: Compare unit numbers instead of display IDs to work around
|
||||||
|
// display replacement on machines with automatic graphics
|
||||||
|
// switching
|
||||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||||
NSScreen* screen = nil;
|
for (uint32_t j = 0; j < disconnectedCount; j++)
|
||||||
|
|
||||||
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
|
|
||||||
// display replacement on machines with automatic graphics
|
|
||||||
// switching
|
|
||||||
uint32_t j;
|
|
||||||
for (j = 0; j < disconnectedCount; j++)
|
|
||||||
{
|
{
|
||||||
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
||||||
{
|
{
|
||||||
disconnected[j]->ns.screen = screen;
|
|
||||||
disconnected[j] = NULL;
|
disconnected[j] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j < disconnectedCount)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
char* name = 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);
|
||||||
|
|
||||||
@@ -470,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];
|
||||||
@@ -493,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];
|
||||||
|
|
||||||
@@ -540,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)++;
|
||||||
|
|||||||
+17
-13
@@ -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>
|
||||||
@@ -41,13 +39,6 @@
|
|||||||
typedef void* id;
|
typedef void* id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
|
||||||
// SDK versions where one is unavailable or the other deprecated
|
|
||||||
// We use the newer names in code and these macros to handle compatibility
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000
|
|
||||||
#define kIOMainPortDefault kIOMasterPortDefault
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||||
// SDK versions where one is unavailable or the other deprecated
|
// SDK versions where one is unavailable or the other deprecated
|
||||||
// We use the newer names in code and these macros to handle compatibility
|
// We use the newer names in code and these macros to handle compatibility
|
||||||
@@ -101,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
|
||||||
@@ -112,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);
|
||||||
@@ -142,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
|
||||||
@@ -150,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;
|
||||||
@@ -163,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;
|
||||||
@@ -171,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
|
||||||
@@ -187,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
|
||||||
@@ -194,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
|
||||||
@@ -201,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>
|
||||||
//
|
//
|
||||||
|
|||||||
+80
-63
@@ -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>
|
||||||
//
|
//
|
||||||
@@ -114,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))
|
||||||
@@ -244,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)
|
||||||
@@ -279,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)
|
||||||
@@ -398,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);
|
||||||
@@ -521,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)
|
||||||
@@ -541,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
|
||||||
@@ -731,26 +731,16 @@ 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)
|
||||||
if ([characters getBytes:&codepoint
|
|
||||||
maxLength:sizeof(codepoint)
|
|
||||||
usedLength:NULL
|
|
||||||
encoding:NSUTF32StringEncoding
|
|
||||||
options:0
|
|
||||||
range:range
|
|
||||||
remainingRange:&range])
|
|
||||||
{
|
|
||||||
if (codepoint >= 0xf700 && codepoint <= 0xf7ff)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_glfwInputChar(window, codepoint, mods, plain);
|
_glfwInputChar(window, codepoint, mods, plain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (void)doCommandBySelector:(SEL)selector
|
- (void)doCommandBySelector:(SEL)selector
|
||||||
{
|
{
|
||||||
@@ -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))
|
||||||
@@ -1400,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
|
||||||
@@ -1422,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.
|
||||||
@@ -1443,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
|
||||||
@@ -1463,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
|
||||||
@@ -1524,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1547,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1594,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)
|
||||||
@@ -1642,23 +1633,49 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
|
SEL cursorSelector = NULL;
|
||||||
|
|
||||||
|
// HACK: Try to use a private message
|
||||||
|
if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
cursorSelector = NSSelectorFromString(@"_windowResizeEastWestCursor");
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
cursorSelector = NSSelectorFromString(@"_windowResizeNorthSouthCursor");
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
cursorSelector = NSSelectorFromString(@"_windowResizeNorthWestSouthEastCursor");
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
cursorSelector = NSSelectorFromString(@"_windowResizeNorthEastSouthWestCursor");
|
||||||
|
|
||||||
|
if (cursorSelector && [NSCursor respondsToSelector:cursorSelector])
|
||||||
|
{
|
||||||
|
id object = [NSCursor performSelector:cursorSelector];
|
||||||
|
if ([object isKindOfClass:[NSCursor class]])
|
||||||
|
cursor->ns.object = object;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cursor->ns.object)
|
||||||
|
{
|
||||||
if (shape == GLFW_ARROW_CURSOR)
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
cursor->ns.object = [NSCursor arrowCursor];
|
cursor->ns.object = [NSCursor arrowCursor];
|
||||||
else if (shape == GLFW_IBEAM_CURSOR)
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
cursor->ns.object = [NSCursor IBeamCursor];
|
cursor->ns.object = [NSCursor IBeamCursor];
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
cursor->ns.object = [NSCursor crosshairCursor];
|
cursor->ns.object = [NSCursor crosshairCursor];
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
cursor->ns.object = [NSCursor pointingHandCursor];
|
cursor->ns.object = [NSCursor pointingHandCursor];
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
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)
|
if (!cursor->ns.object)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
"Cocoa: Failed to retrieve standard cursor");
|
"Cocoa: Standard cursor shape unavailable");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-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-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,8 +570,6 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
|||||||
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
||||||
window->context.getProcAddress("glClear");
|
window->context.getProcAddress("glClear");
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
if (window->doublebuffer)
|
|
||||||
window->context.swapBuffers(window);
|
window->context.swapBuffers(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-8
@@ -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++;
|
||||||
@@ -588,7 +588,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up attributes for surface creation
|
// Set up attributes for surface creation
|
||||||
index = 0;
|
{
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
if (fbconfig->sRGB)
|
if (fbconfig->sRGB)
|
||||||
{
|
{
|
||||||
@@ -596,10 +597,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fbconfig->doublebuffer)
|
|
||||||
setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
|
||||||
|
|
||||||
setAttrib(EGL_NONE, EGL_NONE);
|
setAttrib(EGL_NONE, EGL_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
window->context.egl.surface =
|
window->context.egl.surface =
|
||||||
eglCreateWindowSurface(_glfw.egl.display,
|
eglCreateWindowSurface(_glfw.egl.display,
|
||||||
@@ -765,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;
|
||||||
@@ -779,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
-3
@@ -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
|
||||||
@@ -164,6 +162,7 @@ typedef struct _GLFWcontextEGL
|
|||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
|
|
||||||
void* client;
|
void* client;
|
||||||
|
|
||||||
} _GLFWcontextEGL;
|
} _GLFWcontextEGL;
|
||||||
|
|
||||||
// EGL-specific global data
|
// EGL-specific global data
|
||||||
@@ -198,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,8 +45,6 @@
|
|||||||
// 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
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -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);
|
||||||
@@ -674,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;
|
||||||
@@ -688,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);
|
||||||
|
|||||||
+18
-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>
|
||||||
@@ -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>
|
||||||
@@ -188,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");
|
||||||
}
|
}
|
||||||
@@ -244,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+43
-21
@@ -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,15 +85,27 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
@@ -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)
|
||||||
@@ -397,21 +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)
|
|
||||||
{
|
|
||||||
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++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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,
|
||||||
@@ -434,6 +438,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
js->present = GLFW_TRUE;
|
js->present = GLFW_TRUE;
|
||||||
|
js->name = _glfw_strdup(name);
|
||||||
js->axes = calloc(axisCount, sizeof(float));
|
js->axes = calloc(axisCount, sizeof(float));
|
||||||
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
||||||
js->hats = calloc(hatCount, 1);
|
js->hats = calloc(hatCount, 1);
|
||||||
@@ -441,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);
|
||||||
|
|
||||||
@@ -452,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);
|
||||||
@@ -629,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;
|
||||||
@@ -760,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;
|
||||||
|
|||||||
+9
-5
@@ -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
|
||||||
@@ -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;
|
||||||
@@ -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.
|
||||||
@@ -485,7 +487,7 @@ struct _GLFWjoystick
|
|||||||
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;
|
||||||
@@ -570,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
|
||||||
@@ -610,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);
|
||||||
@@ -715,6 +719,7 @@ 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,
|
||||||
@@ -761,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,
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -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>
|
||||||
//
|
//
|
||||||
@@ -44,6 +44,7 @@ typedef struct _GLFWcontextNSGL
|
|||||||
{
|
{
|
||||||
id pixelFormat;
|
id pixelFormat;
|
||||||
id object;
|
id object;
|
||||||
|
|
||||||
} _GLFWcontextNSGL;
|
} _GLFWcontextNSGL;
|
||||||
|
|
||||||
// NSGL-specific global data
|
// NSGL-specific global data
|
||||||
@@ -52,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
-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>
|
||||||
@@ -310,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
-14
@@ -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>
|
||||||
@@ -302,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))
|
||||||
@@ -341,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))
|
||||||
@@ -373,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
-1
@@ -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>
|
||||||
|
|||||||
+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;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-7
@@ -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,6 +68,17 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
|||||||
//
|
//
|
||||||
static GLFWbool loadLibraries(void)
|
static GLFWbool loadLibraries(void)
|
||||||
{
|
{
|
||||||
|
_glfw.win32.winmm.instance = LoadLibraryA("winmm.dll");
|
||||||
|
if (!_glfw.win32.winmm.instance)
|
||||||
|
{
|
||||||
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to load winmm.dll");
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
@@ -136,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");
|
||||||
@@ -169,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);
|
||||||
|
|
||||||
@@ -594,6 +602,7 @@ 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();
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -356,7 +356,7 @@ 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->present)
|
if (js->present)
|
||||||
{
|
{
|
||||||
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
|
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
|
||||||
@@ -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)
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-3
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-15
@@ -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
|
||||||
@@ -218,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*);
|
||||||
@@ -246,11 +247,9 @@ typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UIN
|
|||||||
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);
|
||||||
@@ -316,14 +315,11 @@ 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
|
||||||
@@ -335,6 +331,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
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];
|
||||||
@@ -346,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;
|
||||||
@@ -373,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 {
|
||||||
@@ -386,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
|
||||||
@@ -400,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
|
||||||
@@ -407,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
|
||||||
@@ -422,6 +428,7 @@ typedef struct _GLFWtlsWin32
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
DWORD index;
|
DWORD index;
|
||||||
|
|
||||||
} _GLFWtlsWin32;
|
} _GLFWtlsWin32;
|
||||||
|
|
||||||
// Win32-specific mutex data
|
// Win32-specific mutex data
|
||||||
@@ -430,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>
|
||||||
|
|||||||
+18
-2
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -47,11 +58,16 @@ void _glfwInitTimerWin32(void)
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerValue(void)
|
uint64_t _glfwPlatformGetTimerValue(void)
|
||||||
|
{
|
||||||
|
if (_glfw.timer.win32.hasPC)
|
||||||
{
|
{
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return (uint64_t) timeGetTime();
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerFrequency(void)
|
uint64_t _glfwPlatformGetTimerFrequency(void)
|
||||||
{
|
{
|
||||||
|
|||||||
+110
-93
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,17 +519,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_NCCREATE:
|
case WM_NCCREATE:
|
||||||
{
|
{
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
{
|
|
||||||
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
|
|
||||||
const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
|
|
||||||
|
|
||||||
// On per-monitor DPI aware V1 systems, only enable
|
|
||||||
// non-client scaling for windows that scale the client area
|
|
||||||
// We need WM_GETDPISCALEDSIZE from V2 to keep the client
|
|
||||||
// area static when the non-client area is scaled
|
|
||||||
if (wndconfig && wndconfig->scaleToMonitor)
|
|
||||||
EnableNonClientDpiScaling(hWnd);
|
EnableNonClientDpiScaling(hWnd);
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -622,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:
|
||||||
|
{
|
||||||
|
if (!window->win32.keymenu)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -636,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
|
|
||||||
{
|
|
||||||
unsigned int 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
|
||||||
@@ -677,7 +663,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE);
|
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
||||||
|
|
||||||
|
if (uMsg == WM_SYSCHAR && window->win32.keymenu)
|
||||||
|
break;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,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 &&
|
||||||
@@ -980,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)
|
||||||
{
|
{
|
||||||
@@ -1101,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);
|
||||||
@@ -1141,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,
|
||||||
@@ -1260,7 +1239,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
NULL, // No window menu
|
NULL, // No window menu
|
||||||
GetModuleHandleW(NULL),
|
GetModuleHandleW(NULL),
|
||||||
(LPVOID) wndconfig);
|
NULL);
|
||||||
|
|
||||||
free(wideTitle);
|
free(wideTitle);
|
||||||
|
|
||||||
@@ -1284,6 +1263,7 @@ 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
|
// Adjust window rect to account for DPI scaling of the window frame and
|
||||||
// (if enabled) DPI scaling of the content area
|
// (if enabled) DPI scaling of the content area
|
||||||
@@ -1327,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1830,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;
|
||||||
@@ -1839,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)
|
||||||
@@ -2067,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2079,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)
|
||||||
@@ -2100,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,
|
||||||
|
|||||||
+4
-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>
|
||||||
@@ -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;
|
||||||
@@ -365,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;
|
||||||
@@ -1101,4 +1102,3 @@ GLFWAPI void glfwPostEmptyEvent(void)
|
|||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformPostEmptyEvent();
|
_glfwPlatformPostEmptyEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+34
-33
@@ -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,7 @@
|
|||||||
// 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 200809L
|
#define _POSIX_C_SOURCE 199309L
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +105,6 @@ static void pointerHandleEnter(void* data,
|
|||||||
|
|
||||||
window->wl.decorations.focus = focus;
|
window->wl.decorations.focus = focus;
|
||||||
_glfw.wl.serial = serial;
|
_glfw.wl.serial = serial;
|
||||||
_glfw.wl.pointerEnterSerial = serial;
|
|
||||||
_glfw.wl.pointerFocus = window;
|
_glfw.wl.pointerFocus = window;
|
||||||
|
|
||||||
window->wl.hovered = GLFW_TRUE;
|
window->wl.hovered = GLFW_TRUE;
|
||||||
@@ -164,7 +164,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
|
|||||||
buffer = wl_cursor_image_get_buffer(image);
|
buffer = wl_cursor_image_get_buffer(image);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return;
|
return;
|
||||||
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
|
||||||
surface,
|
surface,
|
||||||
image->hotspot_x / scale,
|
image->hotspot_x / scale,
|
||||||
image->hotspot_y / scale);
|
image->hotspot_y / scale);
|
||||||
@@ -244,9 +244,7 @@ static void pointerHandleButton(void* data,
|
|||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||||
int glfwButton;
|
int glfwButton;
|
||||||
|
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
|
||||||
// Both xdg-shell and wl_shell use the same values.
|
|
||||||
uint32_t edges = WL_SHELL_SURFACE_RESIZE_NONE;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
@@ -258,46 +256,39 @@ static void pointerHandleButton(void* data,
|
|||||||
break;
|
break;
|
||||||
case topDecoration:
|
case topDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_TOP;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
|
||||||
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
||||||
else
|
|
||||||
wl_shell_surface_move(window->wl.shellSurface, _glfw.wl.seat, serial);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case leftDecoration:
|
case leftDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
|
||||||
else
|
else
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case rightDecoration:
|
case rightDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
|
||||||
else
|
else
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case bottomDecoration:
|
case bottomDecoration:
|
||||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
||||||
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
||||||
else
|
else
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
if (edges != WL_SHELL_SURFACE_RESIZE_NONE)
|
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
|
||||||
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
||||||
serial, edges);
|
serial, edges);
|
||||||
else
|
|
||||||
wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat,
|
|
||||||
serial, edges);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (button == BTN_RIGHT)
|
else if (button == BTN_RIGHT)
|
||||||
@@ -350,9 +341,9 @@ static void pointerHandleAxis(void* data,
|
|||||||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
|
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
|
||||||
|
|
||||||
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
|
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
|
||||||
x = -wl_fixed_to_double(value) * scrollFactor;
|
x = wl_fixed_to_double(value) * scrollFactor;
|
||||||
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
||||||
y = -wl_fixed_to_double(value) * scrollFactor;
|
y = wl_fixed_to_double(value) * scrollFactor;
|
||||||
|
|
||||||
_glfwInputScroll(window, x, y);
|
_glfwInputScroll(window, x, y);
|
||||||
}
|
}
|
||||||
@@ -561,7 +552,7 @@ static GLFWbool inputChar(_GLFWwindow* window, uint32_t key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, code);
|
return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, syms[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyboardHandleKey(void* data,
|
static void keyboardHandleKey(void* data,
|
||||||
@@ -649,6 +640,12 @@ static void keyboardHandleModifiers(void* data,
|
|||||||
if (mask & _glfw.wl.xkb.numLockMask)
|
if (mask & _glfw.wl.xkb.numLockMask)
|
||||||
modifiers |= GLFW_MOD_NUM_LOCK;
|
modifiers |= GLFW_MOD_NUM_LOCK;
|
||||||
_glfw.wl.xkb.modifiers = modifiers;
|
_glfw.wl.xkb.modifiers = modifiers;
|
||||||
|
|
||||||
|
if (_glfw.wl.xkb.group != group)
|
||||||
|
{
|
||||||
|
_glfw.wl.xkb.group = group;
|
||||||
|
_glfwInputKeyboardLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
||||||
@@ -812,11 +809,6 @@ static void registryHandleGlobal(void* data,
|
|||||||
_glfw.wl.shm =
|
_glfw.wl.shm =
|
||||||
wl_registry_bind(registry, name, &wl_shm_interface, 1);
|
wl_registry_bind(registry, name, &wl_shm_interface, 1);
|
||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_shell") == 0)
|
|
||||||
{
|
|
||||||
_glfw.wl.shell =
|
|
||||||
wl_registry_bind(registry, name, &wl_shell_interface, 1);
|
|
||||||
}
|
|
||||||
else if (strcmp(interface, "wl_output") == 0)
|
else if (strcmp(interface, "wl_output") == 0)
|
||||||
{
|
{
|
||||||
_glfwAddOutputWayland(name, version);
|
_glfwAddOutputWayland(name, version);
|
||||||
@@ -1115,6 +1107,8 @@ int _glfwPlatformInit(void)
|
|||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask");
|
||||||
_glfw.wl.xkb.state_serialize_mods = (PFN_xkb_state_serialize_mods)
|
_glfw.wl.xkb.state_serialize_mods = (PFN_xkb_state_serialize_mods)
|
||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_serialize_mods");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_serialize_mods");
|
||||||
|
_glfw.wl.xkb.keymap_layout_get_name = (PFN_xkb_keymap_layout_get_name)
|
||||||
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_layout_get_name");
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
||||||
_glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale)
|
_glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale)
|
||||||
@@ -1171,6 +1165,13 @@ int _glfwPlatformInit(void)
|
|||||||
if (_glfw.wl.seatVersion >= 4)
|
if (_glfw.wl.seatVersion >= 4)
|
||||||
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
|
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
|
||||||
|
|
||||||
|
if (!_glfw.wl.wmBase)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to find xdg-shell in your compositor");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.wl.pointer && _glfw.wl.shm)
|
if (_glfw.wl.pointer && _glfw.wl.shm)
|
||||||
{
|
{
|
||||||
cursorTheme = getenv("XCURSOR_THEME");
|
cursorTheme = getenv("XCURSOR_THEME");
|
||||||
@@ -1264,8 +1265,6 @@ void _glfwPlatformTerminate(void)
|
|||||||
wl_compositor_destroy(_glfw.wl.compositor);
|
wl_compositor_destroy(_glfw.wl.compositor);
|
||||||
if (_glfw.wl.shm)
|
if (_glfw.wl.shm)
|
||||||
wl_shm_destroy(_glfw.wl.shm);
|
wl_shm_destroy(_glfw.wl.shm);
|
||||||
if (_glfw.wl.shell)
|
|
||||||
wl_shell_destroy(_glfw.wl.shell);
|
|
||||||
if (_glfw.wl.viewporter)
|
if (_glfw.wl.viewporter)
|
||||||
wp_viewporter_destroy(_glfw.wl.viewporter);
|
wp_viewporter_destroy(_glfw.wl.viewporter);
|
||||||
if (_glfw.wl.decorationManager)
|
if (_glfw.wl.decorationManager)
|
||||||
@@ -1309,6 +1308,8 @@ void _glfwPlatformTerminate(void)
|
|||||||
free(_glfw.wl.clipboardString);
|
free(_glfw.wl.clipboardString);
|
||||||
if (_glfw.wl.clipboardSendString)
|
if (_glfw.wl.clipboardSendString)
|
||||||
free(_glfw.wl.clipboardSendString);
|
free(_glfw.wl.clipboardSendString);
|
||||||
|
if (_glfw.wl.keyboardLayoutName)
|
||||||
|
free(_glfw.wl.keyboardLayoutName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
|
|||||||
+5
-11
@@ -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>
|
||||||
//
|
//
|
||||||
@@ -47,13 +47,15 @@ static void outputHandleGeometry(void* data,
|
|||||||
int32_t transform)
|
int32_t transform)
|
||||||
{
|
{
|
||||||
struct _GLFWmonitor *monitor = data;
|
struct _GLFWmonitor *monitor = data;
|
||||||
|
char name[1024];
|
||||||
|
|
||||||
monitor->wl.x = x;
|
monitor->wl.x = x;
|
||||||
monitor->wl.y = y;
|
monitor->wl.y = y;
|
||||||
monitor->widthMM = physicalWidth;
|
monitor->widthMM = physicalWidth;
|
||||||
monitor->heightMM = physicalHeight;
|
monitor->heightMM = physicalHeight;
|
||||||
|
|
||||||
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
snprintf(name, sizeof(name), "%s %s", make, model);
|
||||||
|
monitor->name = _glfw_strdup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputHandleMode(void* data,
|
static void outputHandleMode(void* data,
|
||||||
@@ -86,14 +88,6 @@ static void outputHandleDone(void* data, struct wl_output* output)
|
|||||||
{
|
{
|
||||||
struct _GLFWmonitor *monitor = data;
|
struct _GLFWmonitor *monitor = data;
|
||||||
|
|
||||||
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
|
|
||||||
{
|
|
||||||
// If Wayland does not provide a physical size, assume the default 96 DPI
|
|
||||||
const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode];
|
|
||||||
monitor->widthMM = (int) (mode->width * 25.4f / 96.f);
|
|
||||||
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +125,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The actual name of this output will be set in the geometry handler.
|
// The actual name of this output will be set in the geometry handler.
|
||||||
monitor = _glfwAllocMonitor("", 0, 0);
|
monitor = _glfwAllocMonitor(NULL, 0, 0);
|
||||||
|
|
||||||
output = wl_registry_bind(_glfw.wl.registry,
|
output = wl_registry_bind(_glfw.wl.registry,
|
||||||
name,
|
name,
|
||||||
|
|||||||
+11
-4
@@ -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>
|
||||||
//
|
//
|
||||||
@@ -117,6 +117,7 @@ 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_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum xkb_state_component);
|
typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, 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
|
||||||
@@ -128,6 +129,7 @@ typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum
|
|||||||
#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_serialize_mods _glfw.wl.xkb.state_serialize_mods
|
#define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods
|
||||||
|
#define xkb_keymap_layout_get_name _glfw.wl.xkb.keymap_layout_get_name
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
#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);
|
||||||
@@ -158,6 +160,7 @@ typedef enum _GLFWdecorationSideWayland
|
|||||||
leftDecoration,
|
leftDecoration,
|
||||||
rightDecoration,
|
rightDecoration,
|
||||||
bottomDecoration,
|
bottomDecoration,
|
||||||
|
|
||||||
} _GLFWdecorationSideWayland;
|
} _GLFWdecorationSideWayland;
|
||||||
|
|
||||||
typedef struct _GLFWdecorationWayland
|
typedef struct _GLFWdecorationWayland
|
||||||
@@ -165,6 +168,7 @@ 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;
|
} _GLFWdecorationWayland;
|
||||||
|
|
||||||
// Wayland-specific per-window data
|
// Wayland-specific per-window data
|
||||||
@@ -178,7 +182,6 @@ typedef struct _GLFWwindowWayland
|
|||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
struct wl_surface* surface;
|
struct wl_surface* surface;
|
||||||
struct wl_egl_window* native;
|
struct wl_egl_window* native;
|
||||||
struct wl_shell_surface* shellSurface;
|
|
||||||
struct wl_callback* callback;
|
struct wl_callback* callback;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -214,6 +217,7 @@ typedef struct _GLFWwindowWayland
|
|||||||
_GLFWdecorationWayland top, left, right, bottom;
|
_GLFWdecorationWayland top, left, right, bottom;
|
||||||
int focus;
|
int focus;
|
||||||
} decorations;
|
} decorations;
|
||||||
|
|
||||||
} _GLFWwindowWayland;
|
} _GLFWwindowWayland;
|
||||||
|
|
||||||
// Wayland-specific global data
|
// Wayland-specific global data
|
||||||
@@ -224,7 +228,6 @@ typedef struct _GLFWlibraryWayland
|
|||||||
struct wl_registry* registry;
|
struct wl_registry* registry;
|
||||||
struct wl_compositor* compositor;
|
struct wl_compositor* compositor;
|
||||||
struct wl_subcompositor* subcompositor;
|
struct wl_subcompositor* subcompositor;
|
||||||
struct wl_shell* shell;
|
|
||||||
struct wl_shm* shm;
|
struct wl_shm* shm;
|
||||||
struct wl_seat* seat;
|
struct wl_seat* seat;
|
||||||
struct wl_pointer* pointer;
|
struct wl_pointer* pointer;
|
||||||
@@ -249,7 +252,6 @@ 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;
|
||||||
@@ -259,6 +261,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
size_t clipboardSize;
|
size_t clipboardSize;
|
||||||
char* clipboardSendString;
|
char* clipboardSendString;
|
||||||
size_t clipboardSendSize;
|
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];
|
||||||
@@ -280,6 +283,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
xkb_mod_mask_t capsLockMask;
|
xkb_mod_mask_t capsLockMask;
|
||||||
xkb_mod_mask_t numLockMask;
|
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;
|
||||||
@@ -292,6 +296,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
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_serialize_mods state_serialize_mods;
|
PFN_xkb_state_serialize_mods state_serialize_mods;
|
||||||
|
PFN_xkb_keymap_layout_get_name keymap_layout_get_name;
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
#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;
|
||||||
@@ -323,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
|
||||||
@@ -336,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
|
||||||
|
|||||||
+106
-232
@@ -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>
|
||||||
//
|
//
|
||||||
@@ -41,72 +41,6 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
|
||||||
static void shellSurfaceHandlePing(void* data,
|
|
||||||
struct wl_shell_surface* shellSurface,
|
|
||||||
uint32_t serial)
|
|
||||||
{
|
|
||||||
wl_shell_surface_pong(shellSurface, serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void shellSurfaceHandleConfigure(void* data,
|
|
||||||
struct wl_shell_surface* shellSurface,
|
|
||||||
uint32_t edges,
|
|
||||||
int32_t width,
|
|
||||||
int32_t height)
|
|
||||||
{
|
|
||||||
_GLFWwindow* window = data;
|
|
||||||
float aspectRatio;
|
|
||||||
float targetRatio;
|
|
||||||
|
|
||||||
if (!window->monitor)
|
|
||||||
{
|
|
||||||
if (_glfw.wl.viewporter && window->decorated)
|
|
||||||
{
|
|
||||||
width -= _GLFW_DECORATION_HORIZONTAL;
|
|
||||||
height -= _GLFW_DECORATION_VERTICAL;
|
|
||||||
}
|
|
||||||
if (width < 1)
|
|
||||||
width = 1;
|
|
||||||
if (height < 1)
|
|
||||||
height = 1;
|
|
||||||
|
|
||||||
if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE)
|
|
||||||
{
|
|
||||||
aspectRatio = (float)width / (float)height;
|
|
||||||
targetRatio = (float)window->numer / (float)window->denom;
|
|
||||||
if (aspectRatio < targetRatio)
|
|
||||||
height = width / targetRatio;
|
|
||||||
else if (aspectRatio > targetRatio)
|
|
||||||
width = height * targetRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->minwidth != GLFW_DONT_CARE && width < window->minwidth)
|
|
||||||
width = window->minwidth;
|
|
||||||
else if (window->maxwidth != GLFW_DONT_CARE && width > window->maxwidth)
|
|
||||||
width = window->maxwidth;
|
|
||||||
|
|
||||||
if (window->minheight != GLFW_DONT_CARE && height < window->minheight)
|
|
||||||
height = window->minheight;
|
|
||||||
else if (window->maxheight != GLFW_DONT_CARE && height > window->maxheight)
|
|
||||||
height = window->maxheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwInputWindowSize(window, width, height);
|
|
||||||
_glfwPlatformSetWindowSize(window, width, height);
|
|
||||||
_glfwInputWindowDamage(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void shellSurfaceHandlePopupDone(void* data,
|
|
||||||
struct wl_shell_surface* shellSurface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wl_shell_surface_listener shellSurfaceListener = {
|
|
||||||
shellSurfaceHandlePing,
|
|
||||||
shellSurfaceHandleConfigure,
|
|
||||||
shellSurfaceHandlePopupDone
|
|
||||||
};
|
|
||||||
|
|
||||||
static int createTmpfileCloexec(char* tmpname)
|
static int createTmpfileCloexec(char* tmpname)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@@ -208,8 +142,8 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Wayland: Creating a buffer file for %d B failed: %s",
|
"Wayland: Creating a buffer file for %d B failed: %m",
|
||||||
length, strerror(errno));
|
length);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +151,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
|
|||||||
if (data == MAP_FAILED)
|
if (data == MAP_FAILED)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Wayland: mmap failed: %s", strerror(errno));
|
"Wayland: mmap failed: %m");
|
||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -312,10 +246,10 @@ static void createDecorations(_GLFWwindow* window)
|
|||||||
|
|
||||||
static void destroyDecoration(_GLFWdecorationWayland* decoration)
|
static void destroyDecoration(_GLFWdecorationWayland* decoration)
|
||||||
{
|
{
|
||||||
if (decoration->subsurface)
|
|
||||||
wl_subsurface_destroy(decoration->subsurface);
|
|
||||||
if (decoration->surface)
|
if (decoration->surface)
|
||||||
wl_surface_destroy(decoration->surface);
|
wl_surface_destroy(decoration->surface);
|
||||||
|
if (decoration->subsurface)
|
||||||
|
wl_subsurface_destroy(decoration->subsurface);
|
||||||
if (decoration->viewport)
|
if (decoration->viewport)
|
||||||
wp_viewport_destroy(decoration->viewport);
|
wp_viewport_destroy(decoration->viewport);
|
||||||
decoration->surface = NULL;
|
decoration->surface = NULL;
|
||||||
@@ -531,66 +465,11 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor,
|
|||||||
window->wl.xdg.toplevel,
|
window->wl.xdg.toplevel,
|
||||||
monitor->wl.output);
|
monitor->wl.output);
|
||||||
}
|
}
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
wl_shell_surface_set_fullscreen(
|
|
||||||
window->wl.shellSurface,
|
|
||||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
|
||||||
refreshRate * 1000, // Convert Hz to mHz.
|
|
||||||
monitor->wl.output);
|
|
||||||
}
|
|
||||||
setIdleInhibitor(window, GLFW_TRUE);
|
setIdleInhibitor(window, GLFW_TRUE);
|
||||||
if (!window->wl.decorations.serverSide)
|
if (!window->wl.decorations.serverSide)
|
||||||
destroyDecorations(window);
|
destroyDecorations(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLFWbool createShellSurface(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (!_glfw.wl.shell)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: wl_shell protocol not available");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell,
|
|
||||||
window->wl.surface);
|
|
||||||
if (!window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: Shell surface creation failed");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_shell_surface_add_listener(window->wl.shellSurface,
|
|
||||||
&shellSurfaceListener,
|
|
||||||
window);
|
|
||||||
|
|
||||||
if (window->wl.title)
|
|
||||||
wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title);
|
|
||||||
|
|
||||||
if (window->monitor)
|
|
||||||
{
|
|
||||||
setFullscreen(window, window->monitor, 0);
|
|
||||||
}
|
|
||||||
else if (window->wl.maximized)
|
|
||||||
{
|
|
||||||
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
|
|
||||||
setIdleInhibitor(window, GLFW_FALSE);
|
|
||||||
createDecorations(window);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
|
||||||
setIdleInhibitor(window, GLFW_FALSE);
|
|
||||||
createDecorations(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_surface_commit(window->wl.surface);
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xdgToplevelHandleConfigure(void* data,
|
static void xdgToplevelHandleConfigure(void* data,
|
||||||
struct xdg_toplevel* toplevel,
|
struct xdg_toplevel* toplevel,
|
||||||
int32_t width,
|
int32_t width,
|
||||||
@@ -796,7 +675,7 @@ static void setCursorImage(_GLFWwindow* window,
|
|||||||
cursorWayland->yhot = image->hotspot_y;
|
cursorWayland->yhot = image->hotspot_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
|
||||||
surface,
|
surface,
|
||||||
cursorWayland->xhot / scale,
|
cursorWayland->xhot / scale,
|
||||||
cursorWayland->yhot / scale);
|
cursorWayland->yhot / scale);
|
||||||
@@ -870,18 +749,11 @@ static void handleEvents(int timeout)
|
|||||||
if (read_ret != 8)
|
if (read_ret != 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_glfw.wl.keyboardFocus)
|
|
||||||
{
|
|
||||||
for (i = 0; i < repeats; ++i)
|
for (i = 0; i < repeats; ++i)
|
||||||
{
|
_glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey,
|
||||||
_glfwInputKey(_glfw.wl.keyboardFocus,
|
_glfw.wl.keyboardLastScancode, GLFW_REPEAT,
|
||||||
_glfw.wl.keyboardLastKey,
|
|
||||||
_glfw.wl.keyboardLastScancode,
|
|
||||||
GLFW_REPEAT,
|
|
||||||
_glfw.wl.xkb.modifiers);
|
_glfw.wl.xkb.modifiers);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fds[2].revents & POLLIN)
|
if (fds[2].revents & POLLIN)
|
||||||
{
|
{
|
||||||
@@ -898,28 +770,6 @@ static void handleEvents(int timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translates a GLFW standard cursor to a theme cursor name
|
|
||||||
//
|
|
||||||
static char *translateCursorShape(int shape)
|
|
||||||
{
|
|
||||||
switch (shape)
|
|
||||||
{
|
|
||||||
case GLFW_ARROW_CURSOR:
|
|
||||||
return "left_ptr";
|
|
||||||
case GLFW_IBEAM_CURSOR:
|
|
||||||
return "xterm";
|
|
||||||
case GLFW_CROSSHAIR_CURSOR:
|
|
||||||
return "crosshair";
|
|
||||||
case GLFW_HAND_CURSOR:
|
|
||||||
return "hand2";
|
|
||||||
case GLFW_HRESIZE_CURSOR:
|
|
||||||
return "sb_h_double_arrow";
|
|
||||||
case GLFW_VRESIZE_CURSOR:
|
|
||||||
return "sb_v_double_arrow";
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@@ -957,17 +807,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
window->wl.title = _glfw_strdup(wndconfig->title);
|
window->wl.title = _glfw_strdup(wndconfig->title);
|
||||||
|
|
||||||
if (wndconfig->visible)
|
if (wndconfig->visible)
|
||||||
{
|
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
{
|
||||||
if (!createXdgSurface(window))
|
if (!createXdgSurface(window))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!createShellSurface(window))
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
window->wl.visible = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
@@ -975,7 +817,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
window->wl.xdg.surface = NULL;
|
window->wl.xdg.surface = NULL;
|
||||||
window->wl.xdg.toplevel = NULL;
|
window->wl.xdg.toplevel = NULL;
|
||||||
window->wl.shellSurface = NULL;
|
|
||||||
window->wl.visible = GLFW_FALSE;
|
window->wl.visible = GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1017,9 +858,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
if (window->wl.native)
|
if (window->wl.native)
|
||||||
wl_egl_window_destroy(window->wl.native);
|
wl_egl_window_destroy(window->wl.native);
|
||||||
|
|
||||||
if (window->wl.shellSurface)
|
|
||||||
wl_shell_surface_destroy(window->wl.shellSurface);
|
|
||||||
|
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
||||||
|
|
||||||
@@ -1040,8 +878,6 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
window->wl.title = _glfw_strdup(title);
|
window->wl.title = _glfw_strdup(title);
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
|
xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
wl_shell_surface_set_title(window->wl.shellSurface, title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
||||||
@@ -1086,8 +922,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
||||||
int minwidth, int minheight,
|
int minwidth, int minheight,
|
||||||
int maxwidth, int maxheight)
|
int maxwidth, int maxheight)
|
||||||
{
|
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
{
|
{
|
||||||
@@ -1100,27 +934,19 @@ void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
|||||||
wl_surface_commit(window->wl.surface);
|
wl_surface_commit(window->wl.surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: find out how to trigger a resize.
|
|
||||||
// The actual limits are checked in the wl_shell_surface::configure handler.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window,
|
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window,
|
||||||
int numer, int denom)
|
int numer, int denom)
|
||||||
{
|
{
|
||||||
// TODO: find out how to trigger a resize.
|
// TODO: find out how to trigger a resize.
|
||||||
// The actual limits are checked in the wl_shell_surface::configure handler.
|
// The actual limits are checked in the xdg_toplevel::configure handler.
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
|
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
|
||||||
int* width, int* height)
|
int* width, int* height)
|
||||||
{
|
{
|
||||||
_glfwPlatformGetWindowSize(window, width, height);
|
_glfwPlatformGetWindowSize(window, width, height);
|
||||||
if (width)
|
|
||||||
*width *= window->wl.scale;
|
*width *= window->wl.scale;
|
||||||
if (height)
|
|
||||||
*height *= window->wl.scale;
|
*height *= window->wl.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1151,18 +977,10 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
|
xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: Iconify window not supported on wl_shell");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@@ -1173,12 +991,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
if (window->wl.maximized)
|
if (window->wl.maximized)
|
||||||
xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
|
xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
|
||||||
// There is no way to unset minimized, or even to know if we are
|
// There is no way to unset minimized, or even to know if we are
|
||||||
// minimized, so there is nothing to do here.
|
// minimized, so there is nothing to do in this case.
|
||||||
}
|
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
if (window->monitor || window->wl.maximized)
|
|
||||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
|
||||||
}
|
}
|
||||||
_glfwInputWindowMonitor(window, NULL);
|
_glfwInputWindowMonitor(window, NULL);
|
||||||
window->wl.maximized = GLFW_FALSE;
|
window->wl.maximized = GLFW_FALSE;
|
||||||
@@ -1190,11 +1003,6 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
|
xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
|
||||||
}
|
}
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
// Let the compositor select the best output.
|
|
||||||
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
|
|
||||||
}
|
|
||||||
window->wl.maximized = GLFW_TRUE;
|
window->wl.maximized = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,10 +1010,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (!window->wl.visible)
|
if (!window->wl.visible)
|
||||||
{
|
{
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
createXdgSurface(window);
|
createXdgSurface(window);
|
||||||
else if (!window->wl.shellSurface)
|
|
||||||
createShellSurface(window);
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
window->wl.visible = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1219,11 +1024,6 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||||||
window->wl.xdg.toplevel = NULL;
|
window->wl.xdg.toplevel = NULL;
|
||||||
window->wl.xdg.surface = NULL;
|
window->wl.xdg.surface = NULL;
|
||||||
}
|
}
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
wl_shell_surface_destroy(window->wl.shellSurface);
|
|
||||||
window->wl.shellSurface = NULL;
|
|
||||||
}
|
|
||||||
window->wl.visible = GLFW_FALSE;
|
window->wl.visible = GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1254,8 +1054,6 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
|
||||||
setIdleInhibitor(window, GLFW_FALSE);
|
setIdleInhibitor(window, GLFW_FALSE);
|
||||||
if (!_glfw.wl.decorationManager)
|
if (!_glfw.wl.decorationManager)
|
||||||
createDecorations(window);
|
createDecorations(window);
|
||||||
@@ -1270,8 +1068,8 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
|||||||
|
|
||||||
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// wl_shell doesn't have any iconified concept, and xdg-shell doesn’t give
|
// xdg-shell doesn’t give any way to request whether a surface is
|
||||||
// any way to request whether a surface is iconified.
|
// iconified.
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1396,6 +1194,29 @@ int _glfwPlatformGetKeyScancode(int key)
|
|||||||
return _glfw.wl.scancodes[key];
|
return _glfw.wl.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetKeyboardLayoutName(void)
|
||||||
|
{
|
||||||
|
if (!_glfw.wl.xkb.keymap)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Keymap missing");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* name = xkb_keymap_layout_get_name(_glfw.wl.xkb.keymap,
|
||||||
|
_glfw.wl.xkb.group);
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to query keyboard layout name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_glfw.wl.keyboardLayoutName);
|
||||||
|
_glfw.wl.keyboardLayoutName = _glfw_strdup(name);
|
||||||
|
return _glfw.wl.keyboardLayoutName;
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
@@ -1413,26 +1234,79 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
struct wl_cursor* standardCursor;
|
const char* name = NULL;
|
||||||
|
|
||||||
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,
|
// Try the XDG names first
|
||||||
translateCursorShape(shape));
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
if (!standardCursor)
|
name = "default";
|
||||||
{
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
name = "text";
|
||||||
"Wayland: Standard cursor \"%s\" not found",
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
translateCursorShape(shape));
|
name = "crosshair";
|
||||||
return GLFW_FALSE;
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
}
|
name = "pointer";
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
name = "ew-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
name = "ns-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
name = "nwse-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
name = "nesw-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
name = "all-scroll";
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
name = "not-allowed";
|
||||||
|
|
||||||
cursor->wl.cursor = standardCursor;
|
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
|
||||||
cursor->wl.currentImage = 0;
|
|
||||||
|
|
||||||
if (_glfw.wl.cursorThemeHiDPI)
|
if (_glfw.wl.cursorThemeHiDPI)
|
||||||
{
|
{
|
||||||
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI,
|
cursor->wl.cursorHiDPI =
|
||||||
translateCursorShape(shape));
|
wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
|
||||||
cursor->wl.cursorHiDPI = standardCursor;
|
}
|
||||||
|
|
||||||
|
if (!cursor->wl.cursor)
|
||||||
|
{
|
||||||
|
// Fall back to the core X11 names
|
||||||
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
|
name = "left_ptr";
|
||||||
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
|
name = "xterm";
|
||||||
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
|
name = "crosshair";
|
||||||
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
|
name = "hand2";
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
name = "sb_h_double_arrow";
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
name = "sb_v_double_arrow";
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
name = "fleur";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
|
"Wayland: Standard cursor shape unavailable");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
|
||||||
|
if (!cursor->wl.cursor)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to create standard cursor \"%s\"",
|
||||||
|
name);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.wl.cursorThemeHiDPI)
|
||||||
|
{
|
||||||
|
if (!cursor->wl.cursorHiDPI)
|
||||||
|
{
|
||||||
|
cursor->wl.cursorHiDPI =
|
||||||
|
wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@@ -1547,7 +1421,7 @@ static void lockPointer(_GLFWwindow* window)
|
|||||||
window->wl.pointerLock.relativePointer = relativePointer;
|
window->wl.pointerLock.relativePointer = relativePointer;
|
||||||
window->wl.pointerLock.lockedPointer = lockedPointer;
|
window->wl.pointerLock.lockedPointer = lockedPointer;
|
||||||
|
|
||||||
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
|
||||||
NULL, 0, 0);
|
NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1611,7 +1485,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
}
|
}
|
||||||
else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||||
{
|
{
|
||||||
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0);
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+297
-31
@@ -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,13 +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>
|
||||||
|
|
||||||
|
|
||||||
// Translate the X11 KeySyms for a key to a GLFW key code
|
// Translate the X11 KeySyms for a key to a GLFW key code
|
||||||
@@ -456,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;
|
||||||
@@ -532,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);
|
||||||
@@ -721,6 +754,12 @@ 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__)
|
||||||
@@ -766,12 +805,13 @@ 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__)
|
||||||
@@ -1046,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();
|
||||||
|
|
||||||
@@ -1083,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__)
|
||||||
@@ -1128,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);
|
||||||
@@ -1190,6 +1450,12 @@ void _glfwPlatformTerminate(void)
|
|||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
_glfwTerminateJoysticksLinux();
|
_glfwTerminateJoysticksLinux();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (_glfw.x11.xlib.handle)
|
||||||
|
{
|
||||||
|
_glfw_dlclose(_glfw.x11.xlib.handle);
|
||||||
|
_glfw.x11.xlib.handle = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
|
|||||||
+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);
|
||||||
|
|||||||
+333
-4
@@ -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>
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/Xresource.h>
|
||||||
#include <X11/Xcursor/Xcursor.h>
|
#include <X11/Xcursor/Xcursor.h>
|
||||||
|
|
||||||
// The XRandR extension provides mode setting and gamma control
|
// The XRandR extension provides mode setting and gamma control
|
||||||
@@ -47,6 +48,211 @@
|
|||||||
// The XInput extension provides raw mouse motion input
|
// The XInput extension provides raw mouse motion input
|
||||||
#include <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
|
|
||||||
|
typedef XClassHint* (* PFN_XAllocClassHint)(void);
|
||||||
|
typedef XSizeHints* (* PFN_XAllocSizeHints)(void);
|
||||||
|
typedef XWMHints* (* PFN_XAllocWMHints)(void);
|
||||||
|
typedef int (* PFN_XChangeProperty)(Display*,Window,Atom,Atom,int,int,const unsigned char*,int);
|
||||||
|
typedef int (* PFN_XChangeWindowAttributes)(Display*,Window,unsigned long,XSetWindowAttributes*);
|
||||||
|
typedef Bool (* PFN_XCheckIfEvent)(Display*,XEvent*,Bool(*)(Display*,XEvent*,XPointer),XPointer);
|
||||||
|
typedef Bool (* PFN_XCheckTypedWindowEvent)(Display*,Window,int,XEvent*);
|
||||||
|
typedef int (* PFN_XCloseDisplay)(Display*);
|
||||||
|
typedef Status (* PFN_XCloseIM)(XIM);
|
||||||
|
typedef int (* PFN_XConvertSelection)(Display*,Atom,Atom,Atom,Window,Time);
|
||||||
|
typedef Colormap (* PFN_XCreateColormap)(Display*,Window,Visual*,int);
|
||||||
|
typedef Cursor (* PFN_XCreateFontCursor)(Display*,unsigned int);
|
||||||
|
typedef XIC (* PFN_XCreateIC)(XIM,...);
|
||||||
|
typedef Window (* PFN_XCreateWindow)(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,int,unsigned int,Visual*,unsigned long,XSetWindowAttributes*);
|
||||||
|
typedef int (* PFN_XDefineCursor)(Display*,Window,Cursor);
|
||||||
|
typedef int (* PFN_XDeleteContext)(Display*,XID,XContext);
|
||||||
|
typedef int (* PFN_XDeleteProperty)(Display*,Window,Atom);
|
||||||
|
typedef void (* PFN_XDestroyIC)(XIC);
|
||||||
|
typedef int (* PFN_XDestroyWindow)(Display*,Window);
|
||||||
|
typedef int (* PFN_XDisplayKeycodes)(Display*,int*,int*);
|
||||||
|
typedef int (* PFN_XEventsQueued)(Display*,int);
|
||||||
|
typedef Bool (* PFN_XFilterEvent)(XEvent*,Window);
|
||||||
|
typedef int (* PFN_XFindContext)(Display*,XID,XContext,XPointer*);
|
||||||
|
typedef int (* PFN_XFlush)(Display*);
|
||||||
|
typedef int (* PFN_XFree)(void*);
|
||||||
|
typedef int (* PFN_XFreeColormap)(Display*,Colormap);
|
||||||
|
typedef int (* PFN_XFreeCursor)(Display*,Cursor);
|
||||||
|
typedef void (* PFN_XFreeEventData)(Display*,XGenericEventCookie*);
|
||||||
|
typedef char* (* PFN_XGetAtomName)(Display*,Atom);
|
||||||
|
typedef int (* PFN_XGetErrorText)(Display*,int,char*,int);
|
||||||
|
typedef Bool (* PFN_XGetEventData)(Display*,XGenericEventCookie*);
|
||||||
|
typedef char* (* PFN_XGetICValues)(XIC,...);
|
||||||
|
typedef char* (* PFN_XGetIMValues)(XIM,...);
|
||||||
|
typedef int (* PFN_XGetInputFocus)(Display*,Window*,int*);
|
||||||
|
typedef KeySym* (* PFN_XGetKeyboardMapping)(Display*,KeyCode,int,int*);
|
||||||
|
typedef int (* PFN_XGetScreenSaver)(Display*,int*,int*,int*,int*);
|
||||||
|
typedef Window (* PFN_XGetSelectionOwner)(Display*,Atom);
|
||||||
|
typedef XVisualInfo* (* PFN_XGetVisualInfo)(Display*,long,XVisualInfo*,int*);
|
||||||
|
typedef Status (* PFN_XGetWMNormalHints)(Display*,Window,XSizeHints*,long*);
|
||||||
|
typedef Status (* PFN_XGetWindowAttributes)(Display*,Window,XWindowAttributes*);
|
||||||
|
typedef int (* PFN_XGetWindowProperty)(Display*,Window,Atom,long,long,Bool,Atom,Atom*,int*,unsigned long*,unsigned long*,unsigned char**);
|
||||||
|
typedef int (* PFN_XGrabPointer)(Display*,Window,Bool,unsigned int,int,int,Window,Cursor,Time);
|
||||||
|
typedef Status (* PFN_XIconifyWindow)(Display*,Window,int);
|
||||||
|
typedef Status (* PFN_XInitThreads)(void);
|
||||||
|
typedef Atom (* PFN_XInternAtom)(Display*,const char*,Bool);
|
||||||
|
typedef int (* PFN_XLookupString)(XKeyEvent*,char*,int,KeySym*,XComposeStatus*);
|
||||||
|
typedef int (* PFN_XMapRaised)(Display*,Window);
|
||||||
|
typedef int (* PFN_XMapWindow)(Display*,Window);
|
||||||
|
typedef int (* PFN_XMoveResizeWindow)(Display*,Window,int,int,unsigned int,unsigned int);
|
||||||
|
typedef int (* PFN_XMoveWindow)(Display*,Window,int,int);
|
||||||
|
typedef int (* PFN_XNextEvent)(Display*,XEvent*);
|
||||||
|
typedef Display* (* PFN_XOpenDisplay)(const char*);
|
||||||
|
typedef XIM (* PFN_XOpenIM)(Display*,XrmDatabase*,char*,char*);
|
||||||
|
typedef int (* PFN_XPeekEvent)(Display*,XEvent*);
|
||||||
|
typedef int (* PFN_XPending)(Display*);
|
||||||
|
typedef Bool (* PFN_XQueryExtension)(Display*,const char*,int*,int*,int*);
|
||||||
|
typedef Bool (* PFN_XQueryPointer)(Display*,Window,Window*,Window*,int*,int*,int*,int*,unsigned int*);
|
||||||
|
typedef int (* PFN_XRaiseWindow)(Display*,Window);
|
||||||
|
typedef Bool (* PFN_XRegisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer);
|
||||||
|
typedef int (* PFN_XResizeWindow)(Display*,Window,unsigned int,unsigned int);
|
||||||
|
typedef char* (* PFN_XResourceManagerString)(Display*);
|
||||||
|
typedef int (* PFN_XSaveContext)(Display*,XID,XContext,const char*);
|
||||||
|
typedef int (* PFN_XSelectInput)(Display*,Window,long);
|
||||||
|
typedef Status (* PFN_XSendEvent)(Display*,Window,Bool,long,XEvent*);
|
||||||
|
typedef int (* PFN_XSetClassHint)(Display*,Window,XClassHint*);
|
||||||
|
typedef XErrorHandler (* PFN_XSetErrorHandler)(XErrorHandler);
|
||||||
|
typedef void (* PFN_XSetICFocus)(XIC);
|
||||||
|
typedef char* (* PFN_XSetIMValues)(XIM,...);
|
||||||
|
typedef int (* PFN_XSetInputFocus)(Display*,Window,int,Time);
|
||||||
|
typedef char* (* PFN_XSetLocaleModifiers)(const char*);
|
||||||
|
typedef int (* PFN_XSetScreenSaver)(Display*,int,int,int,int);
|
||||||
|
typedef int (* PFN_XSetSelectionOwner)(Display*,Atom,Window,Time);
|
||||||
|
typedef int (* PFN_XSetWMHints)(Display*,Window,XWMHints*);
|
||||||
|
typedef void (* PFN_XSetWMNormalHints)(Display*,Window,XSizeHints*);
|
||||||
|
typedef Status (* PFN_XSetWMProtocols)(Display*,Window,Atom*,int);
|
||||||
|
typedef Bool (* PFN_XSupportsLocale)(void);
|
||||||
|
typedef int (* PFN_XSync)(Display*,Bool);
|
||||||
|
typedef Bool (* PFN_XTranslateCoordinates)(Display*,Window,Window,int,int,int*,int*,Window*);
|
||||||
|
typedef int (* PFN_XUndefineCursor)(Display*,Window);
|
||||||
|
typedef int (* PFN_XUngrabPointer)(Display*,Time);
|
||||||
|
typedef int (* PFN_XUnmapWindow)(Display*,Window);
|
||||||
|
typedef void (* PFN_XUnsetICFocus)(XIC);
|
||||||
|
typedef VisualID (* PFN_XVisualIDFromVisual)(Visual*);
|
||||||
|
typedef int (* PFN_XWarpPointer)(Display*,Window,Window,int,int,unsigned int,unsigned int,int,int);
|
||||||
|
typedef void (* PFN_XkbFreeKeyboard)(XkbDescPtr,unsigned int,Bool);
|
||||||
|
typedef void (* PFN_XkbFreeNames)(XkbDescPtr,unsigned int,Bool);
|
||||||
|
typedef XkbDescPtr (* PFN_XkbAllocKeyboard)(void);
|
||||||
|
typedef XkbDescPtr (* PFN_XkbGetMap)(Display*,unsigned int,unsigned int);
|
||||||
|
typedef Status (* PFN_XkbGetNames)(Display*,unsigned int,XkbDescPtr);
|
||||||
|
typedef Status (* PFN_XkbGetState)(Display*,unsigned int,XkbStatePtr);
|
||||||
|
typedef KeySym (* PFN_XkbKeycodeToKeysym)(Display*,KeyCode,int,int);
|
||||||
|
typedef Bool (* PFN_XkbQueryExtension)(Display*,int*,int*,int*,int*,int*);
|
||||||
|
typedef Bool (* PFN_XkbSelectEventDetails)(Display*,unsigned int,unsigned int,unsigned long,unsigned long);
|
||||||
|
typedef Bool (* PFN_XkbSetDetectableAutoRepeat)(Display*,Bool,Bool*);
|
||||||
|
typedef void (* PFN_XrmDestroyDatabase)(XrmDatabase);
|
||||||
|
typedef Bool (* PFN_XrmGetResource)(XrmDatabase,const char*,const char*,char**,XrmValue*);
|
||||||
|
typedef XrmDatabase (* PFN_XrmGetStringDatabase)(const char*);
|
||||||
|
typedef void (* PFN_XrmInitialize)(void);
|
||||||
|
typedef XrmQuark (* PFN_XrmUniqueQuark)(void);
|
||||||
|
typedef Bool (* PFN_XUnregisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer);
|
||||||
|
typedef int (* PFN_Xutf8LookupString)(XIC,XKeyPressedEvent*,char*,int,KeySym*,Status*);
|
||||||
|
typedef void (* PFN_Xutf8SetWMProperties)(Display*,Window,const char*,const char*,char**,int,XSizeHints*,XWMHints*,XClassHint*);
|
||||||
|
#define XAllocClassHint _glfw.x11.xlib.AllocClassHint
|
||||||
|
#define XAllocSizeHints _glfw.x11.xlib.AllocSizeHints
|
||||||
|
#define XAllocWMHints _glfw.x11.xlib.AllocWMHints
|
||||||
|
#define XChangeProperty _glfw.x11.xlib.ChangeProperty
|
||||||
|
#define XChangeWindowAttributes _glfw.x11.xlib.ChangeWindowAttributes
|
||||||
|
#define XCheckIfEvent _glfw.x11.xlib.CheckIfEvent
|
||||||
|
#define XCheckTypedWindowEvent _glfw.x11.xlib.CheckTypedWindowEvent
|
||||||
|
#define XCloseDisplay _glfw.x11.xlib.CloseDisplay
|
||||||
|
#define XCloseIM _glfw.x11.xlib.CloseIM
|
||||||
|
#define XConvertSelection _glfw.x11.xlib.ConvertSelection
|
||||||
|
#define XCreateColormap _glfw.x11.xlib.CreateColormap
|
||||||
|
#define XCreateFontCursor _glfw.x11.xlib.CreateFontCursor
|
||||||
|
#define XCreateIC _glfw.x11.xlib.CreateIC
|
||||||
|
#define XCreateWindow _glfw.x11.xlib.CreateWindow
|
||||||
|
#define XDefineCursor _glfw.x11.xlib.DefineCursor
|
||||||
|
#define XDeleteContext _glfw.x11.xlib.DeleteContext
|
||||||
|
#define XDeleteProperty _glfw.x11.xlib.DeleteProperty
|
||||||
|
#define XDestroyIC _glfw.x11.xlib.DestroyIC
|
||||||
|
#define XDestroyWindow _glfw.x11.xlib.DestroyWindow
|
||||||
|
#define XDisplayKeycodes _glfw.x11.xlib.DisplayKeycodes
|
||||||
|
#define XEventsQueued _glfw.x11.xlib.EventsQueued
|
||||||
|
#define XFilterEvent _glfw.x11.xlib.FilterEvent
|
||||||
|
#define XFindContext _glfw.x11.xlib.FindContext
|
||||||
|
#define XFlush _glfw.x11.xlib.Flush
|
||||||
|
#define XFree _glfw.x11.xlib.Free
|
||||||
|
#define XFreeColormap _glfw.x11.xlib.FreeColormap
|
||||||
|
#define XFreeCursor _glfw.x11.xlib.FreeCursor
|
||||||
|
#define XFreeEventData _glfw.x11.xlib.FreeEventData
|
||||||
|
#define XGetAtomName _glfw.x11.xlib.GetAtomName
|
||||||
|
#define XGetErrorText _glfw.x11.xlib.GetErrorText
|
||||||
|
#define XGetEventData _glfw.x11.xlib.GetEventData
|
||||||
|
#define XGetICValues _glfw.x11.xlib.GetICValues
|
||||||
|
#define XGetIMValues _glfw.x11.xlib.GetIMValues
|
||||||
|
#define XGetInputFocus _glfw.x11.xlib.GetInputFocus
|
||||||
|
#define XGetKeyboardMapping _glfw.x11.xlib.GetKeyboardMapping
|
||||||
|
#define XGetScreenSaver _glfw.x11.xlib.GetScreenSaver
|
||||||
|
#define XGetSelectionOwner _glfw.x11.xlib.GetSelectionOwner
|
||||||
|
#define XGetVisualInfo _glfw.x11.xlib.GetVisualInfo
|
||||||
|
#define XGetWMNormalHints _glfw.x11.xlib.GetWMNormalHints
|
||||||
|
#define XGetWindowAttributes _glfw.x11.xlib.GetWindowAttributes
|
||||||
|
#define XGetWindowProperty _glfw.x11.xlib.GetWindowProperty
|
||||||
|
#define XGrabPointer _glfw.x11.xlib.GrabPointer
|
||||||
|
#define XIconifyWindow _glfw.x11.xlib.IconifyWindow
|
||||||
|
#define XInitThreads _glfw.x11.xlib.InitThreads
|
||||||
|
#define XInternAtom _glfw.x11.xlib.InternAtom
|
||||||
|
#define XLookupString _glfw.x11.xlib.LookupString
|
||||||
|
#define XMapRaised _glfw.x11.xlib.MapRaised
|
||||||
|
#define XMapWindow _glfw.x11.xlib.MapWindow
|
||||||
|
#define XMoveResizeWindow _glfw.x11.xlib.MoveResizeWindow
|
||||||
|
#define XMoveWindow _glfw.x11.xlib.MoveWindow
|
||||||
|
#define XNextEvent _glfw.x11.xlib.NextEvent
|
||||||
|
#define XOpenDisplay _glfw.x11.xlib.OpenDisplay
|
||||||
|
#define XOpenIM _glfw.x11.xlib.OpenIM
|
||||||
|
#define XPeekEvent _glfw.x11.xlib.PeekEvent
|
||||||
|
#define XPending _glfw.x11.xlib.Pending
|
||||||
|
#define XQueryExtension _glfw.x11.xlib.QueryExtension
|
||||||
|
#define XQueryPointer _glfw.x11.xlib.QueryPointer
|
||||||
|
#define XRaiseWindow _glfw.x11.xlib.RaiseWindow
|
||||||
|
#define XRegisterIMInstantiateCallback _glfw.x11.xlib.RegisterIMInstantiateCallback
|
||||||
|
#define XResizeWindow _glfw.x11.xlib.ResizeWindow
|
||||||
|
#define XResourceManagerString _glfw.x11.xlib.ResourceManagerString
|
||||||
|
#define XSaveContext _glfw.x11.xlib.SaveContext
|
||||||
|
#define XSelectInput _glfw.x11.xlib.SelectInput
|
||||||
|
#define XSendEvent _glfw.x11.xlib.SendEvent
|
||||||
|
#define XSetClassHint _glfw.x11.xlib.SetClassHint
|
||||||
|
#define XSetErrorHandler _glfw.x11.xlib.SetErrorHandler
|
||||||
|
#define XSetICFocus _glfw.x11.xlib.SetICFocus
|
||||||
|
#define XSetIMValues _glfw.x11.xlib.SetIMValues
|
||||||
|
#define XSetInputFocus _glfw.x11.xlib.SetInputFocus
|
||||||
|
#define XSetLocaleModifiers _glfw.x11.xlib.SetLocaleModifiers
|
||||||
|
#define XSetScreenSaver _glfw.x11.xlib.SetScreenSaver
|
||||||
|
#define XSetSelectionOwner _glfw.x11.xlib.SetSelectionOwner
|
||||||
|
#define XSetWMHints _glfw.x11.xlib.SetWMHints
|
||||||
|
#define XSetWMNormalHints _glfw.x11.xlib.SetWMNormalHints
|
||||||
|
#define XSetWMProtocols _glfw.x11.xlib.SetWMProtocols
|
||||||
|
#define XSupportsLocale _glfw.x11.xlib.SupportsLocale
|
||||||
|
#define XSync _glfw.x11.xlib.Sync
|
||||||
|
#define XTranslateCoordinates _glfw.x11.xlib.TranslateCoordinates
|
||||||
|
#define XUndefineCursor _glfw.x11.xlib.UndefineCursor
|
||||||
|
#define XUngrabPointer _glfw.x11.xlib.UngrabPointer
|
||||||
|
#define XUnmapWindow _glfw.x11.xlib.UnmapWindow
|
||||||
|
#define XUnsetICFocus _glfw.x11.xlib.UnsetICFocus
|
||||||
|
#define XVisualIDFromVisual _glfw.x11.xlib.VisualIDFromVisual
|
||||||
|
#define XWarpPointer _glfw.x11.xlib.WarpPointer
|
||||||
|
#define XkbAllocKeyboard _glfw.x11.xkb.AllocKeyboard
|
||||||
|
#define XkbFreeKeyboard _glfw.x11.xkb.FreeKeyboard
|
||||||
|
#define XkbFreeNames _glfw.x11.xkb.FreeNames
|
||||||
|
#define XkbGetMap _glfw.x11.xkb.GetMap
|
||||||
|
#define XkbGetNames _glfw.x11.xkb.GetNames
|
||||||
|
#define XkbGetState _glfw.x11.xkb.GetState
|
||||||
|
#define XkbKeycodeToKeysym _glfw.x11.xkb.KeycodeToKeysym
|
||||||
|
#define XkbQueryExtension _glfw.x11.xkb.QueryExtension
|
||||||
|
#define XkbSelectEventDetails _glfw.x11.xkb.SelectEventDetails
|
||||||
|
#define XkbSetDetectableAutoRepeat _glfw.x11.xkb.SetDetectableAutoRepeat
|
||||||
|
#define XrmDestroyDatabase _glfw.x11.xrm.DestroyDatabase
|
||||||
|
#define XrmGetResource _glfw.x11.xrm.GetResource
|
||||||
|
#define XrmGetStringDatabase _glfw.x11.xrm.GetStringDatabase
|
||||||
|
#define XrmInitialize _glfw.x11.xrm.Initialize
|
||||||
|
#define XrmUniqueQuark _glfw.x11.xrm.UniqueQuark
|
||||||
|
#define XUnregisterIMInstantiateCallback _glfw.x11.xlib.UnregisterIMInstantiateCallback
|
||||||
|
#define Xutf8LookupString _glfw.x11.xlib.utf8LookupString
|
||||||
|
#define Xutf8SetWMProperties _glfw.x11.xlib.utf8SetWMProperties
|
||||||
|
|
||||||
typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int);
|
typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int);
|
||||||
typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*);
|
typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*);
|
||||||
typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*);
|
typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*);
|
||||||
@@ -85,9 +291,15 @@ typedef int (* PFN_XRRUpdateConfiguration)(XEvent*);
|
|||||||
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
|
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
|
||||||
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
|
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
|
||||||
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
|
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
|
||||||
|
typedef char* (* PFN_XcursorGetTheme)(Display*);
|
||||||
|
typedef int (* PFN_XcursorGetDefaultSize)(Display*);
|
||||||
|
typedef XcursorImage* (* PFN_XcursorLibraryLoadImage)(const char*,const char*,int);
|
||||||
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
|
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
|
||||||
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
|
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
|
||||||
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
|
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
|
||||||
|
#define XcursorGetTheme _glfw.x11.xcursor.GetTheme
|
||||||
|
#define XcursorGetDefaultSize _glfw.x11.xcursor.GetDefaultSize
|
||||||
|
#define XcursorLibraryLoadImage _glfw.x11.xcursor.LibraryLoadImage
|
||||||
|
|
||||||
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
||||||
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
||||||
@@ -199,9 +411,9 @@ typedef struct _GLFWwindowX11
|
|||||||
// The last position the cursor was warped to by GLFW
|
// The last position the cursor was warped to by GLFW
|
||||||
int warpCursorPosX, warpCursorPosY;
|
int warpCursorPosX, warpCursorPosY;
|
||||||
|
|
||||||
// The time of the last KeyPress event per keycode, for discarding
|
// The time of the last KeyPress event
|
||||||
// duplicate key events generated for some keys by ibus
|
Time lastKeyTime;
|
||||||
Time keyPressTimes[256];
|
|
||||||
} _GLFWwindowX11;
|
} _GLFWwindowX11;
|
||||||
|
|
||||||
// X11-specific global data
|
// X11-specific global data
|
||||||
@@ -234,6 +446,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
// GLFW key to X11 keycode LUT
|
// GLFW key to X11 keycode LUT
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
|
char* keyboardLayoutName;
|
||||||
// Where to place the cursor when re-enabled
|
// Where to place the cursor when re-enabled
|
||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
// The window whose disabled cursor mode is active
|
// The window whose disabled cursor mode is active
|
||||||
@@ -295,6 +508,105 @@ typedef struct _GLFWlibraryX11
|
|||||||
Atom ATOM_PAIR;
|
Atom ATOM_PAIR;
|
||||||
Atom GLFW_SELECTION;
|
Atom GLFW_SELECTION;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
void* handle;
|
||||||
|
PFN_XAllocClassHint AllocClassHint;
|
||||||
|
PFN_XAllocSizeHints AllocSizeHints;
|
||||||
|
PFN_XAllocWMHints AllocWMHints;
|
||||||
|
PFN_XChangeProperty ChangeProperty;
|
||||||
|
PFN_XChangeWindowAttributes ChangeWindowAttributes;
|
||||||
|
PFN_XCheckIfEvent CheckIfEvent;
|
||||||
|
PFN_XCheckTypedWindowEvent CheckTypedWindowEvent;
|
||||||
|
PFN_XCloseDisplay CloseDisplay;
|
||||||
|
PFN_XCloseIM CloseIM;
|
||||||
|
PFN_XConvertSelection ConvertSelection;
|
||||||
|
PFN_XCreateColormap CreateColormap;
|
||||||
|
PFN_XCreateFontCursor CreateFontCursor;
|
||||||
|
PFN_XCreateIC CreateIC;
|
||||||
|
PFN_XCreateWindow CreateWindow;
|
||||||
|
PFN_XDefineCursor DefineCursor;
|
||||||
|
PFN_XDeleteContext DeleteContext;
|
||||||
|
PFN_XDeleteProperty DeleteProperty;
|
||||||
|
PFN_XDestroyIC DestroyIC;
|
||||||
|
PFN_XDestroyWindow DestroyWindow;
|
||||||
|
PFN_XDisplayKeycodes DisplayKeycodes;
|
||||||
|
PFN_XEventsQueued EventsQueued;
|
||||||
|
PFN_XFilterEvent FilterEvent;
|
||||||
|
PFN_XFindContext FindContext;
|
||||||
|
PFN_XFlush Flush;
|
||||||
|
PFN_XFree Free;
|
||||||
|
PFN_XFreeColormap FreeColormap;
|
||||||
|
PFN_XFreeCursor FreeCursor;
|
||||||
|
PFN_XFreeEventData FreeEventData;
|
||||||
|
PFN_XGetAtomName GetAtomName;
|
||||||
|
PFN_XGetErrorText GetErrorText;
|
||||||
|
PFN_XGetEventData GetEventData;
|
||||||
|
PFN_XGetICValues GetICValues;
|
||||||
|
PFN_XGetIMValues GetIMValues;
|
||||||
|
PFN_XGetInputFocus GetInputFocus;
|
||||||
|
PFN_XGetKeyboardMapping GetKeyboardMapping;
|
||||||
|
PFN_XGetScreenSaver GetScreenSaver;
|
||||||
|
PFN_XGetSelectionOwner GetSelectionOwner;
|
||||||
|
PFN_XGetVisualInfo GetVisualInfo;
|
||||||
|
PFN_XGetWMNormalHints GetWMNormalHints;
|
||||||
|
PFN_XGetWindowAttributes GetWindowAttributes;
|
||||||
|
PFN_XGetWindowProperty GetWindowProperty;
|
||||||
|
PFN_XGrabPointer GrabPointer;
|
||||||
|
PFN_XIconifyWindow IconifyWindow;
|
||||||
|
PFN_XInitThreads InitThreads;
|
||||||
|
PFN_XInternAtom InternAtom;
|
||||||
|
PFN_XLookupString LookupString;
|
||||||
|
PFN_XMapRaised MapRaised;
|
||||||
|
PFN_XMapWindow MapWindow;
|
||||||
|
PFN_XMoveResizeWindow MoveResizeWindow;
|
||||||
|
PFN_XMoveWindow MoveWindow;
|
||||||
|
PFN_XNextEvent NextEvent;
|
||||||
|
PFN_XOpenDisplay OpenDisplay;
|
||||||
|
PFN_XOpenIM OpenIM;
|
||||||
|
PFN_XPeekEvent PeekEvent;
|
||||||
|
PFN_XPending Pending;
|
||||||
|
PFN_XQueryExtension QueryExtension;
|
||||||
|
PFN_XQueryPointer QueryPointer;
|
||||||
|
PFN_XRaiseWindow RaiseWindow;
|
||||||
|
PFN_XRegisterIMInstantiateCallback RegisterIMInstantiateCallback;
|
||||||
|
PFN_XResizeWindow ResizeWindow;
|
||||||
|
PFN_XResourceManagerString ResourceManagerString;
|
||||||
|
PFN_XSaveContext SaveContext;
|
||||||
|
PFN_XSelectInput SelectInput;
|
||||||
|
PFN_XSendEvent SendEvent;
|
||||||
|
PFN_XSetClassHint SetClassHint;
|
||||||
|
PFN_XSetErrorHandler SetErrorHandler;
|
||||||
|
PFN_XSetICFocus SetICFocus;
|
||||||
|
PFN_XSetIMValues SetIMValues;
|
||||||
|
PFN_XSetInputFocus SetInputFocus;
|
||||||
|
PFN_XSetLocaleModifiers SetLocaleModifiers;
|
||||||
|
PFN_XSetScreenSaver SetScreenSaver;
|
||||||
|
PFN_XSetSelectionOwner SetSelectionOwner;
|
||||||
|
PFN_XSetWMHints SetWMHints;
|
||||||
|
PFN_XSetWMNormalHints SetWMNormalHints;
|
||||||
|
PFN_XSetWMProtocols SetWMProtocols;
|
||||||
|
PFN_XSupportsLocale SupportsLocale;
|
||||||
|
PFN_XSync Sync;
|
||||||
|
PFN_XTranslateCoordinates TranslateCoordinates;
|
||||||
|
PFN_XUndefineCursor UndefineCursor;
|
||||||
|
PFN_XUngrabPointer UngrabPointer;
|
||||||
|
PFN_XUnmapWindow UnmapWindow;
|
||||||
|
PFN_XUnsetICFocus UnsetICFocus;
|
||||||
|
PFN_XVisualIDFromVisual VisualIDFromVisual;
|
||||||
|
PFN_XWarpPointer WarpPointer;
|
||||||
|
PFN_XUnregisterIMInstantiateCallback UnregisterIMInstantiateCallback;
|
||||||
|
PFN_Xutf8LookupString utf8LookupString;
|
||||||
|
PFN_Xutf8SetWMProperties utf8SetWMProperties;
|
||||||
|
} xlib;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
PFN_XrmDestroyDatabase DestroyDatabase;
|
||||||
|
PFN_XrmGetResource GetResource;
|
||||||
|
PFN_XrmGetStringDatabase GetStringDatabase;
|
||||||
|
PFN_XrmInitialize Initialize;
|
||||||
|
PFN_XrmUniqueQuark UniqueQuark;
|
||||||
|
} xrm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
GLFWbool available;
|
GLFWbool available;
|
||||||
void* handle;
|
void* handle;
|
||||||
@@ -332,6 +644,16 @@ typedef struct _GLFWlibraryX11
|
|||||||
int major;
|
int major;
|
||||||
int minor;
|
int minor;
|
||||||
unsigned int group;
|
unsigned int group;
|
||||||
|
PFN_XkbAllocKeyboard AllocKeyboard;
|
||||||
|
PFN_XkbFreeKeyboard FreeKeyboard;
|
||||||
|
PFN_XkbFreeNames FreeNames;
|
||||||
|
PFN_XkbGetMap GetMap;
|
||||||
|
PFN_XkbGetNames GetNames;
|
||||||
|
PFN_XkbGetState GetState;
|
||||||
|
PFN_XkbKeycodeToKeysym KeycodeToKeysym;
|
||||||
|
PFN_XkbQueryExtension QueryExtension;
|
||||||
|
PFN_XkbSelectEventDetails SelectEventDetails;
|
||||||
|
PFN_XkbSetDetectableAutoRepeat SetDetectableAutoRepeat;
|
||||||
} xkb;
|
} xkb;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -353,6 +675,9 @@ typedef struct _GLFWlibraryX11
|
|||||||
PFN_XcursorImageCreate ImageCreate;
|
PFN_XcursorImageCreate ImageCreate;
|
||||||
PFN_XcursorImageDestroy ImageDestroy;
|
PFN_XcursorImageDestroy ImageDestroy;
|
||||||
PFN_XcursorImageLoadCursor ImageLoadCursor;
|
PFN_XcursorImageLoadCursor ImageLoadCursor;
|
||||||
|
PFN_XcursorGetTheme GetTheme;
|
||||||
|
PFN_XcursorGetDefaultSize GetDefaultSize;
|
||||||
|
PFN_XcursorLibraryLoadImage LibraryLoadImage;
|
||||||
} xcursor;
|
} xcursor;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -404,6 +729,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
PFN_XRenderQueryVersion QueryVersion;
|
PFN_XRenderQueryVersion QueryVersion;
|
||||||
PFN_XRenderFindVisualFormat FindVisualFormat;
|
PFN_XRenderFindVisualFormat FindVisualFormat;
|
||||||
} xrender;
|
} xrender;
|
||||||
|
|
||||||
} _GLFWlibraryX11;
|
} _GLFWlibraryX11;
|
||||||
|
|
||||||
// X11-specific per-monitor data
|
// X11-specific per-monitor data
|
||||||
@@ -417,6 +743,7 @@ typedef struct _GLFWmonitorX11
|
|||||||
// Index of corresponding Xinerama screen,
|
// Index of corresponding Xinerama screen,
|
||||||
// for EWMH full screen window placement
|
// for EWMH full screen window placement
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
} _GLFWmonitorX11;
|
} _GLFWmonitorX11;
|
||||||
|
|
||||||
// X11-specific per-cursor data
|
// X11-specific per-cursor data
|
||||||
@@ -424,6 +751,7 @@ typedef struct _GLFWmonitorX11
|
|||||||
typedef struct _GLFWcursorX11
|
typedef struct _GLFWcursorX11
|
||||||
{
|
{
|
||||||
Cursor handle;
|
Cursor handle;
|
||||||
|
|
||||||
} _GLFWcursorX11;
|
} _GLFWcursorX11;
|
||||||
|
|
||||||
|
|
||||||
@@ -444,4 +772,5 @@ void _glfwReleaseErrorHandlerX11(void);
|
|||||||
void _glfwInputErrorX11(int error, const char* message);
|
void _glfwInputErrorX11(int error, const char* message);
|
||||||
|
|
||||||
void _glfwPushSelectionToManagerX11(void);
|
void _glfwPushSelectionToManagerX11(void);
|
||||||
|
void _glfwCreateInputContextX11(_GLFWwindow* window);
|
||||||
|
|
||||||
|
|||||||
+154
-63
@@ -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>
|
||||||
@@ -590,6 +590,14 @@ static void enableCursor(_GLFWwindow* window)
|
|||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear its handle when the input context has been destroyed
|
||||||
|
//
|
||||||
|
static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer callData)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
||||||
|
window->x11.ic = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the X11 window (and its colormap)
|
// Create the X11 window (and its colormap)
|
||||||
//
|
//
|
||||||
static GLFWbool createNativeWindow(_GLFWwindow* window,
|
static GLFWbool createNativeWindow(_GLFWwindow* window,
|
||||||
@@ -768,27 +776,10 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
PropModeReplace, (unsigned char*) &version, 1);
|
PropModeReplace, (unsigned char*) &version, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformSetWindowTitle(window, wndconfig->title);
|
|
||||||
|
|
||||||
if (_glfw.x11.im)
|
if (_glfw.x11.im)
|
||||||
{
|
_glfwCreateInputContextX11(window);
|
||||||
window->x11.ic = XCreateIC(_glfw.x11.im,
|
|
||||||
XNInputStyle,
|
|
||||||
XIMPreeditNothing | XIMStatusNothing,
|
|
||||||
XNClientWindow,
|
|
||||||
window->x11.handle,
|
|
||||||
XNFocusWindow,
|
|
||||||
window->x11.handle,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->x11.ic)
|
|
||||||
{
|
|
||||||
unsigned long filter = 0;
|
|
||||||
if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL)
|
|
||||||
XSelectInput(_glfw.x11.display, window->x11.handle, wa.event_mask | filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_glfwPlatformSetWindowTitle(window, wndconfig->title);
|
||||||
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
|
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
|
||||||
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
|
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
|
||||||
|
|
||||||
@@ -1173,7 +1164,6 @@ static void processEvent(XEvent *event)
|
|||||||
if (event->type == KeyPress || event->type == KeyRelease)
|
if (event->type == KeyPress || event->type == KeyRelease)
|
||||||
keycode = event->xkey.keycode;
|
keycode = event->xkey.keycode;
|
||||||
|
|
||||||
if (_glfw.x11.im)
|
|
||||||
filtered = XFilterEvent(event, None);
|
filtered = XFilterEvent(event, None);
|
||||||
|
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available)
|
||||||
@@ -1194,9 +1184,8 @@ static void processEvent(XEvent *event)
|
|||||||
(((XkbEvent*) event)->state.changed & XkbGroupStateMask))
|
(((XkbEvent*) event)->state.changed & XkbGroupStateMask))
|
||||||
{
|
{
|
||||||
_glfw.x11.xkb.group = ((XkbEvent*) event)->state.group;
|
_glfw.x11.xkb.group = ((XkbEvent*) event)->state.group;
|
||||||
|
_glfwInputKeyboardLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1275,20 +1264,16 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
if (window->x11.ic)
|
if (window->x11.ic)
|
||||||
{
|
{
|
||||||
// HACK: Do not report the key press events duplicated by XIM
|
// HACK: Ignore duplicate key press events generated by ibus
|
||||||
// Duplicate key releases are filtered out implicitly by
|
// These have the same timestamp as the original event
|
||||||
// the GLFW key repeat logic in _glfwInputKey
|
// Corresponding release events are filtered out
|
||||||
// A timestamp per key is used to handle simultaneous keys
|
// implicitly by the GLFW key repeat logic
|
||||||
// NOTE: Always allow the first event for each key through
|
if (window->x11.lastKeyTime < event->xkey.time)
|
||||||
// (the server never sends a timestamp of zero)
|
|
||||||
// NOTE: Timestamp difference is compared to handle wrap-around
|
|
||||||
Time diff = event->xkey.time - window->x11.keyPressTimes[keycode];
|
|
||||||
if (diff == event->xkey.time || (diff > 0 && diff < (1 << 31)))
|
|
||||||
{
|
{
|
||||||
if (keycode)
|
if (keycode)
|
||||||
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
||||||
|
|
||||||
window->x11.keyPressTimes[keycode] = event->xkey.time;
|
window->x11.lastKeyTime = event->xkey.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filtered)
|
if (!filtered)
|
||||||
@@ -1973,6 +1958,38 @@ void _glfwPushSelectionToManagerX11(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwCreateInputContextX11(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
XIMCallback callback;
|
||||||
|
callback.callback = (XIMProc) inputContextDestroyCallback;
|
||||||
|
callback.client_data = (XPointer) window;
|
||||||
|
|
||||||
|
window->x11.ic = XCreateIC(_glfw.x11.im,
|
||||||
|
XNInputStyle,
|
||||||
|
XIMPreeditNothing | XIMStatusNothing,
|
||||||
|
XNClientWindow,
|
||||||
|
window->x11.handle,
|
||||||
|
XNFocusWindow,
|
||||||
|
window->x11.handle,
|
||||||
|
XNDestroyCallback,
|
||||||
|
&callback,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (window->x11.ic)
|
||||||
|
{
|
||||||
|
XWindowAttributes attribs;
|
||||||
|
XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &attribs);
|
||||||
|
|
||||||
|
unsigned long filter = 0;
|
||||||
|
if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL)
|
||||||
|
{
|
||||||
|
XSelectInput(_glfw.x11.display,
|
||||||
|
window->x11.handle,
|
||||||
|
attribs.your_event_mask | filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
@@ -1983,7 +2000,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
const _GLFWctxconfig* ctxconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
Visual* visual = NULL;
|
Visual* visual;
|
||||||
int depth;
|
int depth;
|
||||||
|
|
||||||
if (ctxconfig->client != GLFW_NO_API)
|
if (ctxconfig->client != GLFW_NO_API)
|
||||||
@@ -2009,7 +2026,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!visual)
|
if (ctxconfig->client == GLFW_NO_API ||
|
||||||
|
ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
||||||
{
|
{
|
||||||
visual = DefaultVisual(_glfw.x11.display, _glfw.x11.screen);
|
visual = DefaultVisual(_glfw.x11.display, _glfw.x11.screen);
|
||||||
depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen);
|
depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen);
|
||||||
@@ -2500,11 +2518,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
|
||||||
_glfwPlatformSetWindowDecorated(window, window->decorated);
|
|
||||||
_glfwPlatformSetWindowFloating(window, window->floating);
|
|
||||||
releaseMonitor(window);
|
releaseMonitor(window);
|
||||||
}
|
|
||||||
|
|
||||||
_glfwInputWindowMonitor(window, monitor);
|
_glfwInputWindowMonitor(window, monitor);
|
||||||
updateNormalHints(window, width, height);
|
updateNormalHints(window, width, height);
|
||||||
@@ -2595,19 +2609,13 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
|
|||||||
int rootX, rootY, childX, childY;
|
int rootX, rootY, childX, childY;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
|
|
||||||
_glfwGrabErrorHandlerX11();
|
if (!XQueryPointer(_glfw.x11.display, w,
|
||||||
|
&root, &w, &rootX, &rootY, &childX, &childY, &mask))
|
||||||
const Bool result = XQueryPointer(_glfw.x11.display, w,
|
{
|
||||||
&root, &w, &rootX, &rootY,
|
|
||||||
&childX, &childY, &mask);
|
|
||||||
|
|
||||||
_glfwReleaseErrorHandlerX11();
|
|
||||||
|
|
||||||
if (_glfw.x11.errorCode == BadWindow)
|
|
||||||
w = _glfw.x11.root;
|
|
||||||
else if (!result)
|
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
else if (w == window->x11.handle)
|
}
|
||||||
|
|
||||||
|
if (w == window->x11.handle)
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2686,15 +2694,15 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == count)
|
if (i < count)
|
||||||
{
|
return;
|
||||||
|
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||||
PropModeAppend,
|
PropModeAppend,
|
||||||
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
|
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (states)
|
else if (states)
|
||||||
{
|
{
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
@@ -2703,8 +2711,9 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < count)
|
if (i == count)
|
||||||
{
|
return;
|
||||||
|
|
||||||
states[i] = states[count - 1];
|
states[i] = states[count - 1];
|
||||||
count--;
|
count--;
|
||||||
|
|
||||||
@@ -2712,7 +2721,6 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char*) states, count);
|
PropModeReplace, (unsigned char*) states, count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (states)
|
if (states)
|
||||||
XFree(states);
|
XFree(states);
|
||||||
@@ -2780,7 +2788,7 @@ void _glfwPlatformPollEvents(void)
|
|||||||
#endif
|
#endif
|
||||||
XPending(_glfw.x11.display);
|
XPending(_glfw.x11.display);
|
||||||
|
|
||||||
while (XQLength(_glfw.x11.display))
|
while (QLength(_glfw.x11.display))
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
XNextEvent(_glfw.x11.display, &event);
|
XNextEvent(_glfw.x11.display, &event);
|
||||||
@@ -2886,7 +2894,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (scancode < 0 || scancode > 0xff ||
|
if (scancode < 0 || scancode > 0xff ||
|
||||||
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2913,6 +2921,42 @@ int _glfwPlatformGetKeyScancode(int key)
|
|||||||
return _glfw.x11.scancodes[key];
|
return _glfw.x11.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* _glfwPlatformGetKeyboardLayoutName(void)
|
||||||
|
{
|
||||||
|
if (!_glfw.x11.xkb.available)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: XKB extension required for keyboard layout names");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
XkbStateRec state = {0};
|
||||||
|
XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state);
|
||||||
|
|
||||||
|
XkbDescPtr desc = XkbAllocKeyboard();
|
||||||
|
if (XkbGetNames(_glfw.x11.display, XkbGroupNamesMask, desc) != Success)
|
||||||
|
{
|
||||||
|
XkbFreeKeyboard(desc, 0, True);
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: Failed to retrieve keyboard layout names");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Atom atom = desc->names->groups[state.group];
|
||||||
|
XkbFreeKeyboard(desc, 0, True);
|
||||||
|
|
||||||
|
if (atom == None)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: Name missing for current keyboard layout");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_glfw.x11.keyboardLayoutName);
|
||||||
|
_glfw.x11.keyboardLayoutName = XGetAtomName(_glfw.x11.display, atom);
|
||||||
|
return _glfw.x11.keyboardLayoutName;
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
@@ -2926,7 +2970,47 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
int native = 0;
|
if (_glfw.x11.xcursor.handle)
|
||||||
|
{
|
||||||
|
char* theme = XcursorGetTheme(_glfw.x11.display);
|
||||||
|
if (theme)
|
||||||
|
{
|
||||||
|
const int size = XcursorGetDefaultSize(_glfw.x11.display);
|
||||||
|
const char* name = NULL;
|
||||||
|
|
||||||
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
|
name = "default";
|
||||||
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
|
name = "text";
|
||||||
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
|
name = "crosshair";
|
||||||
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
|
name = "pointer";
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
name = "ew-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
name = "ns-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
name = "nwse-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
name = "nesw-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
name = "all-scroll";
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
name = "not-allowed";
|
||||||
|
|
||||||
|
XcursorImage* image = XcursorLibraryLoadImage(name, theme, size);
|
||||||
|
if (image)
|
||||||
|
{
|
||||||
|
cursor->x11.handle = XcursorImageLoadCursor(_glfw.x11.display, image);
|
||||||
|
XcursorImageDestroy(image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cursor->x11.handle)
|
||||||
|
{
|
||||||
|
unsigned int native = 0;
|
||||||
|
|
||||||
if (shape == GLFW_ARROW_CURSOR)
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
native = XC_left_ptr;
|
native = XC_left_ptr;
|
||||||
@@ -2934,14 +3018,20 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
native = XC_xterm;
|
native = XC_xterm;
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
native = XC_crosshair;
|
native = XC_crosshair;
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
native = XC_hand2;
|
native = XC_hand2;
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
native = XC_sb_h_double_arrow;
|
native = XC_sb_h_double_arrow;
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
native = XC_sb_v_double_arrow;
|
native = XC_sb_v_double_arrow;
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
native = XC_fleur;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
|
"X11: Standard cursor shape unavailable");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
||||||
if (!cursor->x11.handle)
|
if (!cursor->x11.handle)
|
||||||
@@ -2950,6 +3040,7 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
"X11: Failed to create standard cursor");
|
"X11: Failed to create standard cursor");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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-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 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>
|
||||||
//
|
//
|
||||||
|
|||||||
+7
-22
@@ -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()
|
||||||
|
|
||||||
@@ -21,17 +20,6 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
|||||||
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
||||||
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
||||||
|
|
||||||
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
|
|
||||||
${CMAKE_VERSION} VERSION_GREATER "3.1.0")
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
|
||||||
else()
|
|
||||||
# Remove this fallback when removing support for CMake version less than 3.1
|
|
||||||
add_compile_options("$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
|
|
||||||
"$<$<C_COMPILER_ID:Clang>:-std=c99>"
|
|
||||||
"$<$<C_COMPILER_ID:GNU>:-std=c99>")
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
|
add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
|
||||||
add_executable(events events.c ${GETOPT} ${GLAD_GL})
|
add_executable(events events.c ${GETOPT} ${GLAD_GL})
|
||||||
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
|
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
|
||||||
@@ -52,10 +40,10 @@ add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL})
|
|||||||
add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL})
|
add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL})
|
||||||
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL})
|
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL})
|
||||||
add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN})
|
add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN})
|
||||||
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD_GL})
|
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GLAD_GL})
|
||||||
|
|
||||||
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}")
|
target_link_libraries(empty Threads::Threads)
|
||||||
target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}")
|
target_link_libraries(threads Threads::Threads)
|
||||||
if (RT_LIBRARY)
|
if (RT_LIBRARY)
|
||||||
target_link_libraries(empty "${RT_LIBRARY}")
|
target_link_libraries(empty "${RT_LIBRARY}")
|
||||||
target_link_libraries(threads "${RT_LIBRARY}")
|
target_link_libraries(threads "${RT_LIBRARY}")
|
||||||
@@ -67,16 +55,13 @@ set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen
|
|||||||
cursor)
|
cursor)
|
||||||
|
|
||||||
set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||||
|
C_STANDARD 99
|
||||||
FOLDER "GLFW3/Tests")
|
FOLDER "GLFW3/Tests")
|
||||||
|
|
||||||
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)
|
||||||
@@ -94,6 +79,6 @@ if (APPLE)
|
|||||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
||||||
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_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
|
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/Info.plist.in")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user