mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 07:05:49 +00:00
Compare commits
158 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 45ce5ddd19 | |||
| 395f0a8b63 | |||
| d9fd087bbf | |||
| 5688fb19e6 | |||
| d1269c1b7d | |||
| 541b151cff | |||
| 8d08426725 | |||
| 85a3bf40fb | |||
| d9512b694b | |||
| 35a65361ff | |||
| 6659a80040 | |||
| 1813cc0af5 | |||
| 9cfd4c49b0 | |||
| eac18b9324 | |||
| 499a5a7917 | |||
| b0af476799 | |||
| 9dd3f25d6d | |||
| 7302a8f520 | |||
| 9f73e9afa3 | |||
| 5ccc756c56 | |||
| e219c00d87 | |||
| 7f752c17c6 | |||
| 811e6bb01c | |||
| b4aa5f626f | |||
| ca1a98e7a2 | |||
| 54f2a865e9 | |||
| 09470b68c1 | |||
| 9340324380 | |||
| 7a4813cedd | |||
| d1c0797630 | |||
| b716ff5b97 | |||
| dccec7fcae | |||
| 4bf6bd42fd | |||
| c68ad09c04 | |||
| e155c19f8e | |||
| 6b15731e6c | |||
| 554f5d0492 | |||
| 3901824c0e | |||
| 5066f57371 | |||
| 1f7ce12cbc | |||
| 0eaf9d557f | |||
| 61497796e6 | |||
| 86a1d3b628 | |||
| 9ab14a8cc0 | |||
| f5dab59071 | |||
| 658c931561 | |||
| 0c46a730de | |||
| 1fa4312b29 | |||
| eb6fc17746 | |||
| ed785a2c79 | |||
| fba79aaaec | |||
| ec934edfbf | |||
| 5f0b316c24 | |||
| 5e8186af0a | |||
| 17c5c53910 | |||
| 6afc571ade | |||
| 22eaa04b49 | |||
| 65fc4fa625 | |||
| 8ecb49d143 | |||
| 9240ee5ddf | |||
| 3b806aef27 | |||
| 5470fd6de9 | |||
| 52133a3690 | |||
| 8f3677a0d4 | |||
| f21a9104e4 | |||
| 869e68a015 | |||
| 7d5a16ce71 | |||
| a69648e192 | |||
| e10def6de7 | |||
| 84c881c1a8 | |||
| 18d7c241f8 | |||
| 6281424988 | |||
| 81d762bf66 | |||
| 486724c433 | |||
| 55528e9178 | |||
| 689840f2eb | |||
| c59092619a | |||
| bfd9eaf092 | |||
| 6902435005 | |||
| 6eb24a49df | |||
| bec6e7565b | |||
| 19543afbfb | |||
| d3b73abba0 | |||
| fbdb08c43e | |||
| 71316f843c | |||
| 472d45c07b | |||
| 85f37ada6d | |||
| b77a9b1d0d | |||
| db85858062 | |||
| ca676357c0 | |||
| 4ea7485fbe | |||
| 73b6754a67 | |||
| 2d3ce6eaae | |||
| cec0b33ee1 | |||
| 9400bc9f35 | |||
| 1a7e4da343 | |||
| 95df61e5ed | |||
| c32fefc6a0 | |||
| 6bb5f5d59d | |||
| 33ff23dc07 | |||
| cf70b10692 | |||
| 0a3fb9940f | |||
| c113c59926 | |||
| ffe0795e64 | |||
| 1d7339f3fc | |||
| 50b09938e7 | |||
| 123643df2d | |||
| ab5f006cff | |||
| 74a8ba26c3 | |||
| 929286ca47 | |||
| d3317b4937 | |||
| b3b82cdd78 | |||
| 20a7962a9b | |||
| 44ad296813 | |||
| 1b0eac9c58 | |||
| 65c36563f6 | |||
| 1e98fc325d | |||
| 545b6c7970 | |||
| a7202e2341 | |||
| 9a5511b311 | |||
| a18f4e50b0 | |||
| 3bf580ad1d | |||
| 014ce9c74f | |||
| 8f0198e82e | |||
| bd346b64d6 | |||
| d61f7225d1 | |||
| 813edfa494 | |||
| b1a8bc5d69 | |||
| e04cd8283e | |||
| db34aea144 | |||
| 6518847f4d | |||
| 5ecf2cbdbf | |||
| 45d1f547cd | |||
| 4e1aeb899c | |||
| 8bf39cf1f4 | |||
| 45336c1104 | |||
| 163fa83fac | |||
| 6769ffcd0f | |||
| 07c29d1c1c | |||
| 508e24c01c | |||
| e756ae1d85 | |||
| 020ce99170 | |||
| a149810df9 | |||
| 2a5038e4e9 | |||
| 728aaccbbb | |||
| 52b2775c2e | |||
| 30b02dd709 | |||
| 9ef9b1361a | |||
| 5dd6716ee9 | |||
| 3cded29c2f | |||
| 583dcbcc19 | |||
| bcaf8daa72 | |||
| 658744e222 | |||
| 713711f5e9 | |||
| 814b7929c5 | |||
| b39c02b118 | |||
| 0f46d089e8 | |||
| b8202d9ca3 |
+3
-16
@@ -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,26 +21,13 @@ 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:
|
||||||
except:
|
only:
|
||||||
- GENERATOR: Visual Studio 10 2010
|
- GENERATOR: MinGW Makefiles
|
||||||
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%
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
name: Build
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [ ci, master, latest, 3.3-stable ]
|
||||||
|
permissions:
|
||||||
|
statuses: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux-x11-clang:
|
||||||
|
name: X11 (Linux, Clang)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CC: clang
|
||||||
|
CFLAGS: -Werror
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
|
||||||
|
|
||||||
|
- name: Configure static library
|
||||||
|
run: cmake -S . -B build-static
|
||||||
|
- name: Build static library
|
||||||
|
run: cmake --build build-static --parallel
|
||||||
|
|
||||||
|
- name: Configure shared library
|
||||||
|
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
|
||||||
|
- name: Build shared library
|
||||||
|
run: cmake --build build-shared --parallel
|
||||||
|
|
||||||
|
build-linux-wayland-clang:
|
||||||
|
name: Wayland (Linux, Clang)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CC: clang
|
||||||
|
CFLAGS: -Werror
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev extra-cmake-modules
|
||||||
|
|
||||||
|
- name: Configure static library
|
||||||
|
run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON
|
||||||
|
- name: Build static library
|
||||||
|
run: cmake --build build-static --parallel
|
||||||
|
|
||||||
|
- name: Configure shared library
|
||||||
|
run: cmake -S . -B build-shared -D GLFW_USE_WAYLAND=ON -D BUILD_SHARED_LIBS=ON
|
||||||
|
- name: Build shared library
|
||||||
|
run: cmake --build build-shared --parallel
|
||||||
|
|
||||||
|
build-linux-null-clang:
|
||||||
|
name: Null (Linux, Clang)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CC: clang
|
||||||
|
CFLAGS: -Werror
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install libosmesa6-dev
|
||||||
|
|
||||||
|
- name: Configure static library
|
||||||
|
run: cmake -S . -B build-static -D GLFW_USE_OSMESA=ON
|
||||||
|
- name: Build static library
|
||||||
|
run: cmake --build build-static --parallel
|
||||||
|
|
||||||
|
- name: Configure shared library
|
||||||
|
run: cmake -S . -B build-shared -D GLFW_USE_OSMESA=ON -D BUILD_SHARED_LIBS=ON
|
||||||
|
- name: Build shared library
|
||||||
|
run: cmake --build build-shared --parallel
|
||||||
|
|
||||||
|
build-macos-cocoa-clang:
|
||||||
|
name: Cocoa (macOS, Clang)
|
||||||
|
runs-on: macos-latest
|
||||||
|
env:
|
||||||
|
CFLAGS: -Werror
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: 10.8
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Configure static library
|
||||||
|
run: cmake -S . -B build-static
|
||||||
|
- name: Build static library
|
||||||
|
run: cmake --build build-static --parallel
|
||||||
|
|
||||||
|
- name: Configure shared library
|
||||||
|
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
|
||||||
|
- name: Build shared library
|
||||||
|
run: cmake --build build-shared --parallel
|
||||||
|
|
||||||
|
build-windows-win32-vs2022:
|
||||||
|
name: Win32 (Windows, VS2022)
|
||||||
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
CFLAGS: /WX
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Configure static library
|
||||||
|
run: cmake -S . -B build-static -G "Visual Studio 17 2022"
|
||||||
|
- name: Build static library
|
||||||
|
run: cmake --build build-static --parallel
|
||||||
|
|
||||||
|
- name: Configure shared library
|
||||||
|
run: cmake -S . -B build-shared -G "Visual Studio 17 2022" -D BUILD_SHARED_LIBS=ON
|
||||||
|
- name: Build shared library
|
||||||
|
run: cmake --build build-shared --parallel
|
||||||
|
|
||||||
-114
@@ -1,114 +0,0 @@
|
|||||||
language: c
|
|
||||||
compiler: clang
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- ci
|
|
||||||
- master
|
|
||||||
- 3.3-stable
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: linux
|
|
||||||
dist: xenial
|
|
||||||
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
|
|
||||||
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: focal
|
|
||||||
name: "Wayland shared library"
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- extra-cmake-modules
|
|
||||||
- wayland-protocols
|
|
||||||
- libwayland-dev
|
|
||||||
- libxkbcommon-dev
|
|
||||||
- libegl1-mesa-dev
|
|
||||||
env:
|
|
||||||
- USE_WAYLAND=ON
|
|
||||||
- BUILD_SHARED_LIBS=ON
|
|
||||||
- CFLAGS=-Werror
|
|
||||||
- os: linux
|
|
||||||
dist: focal
|
|
||||||
name: "Wayland static library"
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- extra-cmake-modules
|
|
||||||
- wayland-protocols
|
|
||||||
- libwayland-dev
|
|
||||||
- libxkbcommon-dev
|
|
||||||
- libegl1-mesa-dev
|
|
||||||
env:
|
|
||||||
- USE_WAYLAND=ON
|
|
||||||
- BUILD_SHARED_LIBS=OFF
|
|
||||||
- CFLAGS=-Werror
|
|
||||||
- os: linux
|
|
||||||
dist: bionic
|
|
||||||
name: "Null shared library"
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libosmesa6-dev
|
|
||||||
env:
|
|
||||||
- BUILD_SHARED_LIBS=ON
|
|
||||||
- USE_OSMESA=ON
|
|
||||||
- CFLAGS=-Werror
|
|
||||||
- os: linux
|
|
||||||
dist: bionic
|
|
||||||
name: "Null static library"
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libosmesa6-dev
|
|
||||||
env:
|
|
||||||
- BUILD_SHARED_LIBS=OFF
|
|
||||||
- USE_OSMESA=ON
|
|
||||||
- CFLAGS=-Werror
|
|
||||||
- os: osx
|
|
||||||
name: "Cocoa shared library"
|
|
||||||
env:
|
|
||||||
- BUILD_SHARED_LIBS=ON
|
|
||||||
- CFLAGS=-Werror
|
|
||||||
- MACOSX_DEPLOYMENT_TARGET=10.8
|
|
||||||
- os: osx
|
|
||||||
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
|
|
||||||
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} -DGLFW_USE_OSMESA=${USE_OSMESA} ..
|
|
||||||
- cmake --build .
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
recipients:
|
|
||||||
- ci@glfw.org
|
|
||||||
on_success: never
|
|
||||||
on_failure: always
|
|
||||||
@@ -23,8 +23,23 @@ 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]")
|
||||||
set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n")
|
if (line MATCHES "platform:Windows")
|
||||||
|
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()
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
+12
-8
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
|
||||||
|
|
||||||
project(GLFW VERSION 3.3.3 LANGUAGES C)
|
project(GLFW VERSION 3.3.7 LANGUAGES C)
|
||||||
|
|
||||||
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
||||||
|
|
||||||
@@ -67,7 +67,8 @@ if (GLFW_BUILD_DOCS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Set compiler specific flags
|
# Apply Microsoft C runtime library option
|
||||||
|
# This is here because it also applies to tests and examples
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
if (MSVC90)
|
if (MSVC90)
|
||||||
@@ -80,22 +81,26 @@ 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 (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
if (MSVC AND 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()
|
||||||
|
|
||||||
@@ -261,10 +266,9 @@ if (_GLFW_WAYLAND)
|
|||||||
|
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H)
|
|
||||||
check_function_exists(memfd_create HAVE_MEMFD_CREATE)
|
check_function_exists(memfd_create HAVE_MEMFD_CREATE)
|
||||||
|
|
||||||
if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"))
|
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
find_package(EpollShim)
|
find_package(EpollShim)
|
||||||
if (EPOLLSHIM_FOUND)
|
if (EPOLLSHIM_FOUND)
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}")
|
list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}")
|
||||||
|
|||||||
+233
@@ -0,0 +1,233 @@
|
|||||||
|
# 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
|
||||||
|
- TheChocolateOre
|
||||||
|
- Joseph Chua
|
||||||
|
- Ian Clarkson
|
||||||
|
- Michał Cichoń
|
||||||
|
- Lambert Clara
|
||||||
|
- Anna Clarke
|
||||||
|
- Josh Codd
|
||||||
|
- Yaron Cohen-Tal
|
||||||
|
- Omar Cornut
|
||||||
|
- Andrew Corrigan
|
||||||
|
- Bailey Cosier
|
||||||
|
- Noel Cower
|
||||||
|
- CuriouserThing
|
||||||
|
- Jason Daly
|
||||||
|
- Jarrod Davis
|
||||||
|
- Olivier Delannoy
|
||||||
|
- Paul R. Deppe
|
||||||
|
- Michael Dickens
|
||||||
|
- Роман Донченко
|
||||||
|
- Mario Dorn
|
||||||
|
- Wolfgang Draxinger
|
||||||
|
- Jonathan Dummer
|
||||||
|
- Ralph Eastwood
|
||||||
|
- Fredrik Ehnbom
|
||||||
|
- Robin Eklind
|
||||||
|
- Jan Ekström
|
||||||
|
- Siavash Eliasi
|
||||||
|
- TheExileFox
|
||||||
|
- Felipe Ferreira
|
||||||
|
- Michael Fogleman
|
||||||
|
- Jason Francis
|
||||||
|
- Gerald Franz
|
||||||
|
- Mário Freitas
|
||||||
|
- GeO4d
|
||||||
|
- Marcus Geelnard
|
||||||
|
- ghuser404
|
||||||
|
- Charles Giessen
|
||||||
|
- Ryan C. Gordon
|
||||||
|
- Stephen Gowen
|
||||||
|
- Kovid Goyal
|
||||||
|
- Eloi Marín Gratacós
|
||||||
|
- Stefan Gustavson
|
||||||
|
- Andrew Gutekanst
|
||||||
|
- Stephen Gutekanst
|
||||||
|
- Jonathan Hale
|
||||||
|
- hdf89shfdfs
|
||||||
|
- Sylvain Hellegouarch
|
||||||
|
- Matthew Henry
|
||||||
|
- heromyth
|
||||||
|
- Lucas Hinderberger
|
||||||
|
- Paul Holden
|
||||||
|
- Warren Hu
|
||||||
|
- Charles Huber
|
||||||
|
- illustris
|
||||||
|
- InKryption
|
||||||
|
- 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
|
||||||
|
- Joao da Silva
|
||||||
|
- Daniel Sieger
|
||||||
|
- Daniel Skorupski
|
||||||
|
- Slemmie
|
||||||
|
- Bradley Smith
|
||||||
|
- Cliff Smolinsky
|
||||||
|
- Patrick Snape
|
||||||
|
- Erlend Sogge Heggen
|
||||||
|
- Olivier Sohn
|
||||||
|
- Julian Squires
|
||||||
|
- Johannes Stein
|
||||||
|
- Pontus Stenetorp
|
||||||
|
- Michael Stocker
|
||||||
|
- Justin Stoecker
|
||||||
|
- Elviss Strazdins
|
||||||
|
- Paul Sultana
|
||||||
|
- Nathan Sweet
|
||||||
|
- TTK-Bandit
|
||||||
|
- Sergey Tikhomirov
|
||||||
|
- Arthur Tombs
|
||||||
|
- Ioannis Tsakpinis
|
||||||
|
- Samuli Tuomola
|
||||||
|
- Matthew Turner
|
||||||
|
- urraka
|
||||||
|
- Elias Vanderstuyft
|
||||||
|
- Stef Velzel
|
||||||
|
- Jari Vetoniemi
|
||||||
|
- Ricardo Vieira
|
||||||
|
- Nicholas Vitovitch
|
||||||
|
- Simon Voordouw
|
||||||
|
- Corentin Wallez
|
||||||
|
- Torsten Walluhn
|
||||||
|
- Patrick Walton
|
||||||
|
- Xo Wang
|
||||||
|
- Jay Weisskopf
|
||||||
|
- Frank Wille
|
||||||
|
- Richard A. Wilkes
|
||||||
|
- Tatsuya Yatagawa
|
||||||
|
- Ryogo Yoshimura
|
||||||
|
- Rácz Zalán
|
||||||
|
- Lukas Zanner
|
||||||
|
- Andrey Zholos
|
||||||
|
- Aihui Zhu
|
||||||
|
- Santi Zupancic
|
||||||
|
- Jonas Ådahl
|
||||||
|
- Lasse Öörni
|
||||||
|
- Leonard König
|
||||||
|
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||||
|
reports, patches, feedback, testing and encouragement
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# GLFW
|
# GLFW
|
||||||
|
|
||||||
[](https://travis-ci.org/glfw/glfw)
|
[](https://github.com/glfw/glfw/actions)
|
||||||
[](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](http://www.glfw.org/license.html).
|
license](https://www.glfw.org/license.html).
|
||||||
|
|
||||||
You can [download](http://www.glfw.org/download.html) the latest stable release
|
You can [download](https://www.glfw.org/download.html) the latest stable release
|
||||||
as source or Windows binaries, or fetch the `latest` branch from GitHub. Each
|
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](http://www.glfw.org/docs/latest/) is available online and is
|
The [documentation](https://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](http://www.glfw.org/changelog.html).
|
history](https://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,11 +34,16 @@ 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](http://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If
|
[tutorial](https://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](http://www.glfw.org/docs/latest/moving.html) for moving to the GLFW
|
guide](https://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
|
||||||
|
|
||||||
@@ -52,16 +57,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](http://www.glfw.org/download.html)
|
There are [pre-compiled Windows binaries](https://www.glfw.org/download.html)
|
||||||
available for all supported compilers.
|
available for all supported compilers.
|
||||||
|
|
||||||
See the [compilation guide](http://www.glfw.org/docs/latest/compile.html) for
|
See the [compilation guide](https://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](http://www.glfw.org/docs/latest/) for tutorials, guides
|
See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides
|
||||||
and the API reference.
|
and the API reference.
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +84,7 @@ 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](http://www.glfw.org/docs/latest/compat.html)
|
See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html)
|
||||||
in the documentation for more information.
|
in the documentation for more information.
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +109,7 @@ located in the `deps/` directory.
|
|||||||
- [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI
|
- [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI
|
||||||
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
|
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
|
||||||
|
|
||||||
The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can
|
The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can
|
||||||
find that tool.
|
find that tool.
|
||||||
|
|
||||||
|
|
||||||
@@ -118,57 +123,43 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Bugfix: Some extension loader headers did not prevent default OpenGL header
|
- [Win32] Bugfix: A window created maximized and undecorated would cover the whole
|
||||||
inclusion (#1695)
|
monitor (#1806)
|
||||||
- [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are
|
- [Win32] Bugfix: The default restored window position was lost when creating a maximized
|
||||||
opaque (#1512)
|
window
|
||||||
- [Win32] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16
|
- [Win32] Bugfix: `glfwMaximizeWindow` would make a hidden window visible
|
||||||
- [Win32] Bugfix: Monitor functions could return invalid values after
|
- [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003)
|
||||||
configuration change (#1761)
|
- [X11] Bugfix: Dynamic loading on OpenBSD failed due to soname differences
|
||||||
- [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775)
|
- [X11] Bugfix: Waiting for events would fail if file descriptor was too large
|
||||||
- [Win32] Bugfix: Duplicate size events were not filtered (#1610)
|
(#2024)
|
||||||
- [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes
|
- [X11] Bugfix: Joystick events could lead to busy-waiting (#1872)
|
||||||
(#1582)
|
- [X11] Bugfix: `glfwWaitEvents*` did not continue for joystick events
|
||||||
- [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than
|
- [X11] Bugfix: `glfwPostEmptyEvent` could be ignored due to race condition
|
||||||
Windows 10 version 1703 (#1511)
|
(#379,#1281,#1285,#2033)
|
||||||
- [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169)
|
- [X11] Bugfix: Dynamic loading on NetBSD failed due to soname differences
|
||||||
- [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16
|
- [X11] Bugfix: Left shift of int constant relied on undefined behavior (#1951)
|
||||||
(#1635)
|
- [Wayland] Added support for key names via xkbcommon
|
||||||
- [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays
|
- [Wayland] Bugfix: Key repeat could lead to a race condition (#1710)
|
||||||
could leak memory
|
- [Wayland] Bugfix: Activating a window would emit two input focus events
|
||||||
- [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787)
|
- [Wayland] Bugfix: Disable key repeat mechanism when window loses input focus
|
||||||
- [Cocoa] Bugfix: Duplicate video modes were not filtered out (#1830)
|
- [Wayland] Bugfix: Window hiding and showing did not work (#1492,#1731)
|
||||||
- [Cocoa] Bugfix: Menubar was not clickable on macOS 10.15+ until it lost and
|
- [Wayland] Bugfix: A key being repeated was not released when window lost focus
|
||||||
regained focus (#1648,#1802)
|
- [Wayland] Bugfix: Showing a hidden window did not emit a window refresh event
|
||||||
- [Cocoa] Bugfix: Monitor name query could segfault on macOS 11 (#1809,#1833)
|
- [Wayland] Bugfix: Full screen window creation did not ignore `GLFW_VISIBLE`
|
||||||
- [Cocoa] Bugfix: The install name of the installed dylib was relative (#1504)
|
- [Wayland] Bugfix: Some keys were reported as wrong key or `GLFW_KEY_UNKNOWN`
|
||||||
- [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
|
- [Wayland] Bugfix: Text input did not repeat along with key repeat
|
||||||
- [X11] Bugfix: Xlib errors caused by other parts of the application could be
|
- [Wayland] Bugfix: `glfwPostEmptyEvent` sometimes had no effect (#1520,#1521)
|
||||||
reported as GLFW errors
|
- [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library
|
||||||
- [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)
|
|
||||||
- [X11] Bugfix: Keys pressed simultaneously with others were not always
|
|
||||||
reported (#1112,#1415,#1472,#1616)
|
|
||||||
- [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704)
|
|
||||||
- [Wayland] Bugfix: Retrieving partial framebuffer size would segfault
|
|
||||||
- [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms
|
|
||||||
(#1463)
|
|
||||||
- [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong worder
|
|
||||||
(#1798)
|
|
||||||
- [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792)
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
On [glfw.org](http://www.glfw.org/) you can find the latest version of GLFW, as
|
On [glfw.org](https://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
|
||||||
[Freenode](http://freenode.net/).
|
[Libera.Chat](https://libera.chat/).
|
||||||
|
|
||||||
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
|
||||||
@@ -177,216 +168,3 @@ 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
|
|
||||||
- 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
|
|
||||||
- Kyle Brenneman
|
|
||||||
- Rok Breulj
|
|
||||||
- Kai Burjack
|
|
||||||
- Martin Capitanio
|
|
||||||
- Nicolas Caramelli
|
|
||||||
- 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
|
|
||||||
- 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
|
|
||||||
- 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 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
|
|
||||||
- Waris
|
|
||||||
- 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
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
[Freenode](http://freenode.net/).
|
[Libera.Chat](https://libera.chat/).
|
||||||
|
|
||||||
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,13 +208,6 @@ 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
|
||||||
@@ -854,12 +847,6 @@ 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
|
||||||
@@ -1367,13 +1354,6 @@ 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](http://www.glfw.org/docs/latest/) for tutorials,
|
See the [latest documentation](https://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
|
||||||
[Freenode](http://freenode.net/).
|
[Libera.Chat](https://libera.chat/).
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
+208
-131
@@ -10,165 +10,173 @@ 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 a particular development environment. If you are on a Unix-like system such
|
for your chosen development environment. To compile GLFW, first generate these
|
||||||
as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or
|
files with CMake and then use them to compile the GLFW library.
|
||||||
Homebrew, you can install its CMake package. If not, you can download
|
|
||||||
installers for Windows and macOS from the
|
|
||||||
[CMake website](https://cmake.org/).
|
|
||||||
|
|
||||||
@note CMake only generates project files or makefiles. It does not compile the
|
If you are on Windows and macOS you can
|
||||||
actual GLFW library. To compile GLFW, first generate these files for your
|
[download CMake](https://cmake.org/download/) from their site.
|
||||||
chosen development environment and then use them to compile the actual GLFW
|
|
||||||
library.
|
If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have
|
||||||
|
a package system like Fink, MacPorts or Homebrew, you can install its CMake
|
||||||
|
package.
|
||||||
|
|
||||||
|
CMake is a complex tool and this guide will only show a few of the possible ways
|
||||||
|
to set up and compile GLFW. The CMake project has their own much more detailed
|
||||||
|
[CMake user guide](https://cmake.org/cmake/help/latest/guide/user-interaction/)
|
||||||
|
that includes everything in this guide not specific to GLFW. It may be a useful
|
||||||
|
companion to this one.
|
||||||
|
|
||||||
|
|
||||||
@subsection compile_deps Dependencies
|
@subsection compile_deps Installing dependencies
|
||||||
|
|
||||||
Once you have installed CMake, make sure that all other dependencies are
|
The C/C++ development environments in Visual Studio, Xcode and MinGW come with
|
||||||
available. On some platforms, GLFW needs a few additional packages to be
|
all necessary dependencies for compiling GLFW, but on Unix-like systems like
|
||||||
installed. See the section for your chosen platform and development environment
|
Linux and FreeBSD you will need a few extra packages.
|
||||||
below.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_deps_msvc Dependencies for Visual C++ on Windows
|
@subsubsection compile_deps_x11 Dependencies for X11 on Unix-like systems
|
||||||
|
|
||||||
The Windows SDK bundled with Visual C++ already contains all the necessary
|
To compile GLFW for X11, you need to have the X11 development packages
|
||||||
headers, link libraries and tools except for CMake. Move on to @ref
|
installed. They are not needed to build or run programs that use GLFW.
|
||||||
compile_generate.
|
|
||||||
|
|
||||||
|
On Debian and derivates like Ubuntu and Linux Mint the `xorg-dev` meta-package
|
||||||
@subsubsection compile_deps_mingw Dependencies for MinGW or MinGW-w64 on Windows
|
pulls in the development packages for all of X11.
|
||||||
|
|
||||||
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}
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
|
sudo apt install xorg-dev
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The exact toolchain file to use depends on the prefix used by the MinGW or
|
On Fedora and derivatives like Red Hat the X11 extension packages
|
||||||
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
`libXcursor-devel`, `libXi-devel`, `libXinerama-devel` and `libXrandr-devel`
|
||||||
directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages
|
required by GLFW pull in all its other dependencies.
|
||||||
have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct
|
|
||||||
invocation would be:
|
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
|
sudo dnf install libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
For more details see the article
|
On FreeBSD the X11 headers are installed along the end-user X11 packages, so if
|
||||||
[CMake Cross Compiling](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling) on
|
you have an X server running you should have the headers as well. If not,
|
||||||
the CMake wiki.
|
install the `xorgproto` package.
|
||||||
|
|
||||||
Once you have this set up, move on to @ref compile_generate.
|
@code{.sh}
|
||||||
|
pkg install xorgproto
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
On Cygwin the `libXcursor-devel`, `libXi-devel`, `libXinerama-devel`,
|
||||||
|
`libXrandr-devel` and `libXrender-devel` packages in the Libs section of the GUI
|
||||||
|
installer will install all the headers and other development related files GLFW
|
||||||
|
requires for X11.
|
||||||
|
|
||||||
|
Once you have the required depdendencies, move on to @ref compile_generate.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_deps_xcode Dependencies for Xcode on macOS
|
@subsubsection compile_deps_wayland Dependencies for Wayland on Unix-like systems
|
||||||
|
|
||||||
Xcode comes with all necessary tools except for CMake. The required headers
|
To compile GLFW for Wayland, you need to have the Wayland and xkbcommon
|
||||||
and libraries are included in the core macOS frameworks. Xcode can be
|
development packages installed. They are not needed to build or run programs
|
||||||
downloaded from the Mac App Store or from the ADC Member Center.
|
that use GLFW.
|
||||||
|
|
||||||
Once you have Xcode installed, move on to @ref compile_generate.
|
On Debian and derivates like Ubuntu and Linux Mint you will need the `libwayland-dev`,
|
||||||
|
`libxkbcommon-dev`, `wayland-protocols` and `extra-cmake-modules` packages.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
|
||||||
|
@endcode
|
||||||
|
|
||||||
@subsubsection compile_deps_x11 Dependencies for Linux and X11
|
On Fedora and derivatives like Red Hat you will need the `wayland-devel`,
|
||||||
|
`libxkbcommon-devel`, `wayland-protocols-devel` and `extra-cmake-modules` packages.
|
||||||
|
|
||||||
To compile GLFW for X11, you need to have the X11 packages installed, as well as
|
@code{.sh}
|
||||||
the basic development tools like GCC and make. For example, on Ubuntu and other
|
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules
|
||||||
distributions based on Debian GNU/Linux, you need to install the `xorg-dev`
|
@endcode
|
||||||
package, which pulls in all X.org header packages.
|
|
||||||
|
|
||||||
Once you have installed the necessary packages, move on to @ref
|
On FreeBSD you will need the `wayland`, `libxkbcommon`, `wayland-protocols` and
|
||||||
compile_generate.
|
`kf5-extra-cmake-modules` packages.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
pkg install wayland libxkbcommon wayland-protocols kf5-extra-cmake-modules
|
||||||
|
@endcode
|
||||||
|
|
||||||
@subsubsection compile_deps_wayland Dependencies for Linux and Wayland
|
Once you have the required depdendencies, move on to @ref compile_generate.
|
||||||
|
|
||||||
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 to know two
|
files or makefiles for your development environment. CMake needs two paths for
|
||||||
paths for this: the path to the _root_ directory of the GLFW source tree (i.e.
|
this:
|
||||||
_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.
|
|
||||||
|
|
||||||
One of several advantages of out-of-tree builds is that you can generate files
|
- the path to the root directory of the GLFW source tree (not its `src`
|
||||||
and compile for different development environments using a single source tree.
|
subdirectory)
|
||||||
|
- the path to the directory where the generated build files and compiled
|
||||||
|
binaries will be placed
|
||||||
|
|
||||||
@note This section is about generating the project files or makefiles necessary
|
If these are the same, it is called an in-tree build, otherwise it is called an
|
||||||
to compile the GLFW library, not about compiling the actual library.
|
out-of-tree build.
|
||||||
|
|
||||||
|
Out-of-tree builds are recommended as they avoid cluttering up the source tree.
|
||||||
|
They also allow you to have several build directories for different
|
||||||
|
configurations all using the same source tree.
|
||||||
|
|
||||||
|
A common pattern when building a single configuration is to have a build
|
||||||
|
directory named `build` in the root of the source tree.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_generate_cli Generating files with the CMake command-line tool
|
@subsubsection compile_generate_gui Generating files with the CMake GUI
|
||||||
|
|
||||||
To make an in-tree build, enter the _root_ directory of the GLFW source tree
|
Start the CMake GUI and set the paths to the source and build directories
|
||||||
(i.e. _not_ the `src` subdirectory) and run CMake. The current directory is
|
described above. Then press _Configure_ and _Generate_.
|
||||||
used as target path, while the path provided as an argument is used to find the
|
|
||||||
source tree.
|
|
||||||
|
|
||||||
@code{.sh}
|
If you wish change any CMake variables in the list, press _Configure_ and then
|
||||||
cd <glfw-root-dir>
|
_Generate_ to have the new values take effect. The variable list will be
|
||||||
cmake .
|
populated after the first configure step.
|
||||||
@endcode
|
|
||||||
|
|
||||||
To make an out-of-tree build, make a directory outside of the source tree, enter
|
By default GLFW will use X11 on Linux and other Unix-like systems other
|
||||||
it and run CMake with the (relative or absolute) path to the root of the source
|
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` option in the
|
||||||
tree as an argument.
|
GLFW section of the variable list, then apply the new value as described above.
|
||||||
|
|
||||||
@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_gui Generating files with the CMake GUI
|
@subsubsection compile_generate_cli Generating files with the CMake command-line tool
|
||||||
|
|
||||||
If you are using the GUI version, choose the root of the GLFW source tree as
|
To make a build directory, pass the source and build directories to the `cmake`
|
||||||
source location and the same directory or another, empty directory as the
|
command. These can be relative or absolute paths. The build directory is
|
||||||
destination for binaries. Choose _Configure_, change any options you wish to,
|
created if it doesn't already exist.
|
||||||
_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.
|
||||||
@@ -178,13 +186,39 @@ 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.
|
||||||
|
|
||||||
Once the GLFW library is compiled, you are ready to build your applications,
|
With Visual Studio open `GLFW.sln` and use the Build menu. With Xcode open
|
||||||
|
`GLFW.xcodeproj` and use the Project menu.
|
||||||
|
|
||||||
|
With Linux, macOS and other forms of Unix, run `make`.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cd path/to/build
|
||||||
|
make
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
With MinGW, it is `mingw32-make`.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cd path/to/build
|
||||||
|
mingw32-make
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Any CMake build directory can also be built with the `cmake` command and the
|
||||||
|
`--build` flag.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cmake --build path/to/build
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
This will run the platform specific build tool the directory was generated for.
|
||||||
|
|
||||||
|
Once the GLFW library is compiled you are ready to build your application,
|
||||||
linking it to the GLFW library. See @ref build_guide for more information.
|
linking it to the GLFW library. See @ref build_guide for more information.
|
||||||
|
|
||||||
|
|
||||||
@subsection compile_options CMake options
|
@section 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
|
||||||
@@ -200,15 +234,16 @@ 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 -DBUILD_SHARED_LIBS=ON .
|
cmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ON
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_options_shared Shared CMake options
|
@subsection 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.
|
library or as a DLL / shared library / dynamic library. This is disabled by
|
||||||
|
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
|
||||||
@@ -220,33 +255,80 @@ built along with the library.
|
|||||||
|
|
||||||
@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.
|
with the library. This is enabled by default if
|
||||||
|
[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.
|
directly with the application. This is disabled by default.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_options_win32 Windows specific CMake options
|
@subsection 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. If set to `ON`, the
|
static library version of the Visual C++ runtime library. When enabled, the
|
||||||
DLL version of the Visual C++ library is used.
|
DLL version of the Visual C++ library is used. This is enabled by default.
|
||||||
|
|
||||||
|
On CMake 3.15 and later you can set the standard CMake
|
||||||
|
[CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)
|
||||||
|
variable instead of this GLFW-specific option.
|
||||||
|
|
||||||
@anchor GLFW_USE_HYBRID_HPG
|
@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.
|
will not work if GLFW is built as a DLL. This is disabled by default, letting
|
||||||
|
the operating system and driver decide.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection compile_options_wayland Wayland specific CMake options
|
||||||
|
|
||||||
|
@anchor GLFW_USE_WAYLAND
|
||||||
|
__GLFW_USE_WAYLAND__ determines whether to compile the library for Wayland.
|
||||||
|
This option is only available on Linux and other Unix-like systems other than
|
||||||
|
macOS. This is disabled by default.
|
||||||
|
|
||||||
|
|
||||||
|
@section compile_mingw_cross Cross-compilation with CMake and MinGW
|
||||||
|
|
||||||
|
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
|
||||||
|
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
|
||||||
|
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
|
||||||
|
like Ubuntu have the `mingw-w64` package for both.
|
||||||
|
|
||||||
|
GLFW has CMake toolchain files in the `CMake` subdirectory that set up
|
||||||
|
cross-compilation of Windows binaries. To use these files you set the
|
||||||
|
`CMAKE_TOOLCHAIN_FILE` CMake variable with the `-D` flag add an option when
|
||||||
|
configuring and generating the build files.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The exact toolchain file to use depends on the prefix used by the MinGW or
|
||||||
|
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
||||||
|
directory. For example, both the Ubuntu and Cygwin MinGW-w64 packages have
|
||||||
|
`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
|
||||||
|
would be:
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The path to the toolchain file is relative to the path to the GLFW source tree
|
||||||
|
passed to the `-S` flag, not to the current directory.
|
||||||
|
|
||||||
|
For more details see the
|
||||||
|
[CMake toolchain guide](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html).
|
||||||
|
|
||||||
|
|
||||||
@section compile_manual Compiling GLFW manually
|
@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's
|
a configuration macro to be defined in order to know what window system it is
|
||||||
being compiled for and also has optional, platform-specific ones for various
|
being compiled for and also has optional, platform-specific ones for various
|
||||||
features.
|
features.
|
||||||
|
|
||||||
@@ -278,11 +360,6 @@ 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
-18
@@ -142,9 +142,9 @@ as extensions until they become obsolete.
|
|||||||
|
|
||||||
An extension is defined by:
|
An extension is defined by:
|
||||||
|
|
||||||
- An extension name (e.g. `GL_ARB_debug_output`)
|
- An extension name (e.g. `GL_ARB_gl_spirv`)
|
||||||
- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`)
|
- New OpenGL tokens (e.g. `GL_SPIR_V_BINARY_ARB`)
|
||||||
- New OpenGL functions (e.g. `glGetDebugMessageLogARB`)
|
- New OpenGL functions (e.g. `glSpecializeShaderARB`)
|
||||||
|
|
||||||
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 +229,9 @@ To check whether a specific extension is supported, use the `GLAD_GL_xxx`
|
|||||||
booleans.
|
booleans.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (GLAD_GL_ARB_debug_output)
|
if (GLAD_GL_ARB_gl_spirv)
|
||||||
{
|
{
|
||||||
// Use GL_ARB_debug_output
|
// Use GL_ARB_gl_spirv
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@@ -263,8 +263,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 `PFNGLGETDEBUGMESSAGELOGARBPROC` (for
|
supports. These have names like `PFNGLSPECIALIZESHADERARBPROC` (for
|
||||||
`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer
|
`glSpecializeShaderARB`), 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 +284,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_debug_output"))
|
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
||||||
{
|
{
|
||||||
// The extension is supported by the current context
|
// The extension is supported by the current context
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,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
|
||||||
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB");
|
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB");
|
||||||
@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 +317,28 @@ when used together.
|
|||||||
#define GLFW_INCLUDE_GLEXT
|
#define GLFW_INCLUDE_GLEXT
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#define glGetDebugMessageLogARB pfnGetDebugMessageLog
|
#define glSpecializeShaderARB pfnSpecializeShaderARB
|
||||||
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;
|
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB;
|
||||||
|
|
||||||
// Flag indicating whether the extension is supported
|
// Flag indicating whether the extension is supported
|
||||||
int has_ARB_debug_output = 0;
|
int has_ARB_gl_spirv = 0;
|
||||||
|
|
||||||
void load_extensions(void)
|
void load_extensions(void)
|
||||||
{
|
{
|
||||||
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
||||||
{
|
{
|
||||||
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC)
|
pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC)
|
||||||
glfwGetProcAddress("glGetDebugMessageLogARB");
|
glfwGetProcAddress("glSpecializeShaderARB");
|
||||||
has_ARB_debug_output = 1;
|
has_ARB_gl_spirv = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void some_function(void)
|
void some_function(void)
|
||||||
{
|
{
|
||||||
if (has_ARB_debug_output)
|
if (has_ARB_gl_spirv)
|
||||||
{
|
{
|
||||||
// Now the extension function can be called as usual
|
// Now the extension function can be called as usual
|
||||||
glGetDebugMessageLogARB(...);
|
glSpecializeShaderARB(...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|||||||
+6
-1
@@ -794,6 +794,11 @@ 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.
|
||||||
@@ -813,7 +818,7 @@ The second value is always the human-readable name of the gamepad.
|
|||||||
All subsequent values are in the form `<field>:<value>` and describe the layout
|
All subsequent values are in the form `<field>:<value>` and describe the layout
|
||||||
of the mapping. These fields may not all be present and may occur in any order.
|
of the mapping. These fields may not all be present and may occur in any order.
|
||||||
|
|
||||||
The button fields are `a`, `b`, `c`, `d`, `back`, `start`, `guide`, `dpup`,
|
The button fields are `a`, `b`, `x`, `y`, `back`, `start`, `guide`, `dpup`,
|
||||||
`dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and
|
`dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and
|
||||||
`rightstick`.
|
`rightstick`.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,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. Set this with @ref glfwInitHint.
|
glfwGetJoystickHats. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection init_hints_osx macOS specific init hints
|
@subsubsection init_hints_osx macOS specific init hints
|
||||||
|
|||||||
@@ -306,6 +306,12 @@ GLFW_TRANSPARENT_FRAMEBUFFER on Windows 7 if DWM transparency is off
|
|||||||
(the Transparency setting under Personalization > Window Color).
|
(the Transparency setting under Personalization > Window Color).
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection emptyevents_33 Empty events on X11 no longer roundtrip to server
|
||||||
|
|
||||||
|
Starting with GLFW 3.3.7, events posted with @ref glfwPostEmptyEvent now use a separate
|
||||||
|
unnamed pipe instead of sending an X11 client event to the helper window.
|
||||||
|
|
||||||
|
|
||||||
@subsection deprecations_33 Deprecations in version 3.3
|
@subsection deprecations_33 Deprecations in version 3.3
|
||||||
|
|
||||||
@subsubsection charmods_callback_33 Character with modifiers callback
|
@subsubsection charmods_callback_33 Character with modifiers callback
|
||||||
|
|||||||
+33
-52
@@ -236,7 +236,8 @@ does not affect window decorations. Possible values are `GLFW_TRUE` and
|
|||||||
|
|
||||||
@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 `GLFW_FALSE`.
|
focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and
|
||||||
|
`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
|
||||||
@@ -271,7 +272,6 @@ __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,7 +279,6 @@ 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.
|
||||||
|
|
||||||
@@ -296,14 +295,12 @@ 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`.
|
||||||
|
|
||||||
@par
|
@note __OpenGL:__ If enabled and supported by the system, the
|
||||||
__OpenGL:__ If enabled and supported by the system, the `GL_FRAMEBUFFER_SRGB`
|
`GL_FRAMEBUFFER_SRGB` enable will control sRGB rendering. By default, sRGB
|
||||||
enable will control sRGB rendering. By default, sRGB rendering will be
|
rendering will be disabled.
|
||||||
disabled.
|
|
||||||
|
|
||||||
@par
|
@note __OpenGL ES:__ If enabled and supported by the system, the context will
|
||||||
__OpenGL ES:__ If enabled and supported by the system, the context will always
|
always have sRGB rendering enabled.
|
||||||
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
|
||||||
@@ -332,28 +329,22 @@ 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.
|
||||||
|
|
||||||
@par
|
An [extension loader library](@ref context_glext_auto) that assumes it knows
|
||||||
@macos The EGL API is not available on this platform and requests to use it
|
which API was used to create the current context may fail if you change this
|
||||||
will fail.
|
hint. This can be resolved by having it load functions via @ref
|
||||||
|
glfwGetProcAddress.
|
||||||
|
|
||||||
@par
|
@note @wayland The EGL API _is_ the native context creation API, so this hint
|
||||||
__Wayland:__ The EGL API _is_ the native context creation API, so this hint
|
|
||||||
will have no effect.
|
will have no effect.
|
||||||
|
|
||||||
@par
|
@note @x11 On some Linux systems, creating contexts via both the native and EGL
|
||||||
__OSMesa:__ As its name implies, an OpenGL context created with OSMesa does not
|
APIs in a single process will cause the application to segfault. Stick to one
|
||||||
update the window contents when its buffers are swapped. Use OpenGL functions
|
API or the other on Linux for now.
|
||||||
or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer and @ref
|
|
||||||
glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
|
|
||||||
|
|
||||||
@note An OpenGL extension loader library that assumes it knows which context
|
@note __OSMesa:__ As its name implies, an OpenGL context created with OSMesa
|
||||||
creation API is used on a given platform may fail if you change this hint. This
|
does not update the window contents when its buffers are swapped. Use OpenGL
|
||||||
can be resolved by having it load via @ref glfwGetProcAddress, which always uses
|
functions or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer
|
||||||
the selected API.
|
and @ref glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
|
||||||
|
|
||||||
@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
|
||||||
@@ -361,27 +352,24 @@ __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.
|
||||||
|
|
||||||
@par
|
Do not confuse these hints with @ref GLFW_VERSION_MAJOR and @ref
|
||||||
__OpenGL ES:__ These hints are not hard constraints, but creation will fail if
|
GLFW_VERSION_MINOR, which provide the API version of the GLFW header.
|
||||||
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,
|
@note __OpenGL:__ These hints are not hard constraints, but creation will fail
|
||||||
and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0,
|
if the OpenGL version of the created context is less than the one requested. It
|
||||||
but OpenGL ES 2.0 is not backward compatible with 1.x.
|
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.
|
||||||
|
|
||||||
|
@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
|
@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
|
OpenGL versions 3.2 and later. Before creating an OpenGL context of version
|
||||||
@@ -396,7 +384,6 @@ 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/).
|
||||||
|
|
||||||
@@ -405,7 +392,6 @@ __GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created
|
|||||||
in debug mode, which may provide additional error and diagnostic reporting
|
in debug mode, which may provide additional error and diagnostic reporting
|
||||||
functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||||
|
|
||||||
@par
|
|
||||||
Debug contexts for OpenGL and OpenGL ES are described in detail by the
|
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)
|
[GL_KHR_debug](https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt)
|
||||||
extension.
|
extension.
|
||||||
@@ -418,7 +404,6 @@ 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/).
|
||||||
|
|
||||||
@@ -438,7 +423,6 @@ 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.
|
||||||
@@ -448,7 +432,6 @@ __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.
|
||||||
@@ -474,12 +457,10 @@ 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`.
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ if (MATH_LIBRARY)
|
|||||||
link_libraries("${MATH_LIBRARY}")
|
link_libraries("${MATH_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
# Workaround for the MS CRT deprecating parts of the standard library
|
||||||
|
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()
|
||||||
|
|
||||||
@@ -62,9 +63,13 @@ if (GLFW_USE_OSMESA)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
# Tell MSVC to use main instead of WinMain
|
||||||
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)
|
||||||
|
|||||||
@@ -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()) / (1.0f * RAND_MAX);
|
*center_x = (MAP_SIZE * rand()) / (float) RAND_MAX;
|
||||||
*center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
|
*center_y = (MAP_SIZE * rand()) / (float) RAND_MAX;
|
||||||
*size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX);
|
*size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX;
|
||||||
sign = (1.0f * rand()) / (1.0f * RAND_MAX);
|
sign = (1.0f * rand()) / (float) 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())) / (1.0f * RAND_MAX);
|
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run the specified number of iterations of the generation process for the
|
/* Run the specified number of iterations of the generation process for the
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// This is an example program for the GLFW library
|
// This is an example program for the GLFW library
|
||||||
//
|
//
|
||||||
// The program uses a "split window" view, rendering four views of the
|
// The program uses a "split window" view, rendering four views of the
|
||||||
// same scene in one window (e.g. uesful for 3D modelling software). This
|
// same scene in one window (e.g. useful for 3D modelling software). This
|
||||||
// demo uses scissors to separate the four different rendering areas from
|
// demo uses scissors to separate the four different rendering areas from
|
||||||
// each other.
|
// each other.
|
||||||
//
|
//
|
||||||
|
|||||||
+58
-50
@@ -190,6 +190,9 @@ 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__*/
|
||||||
|
|
||||||
@@ -276,26 +279,27 @@ extern "C" {
|
|||||||
|
|
||||||
/*! @name GLFW version macros
|
/*! @name GLFW version macros
|
||||||
* @{ */
|
* @{ */
|
||||||
/*! @brief The major version number of the GLFW library.
|
/*! @brief The major version number of the GLFW header.
|
||||||
*
|
*
|
||||||
* This is incremented when the API is changed in non-compatible ways.
|
* The major version number of the GLFW header. This is incremented when the
|
||||||
|
* API is changed in non-compatible ways.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_MAJOR 3
|
#define GLFW_VERSION_MAJOR 3
|
||||||
/*! @brief The minor version number of the GLFW library.
|
/*! @brief The minor version number of the GLFW header.
|
||||||
*
|
*
|
||||||
* This is incremented when features are added to the API but it remains
|
* The minor version number of the GLFW header. This is incremented when
|
||||||
* backward-compatible.
|
* features are added to the API but it remains backward-compatible.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_MINOR 3
|
#define GLFW_VERSION_MINOR 3
|
||||||
/*! @brief The revision number of the GLFW library.
|
/*! @brief The revision number of the GLFW header.
|
||||||
*
|
*
|
||||||
* This is incremented when a bug fix release is made that does not contain any
|
* The revision number of the GLFW header. This is incremented when a bug fix
|
||||||
* API changes.
|
* release is made that does not contain any API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 3
|
#define GLFW_VERSION_REVISION 7
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@@ -956,7 +960,7 @@ extern "C" {
|
|||||||
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
|
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
|
||||||
/*! @brief Context client API revision number hint and attribute.
|
/*! @brief Context client API revision number attribute.
|
||||||
*
|
*
|
||||||
* Context client API revision number
|
* Context client API revision number
|
||||||
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
||||||
@@ -1215,7 +1219,7 @@ typedef struct GLFWcursor GLFWcursor;
|
|||||||
*
|
*
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWerrorfun)(int,const char*);
|
typedef void (* GLFWerrorfun)(int error_code, const char* description);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window position callbacks.
|
/*! @brief The function pointer type for window position callbacks.
|
||||||
*
|
*
|
||||||
@@ -1238,7 +1242,7 @@ typedef void (* GLFWerrorfun)(int,const char*);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
|
typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window size callbacks.
|
/*! @brief The function pointer type for window size callbacks.
|
||||||
*
|
*
|
||||||
@@ -1260,7 +1264,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
|
typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window close callbacks.
|
/*! @brief The function pointer type for window close callbacks.
|
||||||
*
|
*
|
||||||
@@ -1280,7 +1284,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowclosefun)(GLFWwindow*);
|
typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window content refresh callbacks.
|
/*! @brief The function pointer type for window content refresh callbacks.
|
||||||
*
|
*
|
||||||
@@ -1300,7 +1304,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
|
typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window focus callbacks.
|
/*! @brief The function pointer type for window focus callbacks.
|
||||||
*
|
*
|
||||||
@@ -1321,7 +1325,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
|
typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window iconify callbacks.
|
/*! @brief The function pointer type for window iconify callbacks.
|
||||||
*
|
*
|
||||||
@@ -1342,7 +1346,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window maximize callbacks.
|
/*! @brief The function pointer type for window maximize callbacks.
|
||||||
*
|
*
|
||||||
@@ -1363,7 +1367,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
|
typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
|
||||||
|
|
||||||
/*! @brief The function pointer type for framebuffer size callbacks.
|
/*! @brief The function pointer type for framebuffer size callbacks.
|
||||||
*
|
*
|
||||||
@@ -1384,7 +1388,7 @@ typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
|
typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);
|
||||||
|
|
||||||
/*! @brief The function pointer type for window content scale callbacks.
|
/*! @brief The function pointer type for window content scale callbacks.
|
||||||
*
|
*
|
||||||
@@ -1405,7 +1409,7 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
|
|||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
|
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);
|
||||||
|
|
||||||
/*! @brief The function pointer type for mouse button callbacks.
|
/*! @brief The function pointer type for mouse button callbacks.
|
||||||
*
|
*
|
||||||
@@ -1431,7 +1435,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
|
||||||
|
|
||||||
/*! @brief The function pointer type for cursor position callbacks.
|
/*! @brief The function pointer type for cursor position callbacks.
|
||||||
*
|
*
|
||||||
@@ -1454,7 +1458,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
|
typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
|
||||||
|
|
||||||
/*! @brief The function pointer type for cursor enter/leave callbacks.
|
/*! @brief The function pointer type for cursor enter/leave callbacks.
|
||||||
*
|
*
|
||||||
@@ -1475,7 +1479,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
|
||||||
|
|
||||||
/*! @brief The function pointer type for scroll callbacks.
|
/*! @brief The function pointer type for scroll callbacks.
|
||||||
*
|
*
|
||||||
@@ -1496,7 +1500,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);
|
||||||
|
|
||||||
/*! @brief The function pointer type for keyboard key callbacks.
|
/*! @brief The function pointer type for keyboard key callbacks.
|
||||||
*
|
*
|
||||||
@@ -1522,7 +1526,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||||
|
|
||||||
/*! @brief The function pointer type for Unicode character callbacks.
|
/*! @brief The function pointer type for Unicode character callbacks.
|
||||||
*
|
*
|
||||||
@@ -1543,7 +1547,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
|
||||||
|
|
||||||
/*! @brief The function pointer type for Unicode character with modifiers
|
/*! @brief The function pointer type for Unicode character with modifiers
|
||||||
* callbacks.
|
* callbacks.
|
||||||
@@ -1570,7 +1574,7 @@ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
|
typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);
|
||||||
|
|
||||||
/*! @brief The function pointer type for path drop callbacks.
|
/*! @brief The function pointer type for path drop callbacks.
|
||||||
*
|
*
|
||||||
@@ -1594,7 +1598,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
|
typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);
|
||||||
|
|
||||||
/*! @brief The function pointer type for monitor configuration callbacks.
|
/*! @brief The function pointer type for monitor configuration callbacks.
|
||||||
*
|
*
|
||||||
@@ -1615,7 +1619,7 @@ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
|
|||||||
*
|
*
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
|
||||||
|
|
||||||
/*! @brief The function pointer type for joystick configuration callbacks.
|
/*! @brief The function pointer type for joystick configuration callbacks.
|
||||||
*
|
*
|
||||||
@@ -1636,7 +1640,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWjoystickfun)(int,int);
|
typedef void (* GLFWjoystickfun)(int jid, int event);
|
||||||
|
|
||||||
/*! @brief Video mode type.
|
/*! @brief Video mode type.
|
||||||
*
|
*
|
||||||
@@ -2124,8 +2128,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 calculates the returned physical size from the
|
* @remark @win32 On Windows 8 and earlier the physical size is calculated from
|
||||||
* current resolution and system DPI instead of querying the monitor EDID data.
|
* the 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.
|
||||||
*
|
*
|
||||||
@@ -2279,8 +2283,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
|||||||
*
|
*
|
||||||
* This function returns an array of all video modes supported by the specified
|
* This function returns an array of all video modes supported by the specified
|
||||||
* monitor. The returned array is sorted in ascending order, first by color
|
* monitor. The returned array is sorted in ascending order, first by color
|
||||||
* bit depth (the sum of all channel depths) and then by resolution area (the
|
* bit depth (the sum of all channel depths), then by resolution area (the
|
||||||
* product of width and height).
|
* product of width and height), then resolution width and finally by refresh
|
||||||
|
* rate.
|
||||||
*
|
*
|
||||||
* @param[in] monitor The monitor to query.
|
* @param[in] monitor The monitor to query.
|
||||||
* @param[out] count Where to store the number of video modes in the returned
|
* @param[out] count Where to store the number of video modes in the returned
|
||||||
@@ -3307,6 +3312,11 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
|
* @remark @wayland Because Wayland wants every frame of the desktop to be
|
||||||
|
* complete, this function does not immediately make the window visible.
|
||||||
|
* Instead it will become visible the next time the window framebuffer is
|
||||||
|
* updated after this call.
|
||||||
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_hide
|
* @sa @ref window_hide
|
||||||
@@ -5222,6 +5232,8 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string);
|
|||||||
* joystick is not present, does not have a mapping or an
|
* joystick is not present, does not have a mapping or an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.
|
||||||
|
*
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is valid until the specified joystick is
|
* should not free it yourself. It is valid until the specified joystick is
|
||||||
* disconnected, the gamepad mappings are updated or the library is terminated.
|
* disconnected, the gamepad mappings are updated or the library is terminated.
|
||||||
@@ -5311,8 +5323,8 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
|||||||
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
||||||
* if an [error](@ref error_handling) occurred.
|
* if an [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is valid until the next call to @ref
|
* should not free it yourself. It is valid until the next call to @ref
|
||||||
@@ -5656,13 +5668,11 @@ 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
|
* The availability of a Vulkan loader and even an ICD does not by itself guarantee that
|
||||||
* guarantee that surface creation or even instance creation is possible.
|
* surface creation or even instance creation is possible. Call @ref
|
||||||
* For example, on Fermi systems Nvidia will install an ICD that provides no
|
* glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan
|
||||||
* actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
|
* surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to
|
||||||
* whether the extensions necessary for Vulkan surface creation are available
|
* check whether a queue family of a physical device supports image presentation.
|
||||||
* 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.
|
||||||
@@ -5708,10 +5718,6 @@ GLFWAPI int glfwVulkanSupported(void);
|
|||||||
* returned array, as it is an error to specify an extension more than once in
|
* returned array, as it is an error to specify an extension more than once in
|
||||||
* the `VkInstanceCreateInfo` struct.
|
* the `VkInstanceCreateInfo` struct.
|
||||||
*
|
*
|
||||||
* @remark @macos This function currently supports either the
|
|
||||||
* `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface`
|
|
||||||
* extension.
|
|
||||||
*
|
|
||||||
* @pointer_lifetime The returned array is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned array is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is guaranteed to be valid only until the
|
* should not free it yourself. It is guaranteed to be valid only until the
|
||||||
* library is terminated.
|
* library is terminated.
|
||||||
@@ -5793,7 +5799,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
|
|||||||
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @macos This function currently always returns `GLFW_TRUE`, as the
|
* @remark @macos This function currently always returns `GLFW_TRUE`, as the
|
||||||
* `VK_MVK_macos_surface` extension does not provide
|
* `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
|
||||||
* a `vkGetPhysicalDevice*PresentationSupport` type function.
|
* a `vkGetPhysicalDevice*PresentationSupport` type function.
|
||||||
*
|
*
|
||||||
* @thread_safety This function may be called from any thread. For
|
* @thread_safety This function may be called from any thread. For
|
||||||
@@ -5850,8 +5856,10 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys
|
|||||||
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
|
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
|
||||||
* eliminate almost all occurrences of these errors.
|
* eliminate almost all occurrences of these errors.
|
||||||
*
|
*
|
||||||
* @remark @macos This function currently only supports the
|
* @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the
|
||||||
* `VK_MVK_macos_surface` extension from MoltenVK.
|
* `VK_MVK_macos_surface` extension as a fallback. The name of the selected
|
||||||
|
* extension, if any, is included in the array returned by @ref
|
||||||
|
* glfwGetRequiredInstanceExtensions.
|
||||||
*
|
*
|
||||||
* @remark @macos This function creates and sets a `CAMetalLayer` instance for
|
* @remark @macos This function creates and sets a `CAMetalLayer` instance for
|
||||||
* the window content view, which is required for MoltenVK to function.
|
* the window content view, which is required for MoltenVK to function.
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ extern "C" {
|
|||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
// example to allow applications to correctly declare a GL_ARB_debug_output
|
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||||
// callback) but windows.h assumes no one will define APIENTRY before it does
|
// but windows.h assumes no one will define APIENTRY before it does
|
||||||
#if defined(GLFW_APIENTRY_DEFINED)
|
#if defined(GLFW_APIENTRY_DEFINED)
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
#undef GLFW_APIENTRY_DEFINED
|
#undef GLFW_APIENTRY_DEFINED
|
||||||
@@ -132,6 +132,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -147,6 +149,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -161,6 +165,16 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -177,6 +191,17 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -193,6 +218,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -207,6 +234,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -223,6 +252,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -239,6 +271,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -253,6 +287,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -267,6 +303,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -281,6 +319,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -347,6 +387,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -361,6 +404,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -377,6 +423,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -391,6 +439,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -405,6 +455,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -421,6 +473,8 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -435,6 +489,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -449,6 +506,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -472,6 +532,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -493,6 +556,9 @@ 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.
|
||||||
*
|
*
|
||||||
@@ -507,6 +573,9 @@ 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.
|
||||||
*
|
*
|
||||||
|
|||||||
+21
-16
@@ -5,6 +5,15 @@ set(common_HEADERS internal.h mappings.h
|
|||||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
|
||||||
set(common_SOURCES context.c init.c input.c monitor.c 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
|
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h
|
||||||
posix_thread.h nsgl_context.h egl_context.h osmesa_context.h)
|
posix_thread.h nsgl_context.h egl_context.h osmesa_context.h)
|
||||||
@@ -121,22 +130,18 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable a reasonable set of warnings
|
# Enable a reasonable set of warnings
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
# NOTE: The order matters here, Clang-CL matches both MSVC and Clang
|
||||||
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
if (MSVC)
|
||||||
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
|
||||||
|
|
||||||
if (CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
|
||||||
# Tell Clang-CL that this is a Clang flag
|
|
||||||
target_compile_options(glfw PRIVATE "/clang:-Wall")
|
|
||||||
else()
|
|
||||||
target_compile_options(glfw PRIVATE "-Wall")
|
|
||||||
endif()
|
|
||||||
elseif (MSVC)
|
|
||||||
target_compile_options(glfw PRIVATE "/W3")
|
target_compile_options(glfw PRIVATE "/W3")
|
||||||
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||||
|
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
||||||
|
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
|
||||||
|
target_compile_options(glfw PRIVATE "-Wall")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (_GLFW_WIN32)
|
||||||
target_compile_definitions(glfw PRIVATE _UNICODE)
|
target_compile_definitions(glfw PRIVATE UNICODE _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
|
||||||
@@ -144,7 +149,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 UNICODE WINVER=0x0501)
|
target_compile_definitions(glfw PRIVATE WINVER=0x0501)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
@@ -176,14 +181,14 @@ if (BUILD_SHARED_LIBS)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "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 "bin"
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#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
|
||||||
//
|
//
|
||||||
|
|||||||
+6
-6
@@ -58,12 +58,12 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||||||
io_service_t service;
|
io_service_t service;
|
||||||
CFDictionaryRef info;
|
CFDictionaryRef info;
|
||||||
|
|
||||||
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
||||||
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 NULL;
|
return _glfw_strdup("Display");
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((service = IOIteratorNext(it)) != 0)
|
while ((service = IOIteratorNext(it)) != 0)
|
||||||
@@ -101,7 +101,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 NULL;
|
return _glfw_strdup("Display");
|
||||||
}
|
}
|
||||||
|
|
||||||
CFDictionaryRef names =
|
CFDictionaryRef names =
|
||||||
@@ -114,7 +114,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 NULL;
|
return _glfw_strdup("Display");
|
||||||
}
|
}
|
||||||
|
|
||||||
const CFIndex size =
|
const CFIndex size =
|
||||||
@@ -231,7 +231,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
|||||||
io_iterator_t it;
|
io_iterator_t it;
|
||||||
io_service_t service;
|
io_service_t service;
|
||||||
|
|
||||||
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
||||||
IOServiceMatching("IOFramebuffer"),
|
IOServiceMatching("IOFramebuffer"),
|
||||||
&it) != 0)
|
&it) != 0)
|
||||||
{
|
{
|
||||||
@@ -356,7 +356,7 @@ void _glfwPollMonitorsNS(void)
|
|||||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
char* name = getMonitorName(displays[i], screen);
|
char* name = getMonitorName(displays[i], screen);
|
||||||
if (!name)
|
if (!name)
|
||||||
name = _glfw_strdup("Unknown");
|
continue;
|
||||||
|
|
||||||
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||||
monitor->ns.displayID = displays[i];
|
monitor->ns.displayID = displays[i];
|
||||||
|
|||||||
+15
-7
@@ -31,7 +31,9 @@
|
|||||||
|
|
||||||
// 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>
|
||||||
@@ -40,8 +42,10 @@ typedef void* id;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||||
// SDK versions where one is unavailable or the other deprecated
|
// SDK versions where one is unavailable or deprecated.
|
||||||
// We use the newer names in code and these macros to handle compatibility
|
// We use the newer names in code and replace them with the older names if
|
||||||
|
// the base SDK does not provide the newer names.
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||||
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||||
#define NSEventMaskAny NSAnyEventMask
|
#define NSEventMaskAny NSAnyEventMask
|
||||||
@@ -60,6 +64,15 @@ typedef void* id;
|
|||||||
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// NOTE: Many Cocoa dynamically linked constants have been renamed and we need
|
||||||
|
// to build across SDK versions where one is unavailable or deprecated.
|
||||||
|
// We use the newer names in code and replace them with the older names if
|
||||||
|
// the deployment target is older than the newer names.
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
|
||||||
|
#define NSPasteboardTypeURL NSURLPboardType
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||||
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
||||||
|
|
||||||
@@ -133,7 +146,6 @@ 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
|
||||||
@@ -168,7 +180,6 @@ typedef struct _GLFWlibraryNS
|
|||||||
PFN_LMGetKbdType GetKbdType;
|
PFN_LMGetKbdType GetKbdType;
|
||||||
CFStringRef kPropertyUnicodeKeyLayoutData;
|
CFStringRef kPropertyUnicodeKeyLayoutData;
|
||||||
} tis;
|
} tis;
|
||||||
|
|
||||||
} _GLFWlibraryNS;
|
} _GLFWlibraryNS;
|
||||||
|
|
||||||
// Cocoa-specific per-monitor data
|
// Cocoa-specific per-monitor data
|
||||||
@@ -180,7 +191,6 @@ 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
|
||||||
@@ -188,7 +198,6 @@ 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
|
||||||
@@ -196,7 +205,6 @@ typedef struct _GLFWcursorNS
|
|||||||
typedef struct _GLFWtimerNS
|
typedef struct _GLFWtimerNS
|
||||||
{
|
{
|
||||||
uint64_t frequency;
|
uint64_t frequency;
|
||||||
|
|
||||||
} _GLFWtimerNS;
|
} _GLFWtimerNS;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+24
-21
@@ -114,10 +114,11 @@ 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))
|
||||||
@@ -243,7 +244,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)windowDidResize:(NSNotification *)notification
|
- (void)windowDidResize:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (window->context.client != GLFW_NO_API)
|
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
@@ -278,7 +279,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)windowDidMove:(NSNotification *)notification
|
- (void)windowDidMove:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (window->context.client != GLFW_NO_API)
|
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
@@ -360,9 +361,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
markedText = [[NSMutableAttributedString alloc] init];
|
markedText = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
[self updateTrackingAreas];
|
[self updateTrackingAreas];
|
||||||
// NOTE: kUTTypeURL corresponds to NSPasteboardTypeURL but is available
|
[self registerForDraggedTypes:@[NSPasteboardTypeURL]];
|
||||||
// on 10.7 without having been deprecated yet
|
|
||||||
[self registerForDraggedTypes:@[(__bridge NSString*) kUTTypeURL]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -397,7 +396,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)updateLayer
|
- (void)updateLayer
|
||||||
{
|
{
|
||||||
if (window->context.client != GLFW_NO_API)
|
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
_glfwInputWindowDamage(window);
|
_glfwInputWindowDamage(window);
|
||||||
@@ -520,6 +519,18 @@ 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)
|
||||||
@@ -528,19 +539,6 @@ 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
|
||||||
@@ -1524,6 +1522,11 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1542,7 +1545,7 @@ 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");
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-7
@@ -196,12 +196,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->doublebuffer != current->doublebuffer)
|
|
||||||
{
|
|
||||||
// Double buffering is a hard constraint
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count number of missing buffers
|
// Count number of missing buffers
|
||||||
{
|
{
|
||||||
missing = 0;
|
missing = 0;
|
||||||
@@ -570,7 +564,9 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
|||||||
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
||||||
window->context.getProcAddress("glClear");
|
window->context.getProcAddress("glClear");
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
window->context.swapBuffers(window);
|
|
||||||
|
if (window->doublebuffer)
|
||||||
|
window->context.swapBuffers(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
|||||||
+25
-3
@@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||||||
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||||
|
|
||||||
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
||||||
u->doublebuffer = GLFW_TRUE;
|
u->doublebuffer = desired->doublebuffer;
|
||||||
|
|
||||||
u->handle = (uintptr_t) n;
|
u->handle = (uintptr_t) n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
@@ -230,6 +230,12 @@ static void swapBuffersEGL(_GLFWwindow* window)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_GLFW_WAYLAND)
|
||||||
|
// NOTE: Swapping buffers on a hidden window on Wayland makes it visible
|
||||||
|
if (!window->wl.visible)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
|
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,6 +320,8 @@ GLFWbool _glfwInitEGL(void)
|
|||||||
"libEGL.dylib",
|
"libEGL.dylib",
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libEGL-1.so",
|
"libEGL-1.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libEGL.so",
|
||||||
#else
|
#else
|
||||||
"libEGL.so.1",
|
"libEGL.so.1",
|
||||||
#endif
|
#endif
|
||||||
@@ -426,6 +434,8 @@ GLFWbool _glfwInitEGL(void)
|
|||||||
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
|
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
|
||||||
_glfw.egl.KHR_context_flush_control =
|
_glfw.egl.KHR_context_flush_control =
|
||||||
extensionSupportedEGL("EGL_KHR_context_flush_control");
|
extensionSupportedEGL("EGL_KHR_context_flush_control");
|
||||||
|
_glfw.egl.EXT_present_opaque =
|
||||||
|
extensionSupportedEGL("EGL_EXT_present_opaque");
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
@@ -596,6 +606,12 @@ 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);
|
||||||
|
|
||||||
|
if (_glfw.egl.EXT_present_opaque)
|
||||||
|
setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
||||||
|
|
||||||
setAttrib(EGL_NONE, EGL_NONE);
|
setAttrib(EGL_NONE, EGL_NONE);
|
||||||
|
|
||||||
window->context.egl.surface =
|
window->context.egl.surface =
|
||||||
@@ -627,6 +643,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
"libGLES_CM.dll",
|
"libGLES_CM.dll",
|
||||||
#elif defined(_GLFW_COCOA)
|
#elif defined(_GLFW_COCOA)
|
||||||
"libGLESv1_CM.dylib",
|
"libGLESv1_CM.dylib",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGLESv1_CM.so",
|
||||||
#else
|
#else
|
||||||
"libGLESv1_CM.so.1",
|
"libGLESv1_CM.so.1",
|
||||||
"libGLES_CM.so.1",
|
"libGLES_CM.so.1",
|
||||||
@@ -644,6 +662,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
"libGLESv2.dylib",
|
"libGLESv2.dylib",
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libGLESv2-2.so",
|
"libGLESv2-2.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGLESv2.so",
|
||||||
#else
|
#else
|
||||||
"libGLESv2.so.2",
|
"libGLESv2.so.2",
|
||||||
#endif
|
#endif
|
||||||
@@ -655,6 +675,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
_GLFW_OPENGL_LIBRARY,
|
_GLFW_OPENGL_LIBRARY,
|
||||||
#elif defined(_GLFW_WIN32)
|
#elif defined(_GLFW_WIN32)
|
||||||
#elif defined(_GLFW_COCOA)
|
#elif defined(_GLFW_COCOA)
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGL.so",
|
||||||
#else
|
#else
|
||||||
"libGL.so.1",
|
"libGL.so.1",
|
||||||
#endif
|
#endif
|
||||||
@@ -762,7 +784,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return EGL_NO_CONTEXT;
|
return EGL_NO_CONTEXT;
|
||||||
@@ -776,7 +798,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return EGL_NO_SURFACE;
|
return EGL_NO_SURFACE;
|
||||||
|
|||||||
+4
-2
@@ -80,6 +80,8 @@ 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
|
||||||
@@ -106,6 +108,7 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
|
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
|
||||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
|
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
|
||||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
|
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
|
||||||
|
#define EGL_PRESENT_OPAQUE_EXT 0x31df
|
||||||
|
|
||||||
typedef int EGLint;
|
typedef int EGLint;
|
||||||
typedef unsigned int EGLBoolean;
|
typedef unsigned int EGLBoolean;
|
||||||
@@ -162,7 +165,6 @@ typedef struct _GLFWcontextEGL
|
|||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
|
|
||||||
void* client;
|
void* client;
|
||||||
|
|
||||||
} _GLFWcontextEGL;
|
} _GLFWcontextEGL;
|
||||||
|
|
||||||
// EGL-specific global data
|
// EGL-specific global data
|
||||||
@@ -178,6 +180,7 @@ typedef struct _GLFWlibraryEGL
|
|||||||
GLFWbool KHR_gl_colorspace;
|
GLFWbool KHR_gl_colorspace;
|
||||||
GLFWbool KHR_get_all_proc_addresses;
|
GLFWbool KHR_get_all_proc_addresses;
|
||||||
GLFWbool KHR_context_flush_control;
|
GLFWbool KHR_context_flush_control;
|
||||||
|
GLFWbool EXT_present_opaque;
|
||||||
|
|
||||||
void* handle;
|
void* handle;
|
||||||
|
|
||||||
@@ -197,7 +200,6 @@ typedef struct _GLFWlibraryEGL
|
|||||||
PFN_eglSwapInterval SwapInterval;
|
PFN_eglSwapInterval SwapInterval;
|
||||||
PFN_eglQueryString QueryString;
|
PFN_eglQueryString QueryString;
|
||||||
PFN_eglGetProcAddress GetProcAddress;
|
PFN_eglGetProcAddress GetProcAddress;
|
||||||
|
|
||||||
} _GLFWlibraryEGL;
|
} _GLFWlibraryEGL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,6 @@
|
|||||||
// Define this to 1 to force use of high-performance GPU on hybrid systems
|
// Define this to 1 to force use of high-performance GPU on hybrid systems
|
||||||
#cmakedefine _GLFW_USE_HYBRID_HPG
|
#cmakedefine _GLFW_USE_HYBRID_HPG
|
||||||
|
|
||||||
// Define this to 1 if xkbcommon supports the compose key
|
|
||||||
#cmakedefine HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
// Define this to 1 if the libc supports memfd_create()
|
// Define this to 1 if the libc supports memfd_create()
|
||||||
#cmakedefine HAVE_MEMFD_CREATE
|
#cmakedefine HAVE_MEMFD_CREATE
|
||||||
|
|
||||||
|
|||||||
+13
-10
@@ -92,6 +92,9 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (desired->transparent)
|
if (desired->transparent)
|
||||||
{
|
{
|
||||||
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
||||||
@@ -119,8 +122,6 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
|||||||
|
|
||||||
if (getGLXFBConfigAttrib(n, GLX_STEREO))
|
if (getGLXFBConfigAttrib(n, GLX_STEREO))
|
||||||
u->stereo = GLFW_TRUE;
|
u->stereo = GLFW_TRUE;
|
||||||
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER))
|
|
||||||
u->doublebuffer = GLFW_TRUE;
|
|
||||||
|
|
||||||
if (_glfw.glx.ARB_multisample)
|
if (_glfw.glx.ARB_multisample)
|
||||||
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
|
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
|
||||||
@@ -259,6 +260,8 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
_GLFW_GLX_LIBRARY,
|
_GLFW_GLX_LIBRARY,
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libGL-1.so",
|
"libGL-1.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGL.so",
|
||||||
#else
|
#else
|
||||||
"libGL.so.1",
|
"libGL.so.1",
|
||||||
"libGL.so",
|
"libGL.so",
|
||||||
@@ -306,10 +309,6 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
_glfw_dlsym(_glfw.glx.handle, "glXCreateWindow");
|
_glfw_dlsym(_glfw.glx.handle, "glXCreateWindow");
|
||||||
_glfw.glx.DestroyWindow =
|
_glfw.glx.DestroyWindow =
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow");
|
_glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow");
|
||||||
_glfw.glx.GetProcAddress =
|
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress");
|
|
||||||
_glfw.glx.GetProcAddressARB =
|
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
|
|
||||||
_glfw.glx.GetVisualFromFBConfig =
|
_glfw.glx.GetVisualFromFBConfig =
|
||||||
_glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
|
_glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
|
||||||
|
|
||||||
@@ -325,8 +324,6 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
!_glfw.glx.CreateNewContext ||
|
!_glfw.glx.CreateNewContext ||
|
||||||
!_glfw.glx.CreateWindow ||
|
!_glfw.glx.CreateWindow ||
|
||||||
!_glfw.glx.DestroyWindow ||
|
!_glfw.glx.DestroyWindow ||
|
||||||
!_glfw.glx.GetProcAddress ||
|
|
||||||
!_glfw.glx.GetProcAddressARB ||
|
|
||||||
!_glfw.glx.GetVisualFromFBConfig)
|
!_glfw.glx.GetVisualFromFBConfig)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
@@ -334,6 +331,12 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Unlike GLX 1.3 entry points these are not required to be present
|
||||||
|
_glfw.glx.GetProcAddress = (PFNGLXGETPROCADDRESSPROC)
|
||||||
|
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress");
|
||||||
|
_glfw.glx.GetProcAddressARB = (PFNGLXGETPROCADDRESSPROC)
|
||||||
|
_glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
|
||||||
|
|
||||||
if (!glXQueryExtension(_glfw.x11.display,
|
if (!glXQueryExtension(_glfw.x11.display,
|
||||||
&_glfw.glx.errorBase,
|
&_glfw.glx.errorBase,
|
||||||
&_glfw.glx.eventBase))
|
&_glfw.glx.eventBase))
|
||||||
@@ -673,7 +676,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -687,7 +690,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ typedef struct _GLFWcontextGLX
|
|||||||
{
|
{
|
||||||
GLXContext handle;
|
GLXContext handle;
|
||||||
GLXWindow window;
|
GLXWindow window;
|
||||||
|
|
||||||
} _GLFWcontextGLX;
|
} _GLFWcontextGLX;
|
||||||
|
|
||||||
// GLX-specific global data
|
// GLX-specific global data
|
||||||
@@ -165,7 +164,6 @@ 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);
|
||||||
|
|||||||
+37
-20
@@ -28,7 +28,6 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "mappings.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -37,16 +36,15 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
// The global variables below comprise all mutable global data in GLFW
|
// NOTE: The global variables below comprise all mutable global data in GLFW
|
||||||
//
|
// Any other mutable global variable is a bug
|
||||||
// Any other global variable is a bug
|
|
||||||
|
|
||||||
// Global state shared between compilation units of GLFW
|
// This contains all mutable state shared between compilation units of GLFW
|
||||||
//
|
//
|
||||||
_GLFWlibrary _glfw = { GLFW_FALSE };
|
_GLFWlibrary _glfw = { GLFW_FALSE };
|
||||||
|
|
||||||
// These are outside of _glfw so they can be used before initialization and
|
// These are outside of _glfw so they can be used before initialization and
|
||||||
// after termination
|
// after termination without special handling when _glfw is cleared to zero
|
||||||
//
|
//
|
||||||
static _GLFWerror _glfwMainThreadError;
|
static _GLFWerror _glfwMainThreadError;
|
||||||
static GLFWerrorfun _glfwErrorCallback;
|
static GLFWerrorfun _glfwErrorCallback;
|
||||||
@@ -113,6 +111,37 @@ static void terminate(void)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Encode a Unicode code point to a UTF-8 stream
|
||||||
|
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
||||||
|
//
|
||||||
|
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint)
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
|
||||||
|
if (codepoint < 0x80)
|
||||||
|
s[count++] = (char) codepoint;
|
||||||
|
else if (codepoint < 0x800)
|
||||||
|
{
|
||||||
|
s[count++] = (codepoint >> 6) | 0xc0;
|
||||||
|
s[count++] = (codepoint & 0x3f) | 0x80;
|
||||||
|
}
|
||||||
|
else if (codepoint < 0x10000)
|
||||||
|
{
|
||||||
|
s[count++] = (codepoint >> 12) | 0xe0;
|
||||||
|
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
|
||||||
|
s[count++] = (codepoint & 0x3f) | 0x80;
|
||||||
|
}
|
||||||
|
else if (codepoint < 0x110000)
|
||||||
|
{
|
||||||
|
s[count++] = (codepoint >> 18) | 0xf0;
|
||||||
|
s[count++] = ((codepoint >> 12) & 0x3f) | 0x80;
|
||||||
|
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
|
||||||
|
s[count++] = (codepoint & 0x3f) | 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
char* _glfw_strdup(const char* source)
|
char* _glfw_strdup(const char* source)
|
||||||
{
|
{
|
||||||
const size_t length = strlen(source);
|
const size_t length = strlen(source);
|
||||||
@@ -245,24 +274,12 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
-15
@@ -28,6 +28,7 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "mappings.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
@@ -85,25 +86,13 @@ 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;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +278,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
|||||||
// Notifies shared code of a Unicode codepoint input event
|
// Notifies shared code of a Unicode codepoint input event
|
||||||
// The 'plain' parameter determines whether to emit a regular character event
|
// The 'plain' parameter determines whether to emit a regular character event
|
||||||
//
|
//
|
||||||
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain)
|
void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain)
|
||||||
{
|
{
|
||||||
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
||||||
return;
|
return;
|
||||||
@@ -408,6 +397,29 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Adds the built-in set of gamepad mappings
|
||||||
|
//
|
||||||
|
void _glfwInitGamepadMappings(void)
|
||||||
|
{
|
||||||
|
int jid;
|
||||||
|
size_t i;
|
||||||
|
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
|
||||||
|
_glfw.mappings = calloc(count, sizeof(_GLFWmapping));
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
|
||||||
|
_glfw.mappingCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
|
if (js->present)
|
||||||
|
js->mapping = findValidMapping(js);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Returns an available joystick object with arrays and name allocated
|
// Returns an available joystick object with arrays and name allocated
|
||||||
//
|
//
|
||||||
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||||
@@ -430,7 +442,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
|
|
||||||
js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
js->present = GLFW_TRUE;
|
js->present = GLFW_TRUE;
|
||||||
js->name = _glfw_strdup(name);
|
|
||||||
js->axes = calloc(axisCount, sizeof(float));
|
js->axes = calloc(axisCount, sizeof(float));
|
||||||
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
||||||
js->hats = calloc(hatCount, 1);
|
js->hats = calloc(hatCount, 1);
|
||||||
@@ -438,6 +449,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
js->buttonCount = buttonCount;
|
js->buttonCount = buttonCount;
|
||||||
js->hatCount = hatCount;
|
js->hatCount = hatCount;
|
||||||
|
|
||||||
|
strncpy(js->name, name, sizeof(js->name) - 1);
|
||||||
strncpy(js->guid, guid, sizeof(js->guid) - 1);
|
strncpy(js->guid, guid, sizeof(js->guid) - 1);
|
||||||
js->mapping = findValidMapping(js);
|
js->mapping = findValidMapping(js);
|
||||||
|
|
||||||
@@ -448,7 +460,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
//
|
//
|
||||||
void _glfwFreeJoystick(_GLFWjoystick* js)
|
void _glfwFreeJoystick(_GLFWjoystick* js)
|
||||||
{
|
{
|
||||||
free(js->name);
|
|
||||||
free(js->axes);
|
free(js->axes);
|
||||||
free(js->buttons);
|
free(js->buttons);
|
||||||
free(js->hats);
|
free(js->hats);
|
||||||
|
|||||||
+7
-3
@@ -375,6 +375,7 @@ 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;
|
||||||
@@ -423,7 +424,7 @@ struct _GLFWwindow
|
|||||||
//
|
//
|
||||||
struct _GLFWmonitor
|
struct _GLFWmonitor
|
||||||
{
|
{
|
||||||
char* name;
|
char name[128];
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
|
|
||||||
// Physical dimensions in millimeters.
|
// Physical dimensions in millimeters.
|
||||||
@@ -484,7 +485,7 @@ struct _GLFWjoystick
|
|||||||
int buttonCount;
|
int buttonCount;
|
||||||
unsigned char* hats;
|
unsigned char* hats;
|
||||||
int hatCount;
|
int hatCount;
|
||||||
char* name;
|
char name[128];
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
char guid[33];
|
char guid[33];
|
||||||
_GLFWmapping* mapping;
|
_GLFWmapping* mapping;
|
||||||
@@ -717,7 +718,7 @@ void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor);
|
|||||||
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,
|
||||||
unsigned int codepoint, int mods, GLFWbool plain);
|
uint32_t codepoint, int mods, GLFWbool plain);
|
||||||
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
|
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
|
||||||
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
|
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
|
||||||
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
||||||
@@ -760,6 +761,7 @@ 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,
|
||||||
@@ -772,6 +774,8 @@ GLFWbool _glfwInitVulkan(int mode);
|
|||||||
void _glfwTerminateVulkan(void);
|
void _glfwTerminateVulkan(void);
|
||||||
const char* _glfwGetVulkanResultString(VkResult result);
|
const char* _glfwGetVulkanResultString(VkResult result);
|
||||||
|
|
||||||
|
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint);
|
||||||
|
|
||||||
char* _glfw_strdup(const char* source);
|
char* _glfw_strdup(const char* source);
|
||||||
float _glfw_fminf(float a, float b);
|
float _glfw_fminf(float a, float b);
|
||||||
float _glfw_fmaxf(float a, float b);
|
float _glfw_fmaxf(float a, float b);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#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
|
||||||
//
|
//
|
||||||
|
|||||||
+821
-296
File diff suppressed because it is too large
Load Diff
+12
-3
@@ -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 GenerateMappings.cmake script.
|
// gamecontrollerdb.txt with the 'update_mappings' CMake target.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
// All gamepad mappings not labeled GLFW are copied from the
|
// All gamepad mappings not labeled GLFW are copied from the
|
||||||
@@ -60,7 +60,8 @@
|
|||||||
|
|
||||||
const char* _glfwDefaultMappings[] =
|
const char* _glfwDefaultMappings[] =
|
||||||
{
|
{
|
||||||
@GLFW_GAMEPAD_MAPPINGS@
|
#if defined(GLFW_BUILD_WIN32_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,",
|
||||||
@@ -68,6 +69,14 @@ 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,",
|
||||||
NULL
|
#endif // GLFW_BUILD_WIN32_MAPPINGS
|
||||||
|
|
||||||
|
#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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
|||||||
monitor->widthMM = widthMM;
|
monitor->widthMM = widthMM;
|
||||||
monitor->heightMM = heightMM;
|
monitor->heightMM = heightMM;
|
||||||
|
|
||||||
if (name)
|
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
||||||
monitor->name = _glfw_strdup(name);
|
|
||||||
|
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
@@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
|||||||
_glfwFreeGammaArrays(&monitor->currentRamp);
|
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||||
|
|
||||||
free(monitor->modes);
|
free(monitor->modes);
|
||||||
free(monitor->name);
|
|
||||||
free(monitor);
|
free(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -25,8 +25,10 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
// 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 deprecated.
|
||||||
// We use the newer names in code and these macros to handle compatibility
|
// We use the newer names in code and replace them with the older names if
|
||||||
|
// the base SDK does not provide the newer names.
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||||
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||||
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||||
@@ -44,7 +46,6 @@ typedef struct _GLFWcontextNSGL
|
|||||||
{
|
{
|
||||||
id pixelFormat;
|
id pixelFormat;
|
||||||
id object;
|
id object;
|
||||||
|
|
||||||
} _GLFWcontextNSGL;
|
} _GLFWcontextNSGL;
|
||||||
|
|
||||||
// NSGL-specific global data
|
// NSGL-specific global data
|
||||||
@@ -53,7 +54,6 @@ typedef struct _GLFWlibraryNSGL
|
|||||||
{
|
{
|
||||||
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
|
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
|
||||||
CFBundleRef framework;
|
CFBundleRef framework;
|
||||||
|
|
||||||
} _GLFWlibraryNSGL;
|
} _GLFWlibraryNSGL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -365,7 +365,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return nil;
|
return nil;
|
||||||
|
|||||||
+15
-1
@@ -124,6 +124,8 @@ GLFWbool _glfwInitOSMesa(void)
|
|||||||
"libOSMesa.8.dylib",
|
"libOSMesa.8.dylib",
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
"libOSMesa-8.so",
|
"libOSMesa-8.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libOSMesa.so",
|
||||||
#else
|
#else
|
||||||
"libOSMesa.so.8",
|
"libOSMesa.so.8",
|
||||||
"libOSMesa.so.6",
|
"libOSMesa.so.6",
|
||||||
@@ -302,6 +304,12 @@ 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))
|
||||||
@@ -335,6 +343,12 @@ 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))
|
||||||
@@ -361,7 +375,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ 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
|
||||||
@@ -82,7 +81,6 @@ typedef struct _GLFWlibraryOSMesa
|
|||||||
PFN_OSMesaGetColorBuffer GetColorBuffer;
|
PFN_OSMesaGetColorBuffer GetColorBuffer;
|
||||||
PFN_OSMesaGetDepthBuffer GetDepthBuffer;
|
PFN_OSMesaGetDepthBuffer GetDepthBuffer;
|
||||||
PFN_OSMesaGetProcAddress GetProcAddress;
|
PFN_OSMesaGetProcAddress GetProcAddress;
|
||||||
|
|
||||||
} _GLFWlibraryOSMesa;
|
} _GLFWlibraryOSMesa;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ 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
|
||||||
@@ -46,6 +45,5 @@ typedef struct _GLFWmutexPOSIX
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
pthread_mutex_t handle;
|
pthread_mutex_t handle;
|
||||||
|
|
||||||
} _GLFWmutexPOSIX;
|
} _GLFWmutexPOSIX;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ typedef struct _GLFWtimerPOSIX
|
|||||||
{
|
{
|
||||||
GLFWbool monotonic;
|
GLFWbool monotonic;
|
||||||
uint64_t frequency;
|
uint64_t frequency;
|
||||||
|
|
||||||
} _GLFWtimerPOSIX;
|
} _GLFWtimerPOSIX;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ GLFWbool _glfwInitVulkan(int mode)
|
|||||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
|
_glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
|
||||||
if (!_glfw.vk.handle)
|
if (!_glfw.vk.handle)
|
||||||
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
|
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.vk.handle = _glfw_dlopen("libvulkan.so");
|
||||||
#else
|
#else
|
||||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
|
_glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+7
-5
@@ -165,6 +165,9 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
|
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
|
||||||
|
continue;
|
||||||
|
|
||||||
u->redBits = findAttribValue(WGL_RED_BITS_ARB);
|
u->redBits = findAttribValue(WGL_RED_BITS_ARB);
|
||||||
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
|
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
|
||||||
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
|
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
|
||||||
@@ -182,8 +185,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (findAttribValue(WGL_STEREO_ARB))
|
if (findAttribValue(WGL_STEREO_ARB))
|
||||||
u->stereo = GLFW_TRUE;
|
u->stereo = GLFW_TRUE;
|
||||||
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB))
|
|
||||||
u->doublebuffer = GLFW_TRUE;
|
|
||||||
|
|
||||||
if (_glfw.wgl.ARB_multisample)
|
if (_glfw.wgl.ARB_multisample)
|
||||||
u->samples = findAttribValue(WGL_SAMPLES_ARB);
|
u->samples = findAttribValue(WGL_SAMPLES_ARB);
|
||||||
@@ -239,6 +240,9 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
if (pfd.iPixelType != PFD_TYPE_RGBA)
|
if (pfd.iPixelType != PFD_TYPE_RGBA)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer)
|
||||||
|
continue;
|
||||||
|
|
||||||
u->redBits = pfd.cRedBits;
|
u->redBits = pfd.cRedBits;
|
||||||
u->greenBits = pfd.cGreenBits;
|
u->greenBits = pfd.cGreenBits;
|
||||||
u->blueBits = pfd.cBlueBits;
|
u->blueBits = pfd.cBlueBits;
|
||||||
@@ -256,8 +260,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (pfd.dwFlags & PFD_STEREO)
|
if (pfd.dwFlags & PFD_STEREO)
|
||||||
u->stereo = GLFW_TRUE;
|
u->stereo = GLFW_TRUE;
|
||||||
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
|
|
||||||
u->doublebuffer = GLFW_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u->handle = pixelFormat;
|
u->handle = pixelFormat;
|
||||||
@@ -785,7 +787,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.client == GLFW_NO_API)
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ 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
|
||||||
@@ -148,7 +147,6 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-16
@@ -39,6 +39,10 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID =
|
|||||||
|
|
||||||
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
|
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
|
||||||
|
|
||||||
|
#if defined(_GLFW_BUILD_DLL)
|
||||||
|
#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
|
||||||
@@ -68,17 +72,6 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -99,6 +92,8 @@ static GLFWbool loadLibraries(void)
|
|||||||
GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow");
|
GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow");
|
||||||
_glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi)
|
_glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi)
|
||||||
GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
|
GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
|
||||||
|
_glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
|
||||||
|
GetProcAddress(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
|
||||||
|
|
||||||
_glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll");
|
_glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll");
|
||||||
if (_glfw.win32.dinput8.instance)
|
if (_glfw.win32.dinput8.instance)
|
||||||
@@ -176,9 +171,6 @@ 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);
|
||||||
|
|
||||||
@@ -494,7 +486,7 @@ void _glfwUpdateKeyNamesWin32(void)
|
|||||||
vk = vks[key - GLFW_KEY_KP_0];
|
vk = vks[key - GLFW_KEY_KP_0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vk = MapVirtualKey(scancode, MAPVK_VSC_TO_VK);
|
vk = MapVirtualKeyW(scancode, MAPVK_VSC_TO_VK);
|
||||||
|
|
||||||
length = ToUnicode(vk, scancode, state,
|
length = ToUnicode(vk, scancode, state,
|
||||||
chars, sizeof(chars) / sizeof(WCHAR),
|
chars, sizeof(chars) / sizeof(WCHAR),
|
||||||
@@ -517,7 +509,8 @@ void _glfwUpdateKeyNamesWin32(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replacement for IsWindowsVersionOrGreater as MinGW lacks versionhelpers.h
|
// Replacement for IsWindowsVersionOrGreater, as we cannot rely on the
|
||||||
|
// application having a correct embedded manifest
|
||||||
//
|
//
|
||||||
BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ void _glfwInitJoysticksWin32(void)
|
|||||||
{
|
{
|
||||||
if (_glfw.win32.dinput8.instance)
|
if (_glfw.win32.dinput8.instance)
|
||||||
{
|
{
|
||||||
if (FAILED(DirectInput8Create(GetModuleHandle(NULL),
|
if (FAILED(DirectInput8Create(GetModuleHandleW(NULL),
|
||||||
DIRECTINPUT_VERSION,
|
DIRECTINPUT_VERSION,
|
||||||
&IID_IDirectInput8W,
|
&IID_IDirectInput8W,
|
||||||
(void**) &_glfw.win32.dinput8.api,
|
(void**) &_glfw.win32.dinput8.api,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#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)
|
||||||
//
|
//
|
||||||
|
|||||||
+13
-2
@@ -318,8 +318,19 @@ void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* ysc
|
|||||||
{
|
{
|
||||||
UINT xdpi, ydpi;
|
UINT xdpi, ydpi;
|
||||||
|
|
||||||
|
if (xscale)
|
||||||
|
*xscale = 0.f;
|
||||||
|
if (yscale)
|
||||||
|
*yscale = 0.f;
|
||||||
|
|
||||||
if (IsWindows8Point1OrGreater())
|
if (IsWindows8Point1OrGreater())
|
||||||
GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi);
|
{
|
||||||
|
if (GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query monitor DPI");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const HDC dc = GetDC(NULL);
|
const HDC dc = GetDC(NULL);
|
||||||
@@ -371,7 +382,7 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
|
|||||||
int* width, int* height)
|
int* width, int* height)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
GetMonitorInfo(monitor->win32.handle, &mi);
|
GetMonitorInfoW(monitor->win32.handle, &mi);
|
||||||
|
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = mi.rcWork.left;
|
*xpos = mi.rcWork.left;
|
||||||
|
|||||||
+8
-20
@@ -39,8 +39,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
// example to allow applications to correctly declare a GL_ARB_debug_output
|
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||||
// callback) but windows.h assumes no one will define APIENTRY before it does
|
// but windows.h assumes no one will define APIENTRY before it does
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
|
|
||||||
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
||||||
@@ -162,7 +162,9 @@ typedef enum
|
|||||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
|
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
|
||||||
#endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
|
#endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
|
||||||
|
|
||||||
// HACK: Define versionhelpers.h functions manually as MinGW lacks the header
|
// Replacement for versionhelpers.h macros, as we cannot rely on the
|
||||||
|
// application having a correct embedded manifest
|
||||||
|
//
|
||||||
#define IsWindowsXPOrGreater() \
|
#define IsWindowsXPOrGreater() \
|
||||||
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \
|
||||||
LOBYTE(_WIN32_WINNT_WINXP), 0)
|
LOBYTE(_WIN32_WINNT_WINXP), 0)
|
||||||
@@ -218,10 +220,6 @@ 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*);
|
||||||
@@ -239,12 +237,14 @@ typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND);
|
|||||||
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
|
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
|
||||||
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
|
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
|
||||||
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
|
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
|
||||||
|
typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT);
|
||||||
#define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
|
#define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
|
||||||
#define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
|
#define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
|
||||||
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
|
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
|
||||||
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
|
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
|
||||||
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
|
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
|
||||||
#define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
|
#define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
|
||||||
|
#define GetSystemMetricsForDpi _glfw.win32.user32.GetSystemMetricsForDpi_
|
||||||
|
|
||||||
// dwmapi.dll function pointer typedefs
|
// dwmapi.dll function pointer typedefs
|
||||||
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
||||||
@@ -328,7 +328,6 @@ typedef struct _GLFWwindowWin32
|
|||||||
int lastCursorPosX, lastCursorPosY;
|
int lastCursorPosX, lastCursorPosY;
|
||||||
// The last recevied high surrogate when decoding pairs of UTF-16 messages
|
// The last recevied high surrogate when decoding pairs of UTF-16 messages
|
||||||
WCHAR highSurrogate;
|
WCHAR highSurrogate;
|
||||||
|
|
||||||
} _GLFWwindowWin32;
|
} _GLFWwindowWin32;
|
||||||
|
|
||||||
// Win32-specific global data
|
// Win32-specific global data
|
||||||
@@ -351,11 +350,6 @@ 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;
|
||||||
@@ -376,6 +370,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
|
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
|
||||||
PFN_GetDpiForWindow GetDpiForWindow_;
|
PFN_GetDpiForWindow GetDpiForWindow_;
|
||||||
PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
|
PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
|
||||||
|
PFN_GetSystemMetricsForDpi GetSystemMetricsForDpi_;
|
||||||
} user32;
|
} user32;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -396,7 +391,6 @@ 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
|
||||||
@@ -411,7 +405,6 @@ 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
|
||||||
@@ -419,16 +412,13 @@ 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
|
||||||
@@ -437,7 +427,6 @@ typedef struct _GLFWtlsWin32
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
DWORD index;
|
DWORD index;
|
||||||
|
|
||||||
} _GLFWtlsWin32;
|
} _GLFWtlsWin32;
|
||||||
|
|
||||||
// Win32-specific mutex data
|
// Win32-specific mutex data
|
||||||
@@ -446,7 +435,6 @@ typedef struct _GLFWmutexWin32
|
|||||||
{
|
{
|
||||||
GLFWbool allocated;
|
GLFWbool allocated;
|
||||||
CRITICAL_SECTION section;
|
CRITICAL_SECTION section;
|
||||||
|
|
||||||
} _GLFWmutexWin32;
|
} _GLFWmutexWin32;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-20
@@ -38,18 +38,7 @@
|
|||||||
//
|
//
|
||||||
void _glfwInitTimerWin32(void)
|
void _glfwInitTimerWin32(void)
|
||||||
{
|
{
|
||||||
uint64_t frequency;
|
QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -59,14 +48,9 @@ void _glfwInitTimerWin32(void)
|
|||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerValue(void)
|
uint64_t _glfwPlatformGetTimerValue(void)
|
||||||
{
|
{
|
||||||
if (_glfw.timer.win32.hasPC)
|
uint64_t value;
|
||||||
{
|
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
||||||
uint64_t value;
|
return value;
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return (uint64_t) timeGetTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerFrequency(void)
|
uint64_t _glfwPlatformGetTimerFrequency(void)
|
||||||
|
|||||||
+104
-24
@@ -435,7 +435,7 @@ static int getKeyMods(void)
|
|||||||
static void fitToMonitor(_GLFWwindow* window)
|
static void fitToMonitor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
GetMonitorInfo(window->monitor->win32.handle, &mi);
|
GetMonitorInfoW(window->monitor->win32.handle, &mi);
|
||||||
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
||||||
mi.rcMonitor.left,
|
mi.rcMonitor.left,
|
||||||
mi.rcMonitor.top,
|
mi.rcMonitor.top,
|
||||||
@@ -456,8 +456,8 @@ static void acquireMonitor(_GLFWwindow* window)
|
|||||||
// the OpenGL ICD switches to page flipping
|
// the OpenGL ICD switches to page flipping
|
||||||
if (IsWindowsXPOrGreater())
|
if (IsWindowsXPOrGreater())
|
||||||
{
|
{
|
||||||
SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
|
SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
|
||||||
SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0);
|
SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,13 +482,66 @@ static void releaseMonitor(_GLFWwindow* window)
|
|||||||
|
|
||||||
// HACK: Restore mouse trail length saved in acquireMonitor
|
// HACK: Restore mouse trail length saved in acquireMonitor
|
||||||
if (IsWindowsXPOrGreater())
|
if (IsWindowsXPOrGreater())
|
||||||
SystemParametersInfo(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
|
SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputMonitorWindow(window->monitor, NULL);
|
_glfwInputMonitorWindow(window->monitor, NULL);
|
||||||
_glfwRestoreVideoModeWin32(window->monitor);
|
_glfwRestoreVideoModeWin32(window->monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manually maximize the window, for when SW_MAXIMIZE cannot be used
|
||||||
|
//
|
||||||
|
static void maximizeWindowManually(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
DWORD style;
|
||||||
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
|
|
||||||
|
GetMonitorInfoW(MonitorFromWindow(window->win32.handle,
|
||||||
|
MONITOR_DEFAULTTONEAREST), &mi);
|
||||||
|
|
||||||
|
rect = mi.rcWork;
|
||||||
|
|
||||||
|
if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
if (rect.right - rect.left > window->maxwidth)
|
||||||
|
rect.right = rect.left + window->maxwidth;
|
||||||
|
if (rect.bottom - rect.top > window->maxheight)
|
||||||
|
rect.bottom = rect.top + window->maxheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
style = GetWindowLongW(window->win32.handle, GWL_STYLE);
|
||||||
|
style |= WS_MAXIMIZE;
|
||||||
|
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
|
||||||
|
|
||||||
|
if (window->decorated)
|
||||||
|
{
|
||||||
|
const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
||||||
|
|
||||||
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
|
{
|
||||||
|
const UINT dpi = GetDpiForWindow(window->win32.handle);
|
||||||
|
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
|
||||||
|
OffsetRect(&rect, 0, GetSystemMetricsForDpi(SM_CYCAPTION, dpi));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
||||||
|
OffsetRect(&rect, 0, GetSystemMetrics(SM_CYCAPTION));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rect.bottom > mi.rcWork.bottom)
|
||||||
|
rect.bottom = mi.rcWork.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowPos(window->win32.handle, HWND_TOP,
|
||||||
|
rect.left,
|
||||||
|
rect.top,
|
||||||
|
rect.right - rect.left,
|
||||||
|
rect.bottom - rect.top,
|
||||||
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
// Window callback function (handles window messages)
|
// Window callback function (handles window messages)
|
||||||
//
|
//
|
||||||
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
@@ -646,7 +699,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
window->win32.highSurrogate = (WCHAR) wParam;
|
window->win32.highSurrogate = (WCHAR) wParam;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int codepoint = 0;
|
uint32_t codepoint = 0;
|
||||||
|
|
||||||
if (wParam >= 0xdc00 && wParam <= 0xdfff)
|
if (wParam >= 0xdc00 && wParam <= 0xdfff)
|
||||||
{
|
{
|
||||||
@@ -677,7 +730,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE);
|
_glfwInputChar(window, (uint32_t) wParam, getKeyMods(), GLFW_TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1067,7 +1120,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
ZeroMemory(&mi, sizeof(mi));
|
ZeroMemory(&mi, sizeof(mi));
|
||||||
mi.cbSize = sizeof(mi);
|
mi.cbSize = sizeof(mi);
|
||||||
GetMonitorInfo(mh, &mi);
|
GetMonitorInfoW(mh, &mi);
|
||||||
|
|
||||||
mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left;
|
mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left;
|
||||||
mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top;
|
mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top;
|
||||||
@@ -1285,24 +1338,29 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||||
|
|
||||||
// Adjust window rect to account for DPI scaling of the window frame and
|
|
||||||
// (if enabled) DPI scaling of the content area
|
|
||||||
// This cannot be done until we know what monitor the window was placed on
|
|
||||||
if (!window->monitor)
|
if (!window->monitor)
|
||||||
{
|
{
|
||||||
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
||||||
WINDOWPLACEMENT wp = { sizeof(wp) };
|
WINDOWPLACEMENT wp = { sizeof(wp) };
|
||||||
|
const HMONITOR mh = MonitorFromWindow(window->win32.handle,
|
||||||
|
MONITOR_DEFAULTTONEAREST);
|
||||||
|
|
||||||
|
// Adjust window rect to account for DPI scaling of the window frame and
|
||||||
|
// (if enabled) DPI scaling of the content area
|
||||||
|
// This cannot be done until we know what monitor the window was placed on
|
||||||
|
// Only update the restored window rect as the window may be maximized
|
||||||
|
|
||||||
if (wndconfig->scaleToMonitor)
|
if (wndconfig->scaleToMonitor)
|
||||||
{
|
{
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
_glfwPlatformGetWindowContentScale(window, &xscale, &yscale);
|
_glfwGetMonitorContentScaleWin32(mh, &xscale, &yscale);
|
||||||
rect.right = (int) (rect.right * xscale);
|
|
||||||
rect.bottom = (int) (rect.bottom * yscale);
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientToScreen(window->win32.handle, (POINT*) &rect.left);
|
if (xscale > 0.f && yscale > 0.f)
|
||||||
ClientToScreen(window->win32.handle, (POINT*) &rect.right);
|
{
|
||||||
|
rect.right = (int) (rect.right * xscale);
|
||||||
|
rect.bottom = (int) (rect.bottom * yscale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
{
|
{
|
||||||
@@ -1312,11 +1370,30 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
else
|
else
|
||||||
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
||||||
|
|
||||||
// Only update the restored window rect as the window may be maximized
|
|
||||||
GetWindowPlacement(window->win32.handle, &wp);
|
GetWindowPlacement(window->win32.handle, &wp);
|
||||||
|
OffsetRect(&rect,
|
||||||
|
wp.rcNormalPosition.left - rect.left,
|
||||||
|
wp.rcNormalPosition.top - rect.top);
|
||||||
|
|
||||||
wp.rcNormalPosition = rect;
|
wp.rcNormalPosition = rect;
|
||||||
wp.showCmd = SW_HIDE;
|
wp.showCmd = SW_HIDE;
|
||||||
SetWindowPlacement(window->win32.handle, &wp);
|
SetWindowPlacement(window->win32.handle, &wp);
|
||||||
|
|
||||||
|
// Adjust rect of maximized undecorated window, because by default Windows will
|
||||||
|
// make such a window cover the whole monitor instead of its workarea
|
||||||
|
|
||||||
|
if (wndconfig->maximized && !wndconfig->decorated)
|
||||||
|
{
|
||||||
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
|
GetMonitorInfoW(mh, &mi);
|
||||||
|
|
||||||
|
SetWindowPos(window->win32.handle, HWND_TOP,
|
||||||
|
mi.rcWork.left,
|
||||||
|
mi.rcWork.top,
|
||||||
|
mi.rcWork.right - mi.rcWork.left,
|
||||||
|
mi.rcWork.bottom - mi.rcWork.top,
|
||||||
|
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DragAcceptFiles(window->win32.handle, TRUE);
|
DragAcceptFiles(window->win32.handle, TRUE);
|
||||||
@@ -1487,8 +1564,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||||||
smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
|
smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
|
SendMessageW(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
|
||||||
SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);
|
SendMessageW(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);
|
||||||
|
|
||||||
if (window->win32.bigIcon)
|
if (window->win32.bigIcon)
|
||||||
DestroyIcon(window->win32.bigIcon);
|
DestroyIcon(window->win32.bigIcon);
|
||||||
@@ -1668,7 +1745,10 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
ShowWindow(window->win32.handle, SW_MAXIMIZE);
|
if (IsWindowVisible(window->win32.handle))
|
||||||
|
ShowWindow(window->win32.handle, SW_MAXIMIZE);
|
||||||
|
else
|
||||||
|
maximizeWindowManually(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
@@ -1755,7 +1835,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
|
|
||||||
acquireMonitor(window);
|
acquireMonitor(window);
|
||||||
|
|
||||||
GetMonitorInfo(window->monitor->win32.handle, &mi);
|
GetMonitorInfoW(window->monitor->win32.handle, &mi);
|
||||||
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
||||||
mi.rcMonitor.left,
|
mi.rcMonitor.left,
|
||||||
mi.rcMonitor.top,
|
mi.rcMonitor.top,
|
||||||
@@ -2019,7 +2099,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||||||
|
|
||||||
void _glfwPlatformPostEmptyEvent(void)
|
void _glfwPlatformPostEmptyEvent(void)
|
||||||
{
|
{
|
||||||
PostMessage(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0);
|
PostMessageW(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||||
@@ -2067,7 +2147,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");
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2263,7 +2343,7 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
|
|||||||
|
|
||||||
memset(&sci, 0, sizeof(sci));
|
memset(&sci, 0, sizeof(sci));
|
||||||
sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||||
sci.hinstance = GetModuleHandle(NULL);
|
sci.hinstance = GetModuleHandleW(NULL);
|
||||||
sci.hwnd = window->win32.handle;
|
sci.hwnd = window->win32.handle;
|
||||||
|
|
||||||
err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface);
|
err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface);
|
||||||
|
|||||||
@@ -205,6 +205,8 @@ 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;
|
||||||
|
|||||||
+67
-77
@@ -26,6 +26,8 @@
|
|||||||
// 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
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@@ -102,6 +104,7 @@ 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;
|
||||||
@@ -161,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.serial,
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
|
||||||
surface,
|
surface,
|
||||||
image->hotspot_x / scale,
|
image->hotspot_x / scale,
|
||||||
image->hotspot_y / scale);
|
image->hotspot_y / scale);
|
||||||
@@ -190,12 +193,12 @@ static void pointerHandleMotion(void* data,
|
|||||||
return;
|
return;
|
||||||
x = wl_fixed_to_double(sx);
|
x = wl_fixed_to_double(sx);
|
||||||
y = wl_fixed_to_double(sy);
|
y = wl_fixed_to_double(sy);
|
||||||
|
window->wl.cursorPosX = x;
|
||||||
|
window->wl.cursorPosY = y;
|
||||||
|
|
||||||
switch (window->wl.decorations.focus)
|
switch (window->wl.decorations.focus)
|
||||||
{
|
{
|
||||||
case mainWindow:
|
case mainWindow:
|
||||||
window->wl.cursorPosX = x;
|
|
||||||
window->wl.cursorPosY = y;
|
|
||||||
_glfwInputCursorPos(window, x, y);
|
_glfwInputCursorPos(window, x, y);
|
||||||
_glfw.wl.cursorPreviousName = NULL;
|
_glfw.wl.cursorPreviousName = NULL;
|
||||||
return;
|
return;
|
||||||
@@ -295,6 +298,7 @@ static void pointerHandleButton(void* data,
|
|||||||
else
|
else
|
||||||
wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat,
|
wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat,
|
||||||
serial, edges);
|
serial, edges);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (button == BTN_RIGHT)
|
else if (button == BTN_RIGHT)
|
||||||
@@ -370,12 +374,8 @@ static void keyboardHandleKeymap(void* data,
|
|||||||
{
|
{
|
||||||
struct xkb_keymap* keymap;
|
struct xkb_keymap* keymap;
|
||||||
struct xkb_state* state;
|
struct xkb_state* state;
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
struct xkb_compose_table* composeTable;
|
struct xkb_compose_table* composeTable;
|
||||||
struct xkb_compose_state* composeState;
|
struct xkb_compose_state* composeState;
|
||||||
#endif
|
|
||||||
|
|
||||||
char* mapStr;
|
char* mapStr;
|
||||||
const char* locale;
|
const char* locale;
|
||||||
|
|
||||||
@@ -423,7 +423,6 @@ static void keyboardHandleKeymap(void* data,
|
|||||||
if (!locale)
|
if (!locale)
|
||||||
locale = "C";
|
locale = "C";
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
composeTable =
|
composeTable =
|
||||||
xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale,
|
xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale,
|
||||||
XKB_COMPOSE_COMPILE_NO_FLAGS);
|
XKB_COMPOSE_COMPILE_NO_FLAGS);
|
||||||
@@ -443,7 +442,6 @@ static void keyboardHandleKeymap(void* data,
|
|||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Wayland: Failed to create XKB compose table");
|
"Wayland: Failed to create XKB compose table");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
xkb_keymap_unref(_glfw.wl.xkb.keymap);
|
xkb_keymap_unref(_glfw.wl.xkb.keymap);
|
||||||
xkb_state_unref(_glfw.wl.xkb.state);
|
xkb_state_unref(_glfw.wl.xkb.state);
|
||||||
@@ -497,20 +495,22 @@ static void keyboardHandleLeave(void* data,
|
|||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
struct itimerspec timer = {};
|
||||||
|
timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL);
|
||||||
|
|
||||||
_glfw.wl.serial = serial;
|
_glfw.wl.serial = serial;
|
||||||
_glfw.wl.keyboardFocus = NULL;
|
_glfw.wl.keyboardFocus = NULL;
|
||||||
_glfwInputWindowFocus(window, GLFW_FALSE);
|
_glfwInputWindowFocus(window, GLFW_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int toGLFWKeyCode(uint32_t key)
|
static int translateKey(uint32_t scancode)
|
||||||
{
|
{
|
||||||
if (key < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
|
if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
|
||||||
return _glfw.wl.keycodes[key];
|
return _glfw.wl.keycodes[scancode];
|
||||||
|
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
static xkb_keysym_t composeSymbol(xkb_keysym_t sym)
|
static xkb_keysym_t composeSymbol(xkb_keysym_t sym)
|
||||||
{
|
{
|
||||||
if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState)
|
if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState)
|
||||||
@@ -530,77 +530,65 @@ static xkb_keysym_t composeSymbol(xkb_keysym_t sym)
|
|||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static GLFWbool inputChar(_GLFWwindow* window, uint32_t key)
|
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode)
|
||||||
{
|
{
|
||||||
uint32_t code, numSyms;
|
const xkb_keysym_t* keysyms;
|
||||||
long cp;
|
const xkb_keycode_t keycode = scancode + 8;
|
||||||
const xkb_keysym_t *syms;
|
|
||||||
xkb_keysym_t sym;
|
|
||||||
|
|
||||||
code = key + 8;
|
if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1)
|
||||||
numSyms = xkb_state_key_get_syms(_glfw.wl.xkb.state, code, &syms);
|
|
||||||
|
|
||||||
if (numSyms == 1)
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
const xkb_keysym_t keysym = composeSymbol(keysyms[0]);
|
||||||
sym = composeSymbol(syms[0]);
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
|
||||||
#else
|
if (codepoint != GLFW_INVALID_CODEPOINT)
|
||||||
sym = syms[0];
|
|
||||||
#endif
|
|
||||||
cp = _glfwKeySym2Unicode(sym);
|
|
||||||
if (cp != -1)
|
|
||||||
{
|
{
|
||||||
const int mods = _glfw.wl.xkb.modifiers;
|
const int mods = _glfw.wl.xkb.modifiers;
|
||||||
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
|
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
|
||||||
_glfwInputChar(window, cp, mods, plain);
|
_glfwInputChar(window, codepoint, mods, plain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, syms[0]);
|
return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyboardHandleKey(void* data,
|
static void keyboardHandleKey(void* data,
|
||||||
struct wl_keyboard* keyboard,
|
struct wl_keyboard* keyboard,
|
||||||
uint32_t serial,
|
uint32_t serial,
|
||||||
uint32_t time,
|
uint32_t time,
|
||||||
uint32_t key,
|
uint32_t scancode,
|
||||||
uint32_t state)
|
uint32_t state)
|
||||||
{
|
{
|
||||||
int keyCode;
|
|
||||||
int action;
|
|
||||||
_GLFWwindow* window = _glfw.wl.keyboardFocus;
|
_GLFWwindow* window = _glfw.wl.keyboardFocus;
|
||||||
GLFWbool shouldRepeat;
|
|
||||||
struct itimerspec timer = {};
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
keyCode = toGLFWKeyCode(key);
|
const int key = translateKey(scancode);
|
||||||
action = state == WL_KEYBOARD_KEY_STATE_PRESSED
|
const int action =
|
||||||
? GLFW_PRESS : GLFW_RELEASE;
|
state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE;
|
||||||
|
|
||||||
_glfw.wl.serial = serial;
|
_glfw.wl.serial = serial;
|
||||||
_glfwInputKey(window, keyCode, key, action,
|
_glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers);
|
||||||
_glfw.wl.xkb.modifiers);
|
|
||||||
|
struct itimerspec timer = {};
|
||||||
|
|
||||||
if (action == GLFW_PRESS)
|
if (action == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
shouldRepeat = inputChar(window, key);
|
const GLFWbool shouldRepeat = _glfwInputTextWayland(window, scancode);
|
||||||
|
|
||||||
if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0)
|
if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0)
|
||||||
{
|
{
|
||||||
_glfw.wl.keyboardLastKey = keyCode;
|
_glfw.wl.keyboardLastKey = key;
|
||||||
_glfw.wl.keyboardLastScancode = key;
|
_glfw.wl.keyboardLastScancode = scancode;
|
||||||
if (_glfw.wl.keyboardRepeatRate > 1)
|
if (_glfw.wl.keyboardRepeatRate > 1)
|
||||||
timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate;
|
timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate;
|
||||||
else
|
else
|
||||||
timer.it_interval.tv_sec = 1;
|
timer.it_interval.tv_sec = 1;
|
||||||
|
|
||||||
timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000;
|
timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000;
|
||||||
timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000;
|
timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL);
|
timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,9 +600,6 @@ static void keyboardHandleModifiers(void* data,
|
|||||||
uint32_t modsLocked,
|
uint32_t modsLocked,
|
||||||
uint32_t group)
|
uint32_t group)
|
||||||
{
|
{
|
||||||
xkb_mod_mask_t mask;
|
|
||||||
unsigned int modifiers = 0;
|
|
||||||
|
|
||||||
_glfw.wl.serial = serial;
|
_glfw.wl.serial = serial;
|
||||||
|
|
||||||
if (!_glfw.wl.xkb.keymap)
|
if (!_glfw.wl.xkb.keymap)
|
||||||
@@ -628,24 +613,29 @@ static void keyboardHandleModifiers(void* data,
|
|||||||
0,
|
0,
|
||||||
group);
|
group);
|
||||||
|
|
||||||
mask = xkb_state_serialize_mods(_glfw.wl.xkb.state,
|
const xkb_mod_mask_t mask =
|
||||||
XKB_STATE_MODS_DEPRESSED |
|
xkb_state_serialize_mods(_glfw.wl.xkb.state,
|
||||||
XKB_STATE_LAYOUT_DEPRESSED |
|
XKB_STATE_MODS_DEPRESSED |
|
||||||
XKB_STATE_MODS_LATCHED |
|
XKB_STATE_LAYOUT_DEPRESSED |
|
||||||
XKB_STATE_LAYOUT_LATCHED);
|
XKB_STATE_MODS_LATCHED |
|
||||||
|
XKB_STATE_LAYOUT_LATCHED);
|
||||||
|
|
||||||
|
unsigned int mods = 0;
|
||||||
|
|
||||||
if (mask & _glfw.wl.xkb.controlMask)
|
if (mask & _glfw.wl.xkb.controlMask)
|
||||||
modifiers |= GLFW_MOD_CONTROL;
|
mods |= GLFW_MOD_CONTROL;
|
||||||
if (mask & _glfw.wl.xkb.altMask)
|
if (mask & _glfw.wl.xkb.altMask)
|
||||||
modifiers |= GLFW_MOD_ALT;
|
mods |= GLFW_MOD_ALT;
|
||||||
if (mask & _glfw.wl.xkb.shiftMask)
|
if (mask & _glfw.wl.xkb.shiftMask)
|
||||||
modifiers |= GLFW_MOD_SHIFT;
|
mods |= GLFW_MOD_SHIFT;
|
||||||
if (mask & _glfw.wl.xkb.superMask)
|
if (mask & _glfw.wl.xkb.superMask)
|
||||||
modifiers |= GLFW_MOD_SUPER;
|
mods |= GLFW_MOD_SUPER;
|
||||||
if (mask & _glfw.wl.xkb.capsLockMask)
|
if (mask & _glfw.wl.xkb.capsLockMask)
|
||||||
modifiers |= GLFW_MOD_CAPS_LOCK;
|
mods |= GLFW_MOD_CAPS_LOCK;
|
||||||
if (mask & _glfw.wl.xkb.numLockMask)
|
if (mask & _glfw.wl.xkb.numLockMask)
|
||||||
modifiers |= GLFW_MOD_NUM_LOCK;
|
mods |= GLFW_MOD_NUM_LOCK;
|
||||||
_glfw.wl.xkb.modifiers = modifiers;
|
|
||||||
|
_glfw.wl.xkb.modifiers = mods;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
||||||
@@ -970,7 +960,7 @@ static void createKeyTables(void)
|
|||||||
_glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
|
_glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
|
||||||
_glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
|
_glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
|
||||||
_glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
|
_glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
|
||||||
_glfw.wl.keycodes[KEY_MENU] = GLFW_KEY_MENU;
|
_glfw.wl.keycodes[KEY_COMPOSE] = GLFW_KEY_MENU;
|
||||||
_glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
|
_glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
|
||||||
_glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
|
_glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
|
||||||
_glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
|
_glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
|
||||||
@@ -1013,7 +1003,7 @@ static void createKeyTables(void)
|
|||||||
_glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23;
|
_glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23;
|
||||||
_glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24;
|
_glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24;
|
||||||
_glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
|
_glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
|
||||||
_glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY;
|
_glfw.wl.keycodes[KEY_KPASTERISK] = GLFW_KEY_KP_MULTIPLY;
|
||||||
_glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
|
_glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
|
||||||
_glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
|
_glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
|
||||||
_glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
|
_glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
|
||||||
@@ -1026,9 +1016,10 @@ static void createKeyTables(void)
|
|||||||
_glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
|
_glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
|
||||||
_glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
|
_glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
|
||||||
_glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
|
_glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
|
||||||
_glfw.wl.keycodes[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL;
|
_glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_DECIMAL;
|
||||||
_glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
|
_glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
|
||||||
_glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
|
_glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
|
||||||
|
_glfw.wl.keycodes[KEY_102ND] = GLFW_KEY_WORLD_2;
|
||||||
|
|
||||||
for (scancode = 0; scancode < 256; scancode++)
|
for (scancode = 0; scancode < 256; scancode++)
|
||||||
{
|
{
|
||||||
@@ -1102,6 +1093,8 @@ int _glfwPlatformInit(void)
|
|||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index");
|
||||||
_glfw.wl.xkb.keymap_key_repeats = (PFN_xkb_keymap_key_repeats)
|
_glfw.wl.xkb.keymap_key_repeats = (PFN_xkb_keymap_key_repeats)
|
||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats");
|
||||||
|
_glfw.wl.xkb.keymap_key_get_syms_by_level = (PFN_xkb_keymap_key_get_syms_by_level)
|
||||||
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_get_syms_by_level");
|
||||||
_glfw.wl.xkb.state_new = (PFN_xkb_state_new)
|
_glfw.wl.xkb.state_new = (PFN_xkb_state_new)
|
||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_new");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_new");
|
||||||
_glfw.wl.xkb.state_unref = (PFN_xkb_state_unref)
|
_glfw.wl.xkb.state_unref = (PFN_xkb_state_unref)
|
||||||
@@ -1112,8 +1105,9 @@ 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.state_key_get_layout = (PFN_xkb_state_key_get_layout)
|
||||||
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_layout");
|
||||||
|
|
||||||
#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)
|
||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale");
|
||||||
_glfw.wl.xkb.compose_table_unref = (PFN_xkb_compose_table_unref)
|
_glfw.wl.xkb.compose_table_unref = (PFN_xkb_compose_table_unref)
|
||||||
@@ -1128,7 +1122,6 @@ int _glfwPlatformInit(void)
|
|||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
|
||||||
_glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
|
_glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
|
||||||
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
|
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
|
||||||
#endif
|
|
||||||
|
|
||||||
_glfw.wl.display = wl_display_connect(NULL);
|
_glfw.wl.display = wl_display_connect(NULL);
|
||||||
if (!_glfw.wl.display)
|
if (!_glfw.wl.display)
|
||||||
@@ -1166,7 +1159,7 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
_glfw.wl.timerfd = -1;
|
_glfw.wl.timerfd = -1;
|
||||||
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 | TFD_NONBLOCK);
|
||||||
|
|
||||||
if (_glfw.wl.pointer && _glfw.wl.shm)
|
if (_glfw.wl.pointer && _glfw.wl.shm)
|
||||||
{
|
{
|
||||||
@@ -1193,7 +1186,7 @@ int _glfwPlatformInit(void)
|
|||||||
wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm);
|
wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm);
|
||||||
_glfw.wl.cursorSurface =
|
_glfw.wl.cursorSurface =
|
||||||
wl_compositor_create_surface(_glfw.wl.compositor);
|
wl_compositor_create_surface(_glfw.wl.compositor);
|
||||||
_glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
|
_glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)
|
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)
|
||||||
@@ -1202,14 +1195,15 @@ int _glfwPlatformInit(void)
|
|||||||
wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager,
|
wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager,
|
||||||
_glfw.wl.seat);
|
_glfw.wl.seat);
|
||||||
wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL);
|
wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL);
|
||||||
_glfw.wl.clipboardString = malloc(4096);
|
|
||||||
|
_glfw.wl.clipboardSize = 4096;
|
||||||
|
_glfw.wl.clipboardString = calloc(_glfw.wl.clipboardSize, 1);
|
||||||
if (!_glfw.wl.clipboardString)
|
if (!_glfw.wl.clipboardString)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_OUT_OF_MEMORY,
|
||||||
"Wayland: Unable to allocate clipboard memory");
|
"Wayland: Unable to allocate clipboard memory");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
_glfw.wl.clipboardSize = 4096;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@@ -1227,10 +1221,8 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfw.wl.egl.handle = NULL;
|
_glfw.wl.egl.handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
if (_glfw.wl.xkb.composeState)
|
if (_glfw.wl.xkb.composeState)
|
||||||
xkb_compose_state_unref(_glfw.wl.xkb.composeState);
|
xkb_compose_state_unref(_glfw.wl.xkb.composeState);
|
||||||
#endif
|
|
||||||
if (_glfw.wl.xkb.keymap)
|
if (_glfw.wl.xkb.keymap)
|
||||||
xkb_keymap_unref(_glfw.wl.xkb.keymap);
|
xkb_keymap_unref(_glfw.wl.xkb.keymap);
|
||||||
if (_glfw.wl.xkb.state)
|
if (_glfw.wl.xkb.state)
|
||||||
@@ -1302,10 +1294,8 @@ void _glfwPlatformTerminate(void)
|
|||||||
if (_glfw.wl.cursorTimerfd >= 0)
|
if (_glfw.wl.cursorTimerfd >= 0)
|
||||||
close(_glfw.wl.cursorTimerfd);
|
close(_glfw.wl.cursorTimerfd);
|
||||||
|
|
||||||
if (_glfw.wl.clipboardString)
|
free(_glfw.wl.clipboardString);
|
||||||
free(_glfw.wl.clipboardString);
|
free(_glfw.wl.clipboardSendString);
|
||||||
if (_glfw.wl.clipboardSendString)
|
|
||||||
free(_glfw.wl.clipboardSendString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
|
|||||||
+2
-4
@@ -47,15 +47,13 @@ static void outputHandleGeometry(void* data,
|
|||||||
int32_t transform)
|
int32_t transform)
|
||||||
{
|
{
|
||||||
struct _GLFWmonitor *monitor = data;
|
struct _GLFWmonitor *monitor = data;
|
||||||
char name[1024];
|
|
||||||
|
|
||||||
monitor->wl.x = x;
|
monitor->wl.x = x;
|
||||||
monitor->wl.y = y;
|
monitor->wl.y = y;
|
||||||
monitor->widthMM = physicalWidth;
|
monitor->widthMM = physicalWidth;
|
||||||
monitor->heightMM = physicalHeight;
|
monitor->heightMM = physicalHeight;
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "%s %s", make, model);
|
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
||||||
monitor->name = _glfw_strdup(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputHandleMode(void* data,
|
static void outputHandleMode(void* data,
|
||||||
@@ -133,7 +131,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The actual name of this output will be set in the geometry handler.
|
// The actual name of this output will be set in the geometry handler.
|
||||||
monitor = _glfwAllocMonitor(NULL, 0, 0);
|
monitor = _glfwAllocMonitor("", 0, 0);
|
||||||
|
|
||||||
output = wl_registry_bind(_glfw.wl.registry,
|
output = wl_registry_bind(_glfw.wl.registry,
|
||||||
name,
|
name,
|
||||||
|
|||||||
+9
-14
@@ -26,9 +26,7 @@
|
|||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
#endif
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
||||||
@@ -112,24 +110,27 @@ typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context
|
|||||||
typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*);
|
typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*);
|
||||||
typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*);
|
typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*);
|
||||||
typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t);
|
typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t);
|
||||||
|
typedef int (* PFN_xkb_keymap_key_get_syms_by_level)(struct xkb_keymap*,xkb_keycode_t,xkb_layout_index_t,xkb_level_index_t,const xkb_keysym_t**);
|
||||||
typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*);
|
typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*);
|
||||||
typedef void (* PFN_xkb_state_unref)(struct xkb_state*);
|
typedef void (* PFN_xkb_state_unref)(struct xkb_state*);
|
||||||
typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**);
|
typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**);
|
||||||
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
||||||
typedef xkb_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 xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t);
|
||||||
#define xkb_context_new _glfw.wl.xkb.context_new
|
#define xkb_context_new _glfw.wl.xkb.context_new
|
||||||
#define xkb_context_unref _glfw.wl.xkb.context_unref
|
#define xkb_context_unref _glfw.wl.xkb.context_unref
|
||||||
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
|
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
|
||||||
#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref
|
#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref
|
||||||
#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index
|
#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index
|
||||||
#define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats
|
#define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats
|
||||||
|
#define xkb_keymap_key_get_syms_by_level _glfw.wl.xkb.keymap_key_get_syms_by_level
|
||||||
#define xkb_state_new _glfw.wl.xkb.state_new
|
#define xkb_state_new _glfw.wl.xkb.state_new
|
||||||
#define xkb_state_unref _glfw.wl.xkb.state_unref
|
#define xkb_state_unref _glfw.wl.xkb.state_unref
|
||||||
#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms
|
#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms
|
||||||
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
|
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
|
||||||
#define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods
|
#define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods
|
||||||
|
#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
|
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
|
||||||
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
|
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
|
||||||
typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags);
|
typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags);
|
||||||
@@ -144,7 +145,6 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
|
|||||||
#define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed
|
#define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed
|
||||||
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
||||||
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _GLFW_DECORATION_WIDTH 4
|
#define _GLFW_DECORATION_WIDTH 4
|
||||||
#define _GLFW_DECORATION_TOP 24
|
#define _GLFW_DECORATION_TOP 24
|
||||||
@@ -158,7 +158,6 @@ typedef enum _GLFWdecorationSideWayland
|
|||||||
leftDecoration,
|
leftDecoration,
|
||||||
rightDecoration,
|
rightDecoration,
|
||||||
bottomDecoration,
|
bottomDecoration,
|
||||||
|
|
||||||
} _GLFWdecorationSideWayland;
|
} _GLFWdecorationSideWayland;
|
||||||
|
|
||||||
typedef struct _GLFWdecorationWayland
|
typedef struct _GLFWdecorationWayland
|
||||||
@@ -166,7 +165,6 @@ 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
|
||||||
@@ -216,7 +214,6 @@ 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
|
||||||
@@ -252,6 +249,7 @@ 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;
|
||||||
@@ -264,16 +262,14 @@ typedef struct _GLFWlibraryWayland
|
|||||||
int timerfd;
|
int timerfd;
|
||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
|
char keynames[GLFW_KEY_LAST + 1][5];
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
void* handle;
|
void* handle;
|
||||||
struct xkb_context* context;
|
struct xkb_context* context;
|
||||||
struct xkb_keymap* keymap;
|
struct xkb_keymap* keymap;
|
||||||
struct xkb_state* state;
|
struct xkb_state* state;
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
struct xkb_compose_state* composeState;
|
struct xkb_compose_state* composeState;
|
||||||
#endif
|
|
||||||
|
|
||||||
xkb_mod_mask_t controlMask;
|
xkb_mod_mask_t controlMask;
|
||||||
xkb_mod_mask_t altMask;
|
xkb_mod_mask_t altMask;
|
||||||
@@ -289,13 +285,14 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_xkb_keymap_unref keymap_unref;
|
PFN_xkb_keymap_unref keymap_unref;
|
||||||
PFN_xkb_keymap_mod_get_index keymap_mod_get_index;
|
PFN_xkb_keymap_mod_get_index keymap_mod_get_index;
|
||||||
PFN_xkb_keymap_key_repeats keymap_key_repeats;
|
PFN_xkb_keymap_key_repeats keymap_key_repeats;
|
||||||
|
PFN_xkb_keymap_key_get_syms_by_level keymap_key_get_syms_by_level;
|
||||||
PFN_xkb_state_new state_new;
|
PFN_xkb_state_new state_new;
|
||||||
PFN_xkb_state_unref state_unref;
|
PFN_xkb_state_unref state_unref;
|
||||||
PFN_xkb_state_key_get_syms state_key_get_syms;
|
PFN_xkb_state_key_get_syms state_key_get_syms;
|
||||||
PFN_xkb_state_update_mask state_update_mask;
|
PFN_xkb_state_update_mask state_update_mask;
|
||||||
PFN_xkb_state_serialize_mods state_serialize_mods;
|
PFN_xkb_state_serialize_mods state_serialize_mods;
|
||||||
|
PFN_xkb_state_key_get_layout state_key_get_layout;
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON_COMPOSE_H
|
|
||||||
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
|
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
|
||||||
PFN_xkb_compose_table_unref compose_table_unref;
|
PFN_xkb_compose_table_unref compose_table_unref;
|
||||||
PFN_xkb_compose_state_new compose_state_new;
|
PFN_xkb_compose_state_new compose_state_new;
|
||||||
@@ -303,7 +300,6 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_xkb_compose_state_feed compose_state_feed;
|
PFN_xkb_compose_state_feed compose_state_feed;
|
||||||
PFN_xkb_compose_state_get_status compose_state_get_status;
|
PFN_xkb_compose_state_get_status compose_state_get_status;
|
||||||
PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym;
|
PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym;
|
||||||
#endif
|
|
||||||
} xkb;
|
} xkb;
|
||||||
|
|
||||||
_GLFWwindow* pointerFocus;
|
_GLFWwindow* pointerFocus;
|
||||||
@@ -325,7 +321,6 @@ 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
|
||||||
@@ -339,7 +334,6 @@ 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
|
||||||
@@ -356,4 +350,5 @@ typedef struct _GLFWcursorWayland
|
|||||||
|
|
||||||
|
|
||||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
||||||
|
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode);
|
||||||
|
|
||||||
|
|||||||
+239
-142
@@ -39,7 +39,8 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
static void shellSurfaceHandlePing(void* data,
|
static void shellSurfaceHandlePing(void* data,
|
||||||
struct wl_shell_surface* shellSurface,
|
struct wl_shell_surface* shellSurface,
|
||||||
@@ -248,6 +249,53 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for data to arrive on any of the specified file descriptors
|
||||||
|
//
|
||||||
|
static GLFWbool waitForData(struct pollfd* fds, nfds_t count, double* timeout)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (timeout)
|
||||||
|
{
|
||||||
|
const uint64_t base = _glfwPlatformGetTimerValue();
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
|
||||||
|
const time_t seconds = (time_t) *timeout;
|
||||||
|
const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
|
||||||
|
const struct timespec ts = { seconds, nanoseconds };
|
||||||
|
const int result = ppoll(fds, count, &ts, NULL);
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
const time_t seconds = (time_t) *timeout;
|
||||||
|
const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
|
||||||
|
const struct timespec ts = { seconds, nanoseconds };
|
||||||
|
const int result = pollts(fds, count, &ts, NULL);
|
||||||
|
#else
|
||||||
|
const int milliseconds = (int) (*timeout * 1e3);
|
||||||
|
const int result = poll(fds, count, milliseconds);
|
||||||
|
#endif
|
||||||
|
const int error = errno; // clock_gettime may overwrite our error
|
||||||
|
|
||||||
|
*timeout -= (_glfwPlatformGetTimerValue() - base) /
|
||||||
|
(double) _glfwPlatformGetTimerFrequency();
|
||||||
|
|
||||||
|
if (result > 0)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
else if (result == -1 && error != EINTR && error != EAGAIN)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
else if (*timeout <= 0.0)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const int result = poll(fds, count, -1);
|
||||||
|
if (result > 0)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
else if (result == -1 && errno != EINTR && errno != EAGAIN)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void createDecoration(_GLFWdecorationWayland* decoration,
|
static void createDecoration(_GLFWdecorationWayland* decoration,
|
||||||
struct wl_surface* parent,
|
struct wl_surface* parent,
|
||||||
struct wl_buffer* buffer, GLFWbool opaque,
|
struct wl_buffer* buffer, GLFWbool opaque,
|
||||||
@@ -404,27 +452,25 @@ static void resizeWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
static void checkScaleChange(_GLFWwindow* window)
|
static void checkScaleChange(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
int scale = 1;
|
|
||||||
int i;
|
|
||||||
int monitorScale;
|
|
||||||
|
|
||||||
// Check if we will be able to set the buffer scale or not.
|
// Check if we will be able to set the buffer scale or not.
|
||||||
if (_glfw.wl.compositorVersion < 3)
|
if (_glfw.wl.compositorVersion < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the scale factor from the highest scale monitor.
|
// Get the scale factor from the highest scale monitor.
|
||||||
for (i = 0; i < window->wl.monitorsCount; ++i)
|
int maxScale = 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < window->wl.monitorsCount; i++)
|
||||||
{
|
{
|
||||||
monitorScale = window->wl.monitors[i]->wl.scale;
|
const int scale = window->wl.monitors[i]->wl.scale;
|
||||||
if (scale < monitorScale)
|
if (maxScale < scale)
|
||||||
scale = monitorScale;
|
maxScale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only change the framebuffer size if the scale changed.
|
// Only change the framebuffer size if the scale changed.
|
||||||
if (scale != window->wl.scale)
|
if (window->wl.scale != maxScale)
|
||||||
{
|
{
|
||||||
window->wl.scale = scale;
|
window->wl.scale = maxScale;
|
||||||
wl_surface_set_buffer_scale(window->wl.surface, scale);
|
wl_surface_set_buffer_scale(window->wl.surface, maxScale);
|
||||||
resizeWindow(window);
|
resizeWindow(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -493,35 +539,6 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLFWbool createSurface(_GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig)
|
|
||||||
{
|
|
||||||
window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);
|
|
||||||
if (!window->wl.surface)
|
|
||||||
return GLFW_FALSE;
|
|
||||||
|
|
||||||
wl_surface_add_listener(window->wl.surface,
|
|
||||||
&surfaceListener,
|
|
||||||
window);
|
|
||||||
|
|
||||||
wl_surface_set_user_data(window->wl.surface, window);
|
|
||||||
|
|
||||||
window->wl.native = wl_egl_window_create(window->wl.surface,
|
|
||||||
wndconfig->width,
|
|
||||||
wndconfig->height);
|
|
||||||
if (!window->wl.native)
|
|
||||||
return GLFW_FALSE;
|
|
||||||
|
|
||||||
window->wl.width = wndconfig->width;
|
|
||||||
window->wl.height = wndconfig->height;
|
|
||||||
window->wl.scale = 1;
|
|
||||||
|
|
||||||
if (!window->wl.transparent)
|
|
||||||
setOpaqueRegion(window);
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor,
|
static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor,
|
||||||
int refreshRate)
|
int refreshRate)
|
||||||
{
|
{
|
||||||
@@ -653,7 +670,6 @@ static void xdgToplevelHandleConfigure(void* data,
|
|||||||
}
|
}
|
||||||
if (fullscreen && activated)
|
if (fullscreen && activated)
|
||||||
window->wl.wasFullscreen = GLFW_TRUE;
|
window->wl.wasFullscreen = GLFW_TRUE;
|
||||||
_glfwInputWindowFocus(window, activated);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdgToplevelHandleClose(void* data,
|
static void xdgToplevelHandleClose(void* data,
|
||||||
@@ -761,6 +777,46 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
|||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GLFWbool createSurface(_GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
{
|
||||||
|
window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);
|
||||||
|
if (!window->wl.surface)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
wl_surface_add_listener(window->wl.surface,
|
||||||
|
&surfaceListener,
|
||||||
|
window);
|
||||||
|
|
||||||
|
wl_surface_set_user_data(window->wl.surface, window);
|
||||||
|
|
||||||
|
window->wl.native = wl_egl_window_create(window->wl.surface,
|
||||||
|
wndconfig->width,
|
||||||
|
wndconfig->height);
|
||||||
|
if (!window->wl.native)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
window->wl.width = wndconfig->width;
|
||||||
|
window->wl.height = wndconfig->height;
|
||||||
|
window->wl.scale = 1;
|
||||||
|
window->wl.title = _glfw_strdup(wndconfig->title);
|
||||||
|
|
||||||
|
window->wl.transparent = fbconfig->transparent;
|
||||||
|
if (!window->wl.transparent)
|
||||||
|
setOpaqueRegion(window);
|
||||||
|
|
||||||
|
if (window->monitor || wndconfig->visible)
|
||||||
|
{
|
||||||
|
if (!createXdgSurface(window))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
window->wl.visible = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void setCursorImage(_GLFWwindow* window,
|
static void setCursorImage(_GLFWwindow* window,
|
||||||
_GLFWcursorWayland* cursorWayland)
|
_GLFWcursorWayland* cursorWayland)
|
||||||
{
|
{
|
||||||
@@ -796,7 +852,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.serial,
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
|
||||||
surface,
|
surface,
|
||||||
cursorWayland->xhot / scale,
|
cursorWayland->xhot / scale,
|
||||||
cursorWayland->yhot / scale);
|
cursorWayland->yhot / scale);
|
||||||
@@ -823,79 +879,103 @@ static void incrementCursorImage(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleEvents(int timeout)
|
static GLFWbool flushDisplay(void)
|
||||||
{
|
{
|
||||||
struct wl_display* display = _glfw.wl.display;
|
while (wl_display_flush(_glfw.wl.display) == -1)
|
||||||
struct pollfd fds[] = {
|
{
|
||||||
{ wl_display_get_fd(display), POLLIN },
|
if (errno != EAGAIN)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
struct pollfd fd = { wl_display_get_fd(_glfw.wl.display), POLLOUT };
|
||||||
|
|
||||||
|
while (poll(&fd, 1, -1) == -1)
|
||||||
|
{
|
||||||
|
if (errno != EINTR && errno != EAGAIN)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleEvents(double* timeout)
|
||||||
|
{
|
||||||
|
GLFWbool event = GLFW_FALSE;
|
||||||
|
struct pollfd fds[] =
|
||||||
|
{
|
||||||
|
{ wl_display_get_fd(_glfw.wl.display), POLLIN },
|
||||||
{ _glfw.wl.timerfd, POLLIN },
|
{ _glfw.wl.timerfd, POLLIN },
|
||||||
{ _glfw.wl.cursorTimerfd, POLLIN },
|
{ _glfw.wl.cursorTimerfd, POLLIN },
|
||||||
};
|
};
|
||||||
ssize_t read_ret;
|
|
||||||
uint64_t repeats, i;
|
|
||||||
|
|
||||||
while (wl_display_prepare_read(display) != 0)
|
while (!event)
|
||||||
wl_display_dispatch_pending(display);
|
|
||||||
|
|
||||||
// If an error different from EAGAIN happens, we have likely been
|
|
||||||
// disconnected from the Wayland session, try to handle that the best we
|
|
||||||
// can.
|
|
||||||
if (wl_display_flush(display) < 0 && errno != EAGAIN)
|
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfw.windowListHead;
|
while (wl_display_prepare_read(_glfw.wl.display) != 0)
|
||||||
while (window)
|
wl_display_dispatch_pending(_glfw.wl.display);
|
||||||
|
|
||||||
|
// If an error other than EAGAIN happens, we have likely been disconnected
|
||||||
|
// from the Wayland session; try to handle that the best we can.
|
||||||
|
if (!flushDisplay())
|
||||||
{
|
{
|
||||||
_glfwInputWindowCloseRequest(window);
|
wl_display_cancel_read(_glfw.wl.display);
|
||||||
window = window->next;
|
|
||||||
}
|
_GLFWwindow* window = _glfw.windowListHead;
|
||||||
wl_display_cancel_read(display);
|
while (window)
|
||||||
return;
|
{
|
||||||
}
|
_glfwInputWindowCloseRequest(window);
|
||||||
|
window = window->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!waitForData(fds, 3, timeout))
|
||||||
|
{
|
||||||
|
wl_display_cancel_read(_glfw.wl.display);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (poll(fds, 3, timeout) > 0)
|
|
||||||
{
|
|
||||||
if (fds[0].revents & POLLIN)
|
if (fds[0].revents & POLLIN)
|
||||||
{
|
{
|
||||||
wl_display_read_events(display);
|
wl_display_read_events(_glfw.wl.display);
|
||||||
wl_display_dispatch_pending(display);
|
if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
|
||||||
|
event = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
wl_display_cancel_read(_glfw.wl.display);
|
||||||
wl_display_cancel_read(display);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fds[1].revents & POLLIN)
|
if (fds[1].revents & POLLIN)
|
||||||
{
|
{
|
||||||
read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats));
|
uint64_t repeats;
|
||||||
if (read_ret != 8)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_glfw.wl.keyboardFocus)
|
if (read(_glfw.wl.timerfd, &repeats, sizeof(repeats)) == 8)
|
||||||
{
|
{
|
||||||
for (i = 0; i < repeats; ++i)
|
for (uint64_t i = 0; i < repeats; i++)
|
||||||
{
|
{
|
||||||
_glfwInputKey(_glfw.wl.keyboardFocus,
|
_glfwInputKey(_glfw.wl.keyboardFocus,
|
||||||
_glfw.wl.keyboardLastKey,
|
_glfw.wl.keyboardLastKey,
|
||||||
_glfw.wl.keyboardLastScancode,
|
_glfw.wl.keyboardLastScancode,
|
||||||
GLFW_REPEAT,
|
GLFW_PRESS,
|
||||||
_glfw.wl.xkb.modifiers);
|
_glfw.wl.xkb.modifiers);
|
||||||
|
_glfwInputTextWayland(_glfw.wl.keyboardFocus,
|
||||||
|
_glfw.wl.keyboardLastScancode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fds[2].revents & POLLIN)
|
if (fds[2].revents & POLLIN)
|
||||||
{
|
{
|
||||||
read_ret = read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats));
|
uint64_t repeats;
|
||||||
if (read_ret != 8)
|
|
||||||
return;
|
|
||||||
|
|
||||||
incrementCursorImage(_glfw.wl.pointerFocus);
|
if (read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)) == 8)
|
||||||
|
{
|
||||||
|
incrementCursorImage(_glfw.wl.pointerFocus);
|
||||||
|
event = GLFW_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
wl_display_cancel_read(display);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translates a GLFW standard cursor to a theme cursor name
|
// Translates a GLFW standard cursor to a theme cursor name
|
||||||
@@ -929,9 +1009,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
const _GLFWctxconfig* ctxconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
window->wl.transparent = fbconfig->transparent;
|
if (!createSurface(window, wndconfig, fbconfig))
|
||||||
|
|
||||||
if (!createSurface(window, wndconfig))
|
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (ctxconfig->client != GLFW_NO_API)
|
if (ctxconfig->client != GLFW_NO_API)
|
||||||
@@ -953,38 +1031,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndconfig->title)
|
|
||||||
window->wl.title = _glfw_strdup(wndconfig->title);
|
|
||||||
|
|
||||||
if (wndconfig->visible)
|
|
||||||
{
|
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
|
||||||
if (!createXdgSurface(window))
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!createShellSurface(window))
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window->wl.xdg.surface = NULL;
|
|
||||||
window->wl.xdg.toplevel = NULL;
|
|
||||||
window->wl.shellSurface = NULL;
|
|
||||||
window->wl.visible = GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->wl.currentCursor = NULL;
|
|
||||||
|
|
||||||
window->wl.monitors = calloc(1, sizeof(_GLFWmonitor*));
|
|
||||||
window->wl.monitorsCount = 0;
|
|
||||||
window->wl.monitorsSize = 1;
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,29 +1248,29 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (!window->wl.visible)
|
if (!window->wl.visible)
|
||||||
{
|
{
|
||||||
|
// NOTE: The XDG/shell surface is created here so command-line applications
|
||||||
|
// with off-screen windows do not appear in for example the Unity dock
|
||||||
if (_glfw.wl.wmBase)
|
if (_glfw.wl.wmBase)
|
||||||
createXdgSurface(window);
|
{
|
||||||
|
if (!window->wl.xdg.toplevel)
|
||||||
|
createXdgSurface(window);
|
||||||
|
}
|
||||||
else if (!window->wl.shellSurface)
|
else if (!window->wl.shellSurface)
|
||||||
createShellSurface(window);
|
createShellSurface(window);
|
||||||
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
window->wl.visible = GLFW_TRUE;
|
||||||
|
_glfwInputWindowDamage(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.visible)
|
||||||
{
|
{
|
||||||
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
window->wl.visible = GLFW_FALSE;
|
||||||
xdg_surface_destroy(window->wl.xdg.surface);
|
wl_surface_attach(window->wl.surface, NULL, 0, 0);
|
||||||
window->wl.xdg.toplevel = NULL;
|
wl_surface_commit(window->wl.surface);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
||||||
@@ -1341,22 +1387,24 @@ GLFWbool _glfwPlatformRawMouseMotionSupported(void)
|
|||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
handleEvents(0);
|
double timeout = 0.0;
|
||||||
|
handleEvents(&timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformWaitEvents(void)
|
void _glfwPlatformWaitEvents(void)
|
||||||
{
|
{
|
||||||
handleEvents(-1);
|
handleEvents(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformWaitEventsTimeout(double timeout)
|
void _glfwPlatformWaitEventsTimeout(double timeout)
|
||||||
{
|
{
|
||||||
handleEvents((int) (timeout * 1e3));
|
handleEvents(&timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformPostEmptyEvent(void)
|
void _glfwPlatformPostEmptyEvent(void)
|
||||||
{
|
{
|
||||||
wl_display_sync(_glfw.wl.display);
|
wl_display_sync(_glfw.wl.display);
|
||||||
|
flushDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||||
@@ -1387,8 +1435,57 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetScancodeName(int scancode)
|
const char* _glfwPlatformGetScancodeName(int scancode)
|
||||||
{
|
{
|
||||||
// TODO
|
if (scancode < 0 || scancode > 255 ||
|
||||||
return NULL;
|
_glfw.wl.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Wayland: Invalid scancode %i",
|
||||||
|
scancode);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int key = _glfw.wl.keycodes[scancode];
|
||||||
|
const xkb_keycode_t keycode = scancode + 8;
|
||||||
|
const xkb_layout_index_t layout =
|
||||||
|
xkb_state_key_get_layout(_glfw.wl.xkb.state, keycode);
|
||||||
|
if (layout == XKB_LAYOUT_INVALID)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to retrieve layout for key name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const xkb_keysym_t* keysyms = NULL;
|
||||||
|
xkb_keymap_key_get_syms_by_level(_glfw.wl.xkb.keymap,
|
||||||
|
keycode,
|
||||||
|
layout,
|
||||||
|
0,
|
||||||
|
&keysyms);
|
||||||
|
if (keysyms == NULL)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to retrieve keysym for key name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysyms[0]);
|
||||||
|
if (codepoint == GLFW_INVALID_CODEPOINT)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to retrieve codepoint for key name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t count = _glfwEncodeUTF8(_glfw.wl.keynames[key], codepoint);
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to encode codepoint for key name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.wl.keynames[key][count] = '\0';
|
||||||
|
return _glfw.wl.keynames[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
@@ -1547,7 +1644,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.serial,
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
|
||||||
NULL, 0, 0);
|
NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1611,7 +1708,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.serial, NULL, 0, 0);
|
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1744,7 +1841,7 @@ static GLFWbool growClipboardString(void)
|
|||||||
clipboard = realloc(clipboard, _glfw.wl.clipboardSize * 2);
|
clipboard = realloc(clipboard, _glfw.wl.clipboardSize * 2);
|
||||||
if (!clipboard)
|
if (!clipboard)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_OUT_OF_MEMORY,
|
||||||
"Wayland: Impossible to grow clipboard string");
|
"Wayland: Impossible to grow clipboard string");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
@@ -1779,9 +1876,9 @@ const char* _glfwPlatformGetClipboardString(void)
|
|||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
|
||||||
// XXX: this is a huge hack, this function shouldn’t be synchronous!
|
// XXX: this is a huge hack, this function shouldn’t be synchronous!
|
||||||
handleEvents(-1);
|
handleEvents(NULL);
|
||||||
|
|
||||||
while (1)
|
for (;;)
|
||||||
{
|
{
|
||||||
// Grow the clipboard if we need to paste something bigger, there is no
|
// Grow the clipboard if we need to paste something bigger, there is no
|
||||||
// shrink operation yet.
|
// shrink operation yet.
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.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
|
||||||
@@ -568,7 +571,11 @@ static void detectEWMH(void)
|
|||||||
//
|
//
|
||||||
static GLFWbool initExtensions(void)
|
static GLFWbool initExtensions(void)
|
||||||
{
|
{
|
||||||
|
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so");
|
||||||
|
#else
|
||||||
_glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1");
|
_glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1");
|
||||||
|
#endif
|
||||||
if (_glfw.x11.vidmode.handle)
|
if (_glfw.x11.vidmode.handle)
|
||||||
{
|
{
|
||||||
_glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension)
|
_glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension)
|
||||||
@@ -588,6 +595,8 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so");
|
_glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so");
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.xi.handle = _glfw_dlopen("libXi.so");
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6");
|
_glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6");
|
||||||
#endif
|
#endif
|
||||||
@@ -618,6 +627,8 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so");
|
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so");
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so");
|
||||||
#else
|
#else
|
||||||
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2");
|
_glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2");
|
||||||
#endif
|
#endif
|
||||||
@@ -710,6 +721,8 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so");
|
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so");
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so");
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1");
|
_glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -725,6 +738,8 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so");
|
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so");
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so");
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1");
|
_glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -776,6 +791,8 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");
|
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so");
|
||||||
#else
|
#else
|
||||||
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1");
|
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -787,6 +804,8 @@ static GLFWbool initExtensions(void)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so");
|
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so");
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so");
|
||||||
#else
|
#else
|
||||||
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1");
|
_glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1");
|
||||||
#endif
|
#endif
|
||||||
@@ -952,6 +971,37 @@ static Window createHelperWindow(void)
|
|||||||
CWEventMask, &wa);
|
CWEventMask, &wa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the pipe for empty events without assumuing the OS has pipe2(2)
|
||||||
|
//
|
||||||
|
static GLFWbool createEmptyEventPipe(void)
|
||||||
|
{
|
||||||
|
if (pipe(_glfw.x11.emptyEventPipe) != 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: Failed to create empty event pipe: %s",
|
||||||
|
strerror(errno));
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
const int sf = fcntl(_glfw.x11.emptyEventPipe[i], F_GETFL, 0);
|
||||||
|
const int df = fcntl(_glfw.x11.emptyEventPipe[i], F_GETFD, 0);
|
||||||
|
|
||||||
|
if (sf == -1 || df == -1 ||
|
||||||
|
fcntl(_glfw.x11.emptyEventPipe[i], F_SETFL, sf | O_NONBLOCK) == -1 ||
|
||||||
|
fcntl(_glfw.x11.emptyEventPipe[i], F_SETFD, df | FD_CLOEXEC) == -1)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: Failed to set flags for empty event pipe: %s",
|
||||||
|
strerror(errno));
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// X error handler
|
// X error handler
|
||||||
//
|
//
|
||||||
static int errorHandler(Display *display, XErrorEvent* event)
|
static int errorHandler(Display *display, XErrorEvent* event)
|
||||||
@@ -1073,6 +1123,9 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY);
|
getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY);
|
||||||
|
|
||||||
|
if (!createEmptyEventPipe())
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (!initExtensions())
|
if (!initExtensions())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
@@ -1190,6 +1243,12 @@ void _glfwPlatformTerminate(void)
|
|||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
_glfwTerminateJoysticksLinux();
|
_glfwTerminateJoysticksLinux();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (_glfw.x11.emptyEventPipe[0] || _glfw.x11.emptyEventPipe[1])
|
||||||
|
{
|
||||||
|
close(_glfw.x11.emptyEventPipe[0]);
|
||||||
|
close(_glfw.x11.emptyEventPipe[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
|
|||||||
+1
-4
@@ -202,7 +202,6 @@ typedef struct _GLFWwindowX11
|
|||||||
// The time of the last KeyPress event per keycode, for discarding
|
// The time of the last KeyPress event per keycode, for discarding
|
||||||
// duplicate key events generated for some keys by ibus
|
// duplicate key events generated for some keys by ibus
|
||||||
Time keyPressTimes[256];
|
Time keyPressTimes[256];
|
||||||
|
|
||||||
} _GLFWwindowX11;
|
} _GLFWwindowX11;
|
||||||
|
|
||||||
// X11-specific global data
|
// X11-specific global data
|
||||||
@@ -239,6 +238,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
// The window whose disabled cursor mode is active
|
// The window whose disabled cursor mode is active
|
||||||
_GLFWwindow* disabledCursorWindow;
|
_GLFWwindow* disabledCursorWindow;
|
||||||
|
int emptyEventPipe[2];
|
||||||
|
|
||||||
// Window manager atoms
|
// Window manager atoms
|
||||||
Atom NET_SUPPORTED;
|
Atom NET_SUPPORTED;
|
||||||
@@ -405,7 +405,6 @@ 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
|
||||||
@@ -419,7 +418,6 @@ 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
|
||||||
@@ -427,7 +425,6 @@ typedef struct _GLFWmonitorX11
|
|||||||
typedef struct _GLFWcursorX11
|
typedef struct _GLFWcursorX11
|
||||||
{
|
{
|
||||||
Cursor handle;
|
Cursor handle;
|
||||||
|
|
||||||
} _GLFWcursorX11;
|
} _GLFWcursorX11;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+165
-119
@@ -27,12 +27,16 @@
|
|||||||
// 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 _GNU_SOURCE
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
#include <X11/Xmd.h>
|
#include <X11/Xmd.h>
|
||||||
|
|
||||||
#include <sys/select.h>
|
#include <poll.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -56,50 +60,126 @@
|
|||||||
|
|
||||||
#define _GLFW_XDND_VERSION 5
|
#define _GLFW_XDND_VERSION 5
|
||||||
|
|
||||||
|
// Wait for data to arrive on any of the specified file descriptors
|
||||||
// Wait for data to arrive using select
|
|
||||||
// This avoids blocking other threads via the per-display Xlib lock that also
|
|
||||||
// covers GLX functions
|
|
||||||
//
|
//
|
||||||
static GLFWbool waitForEvent(double* timeout)
|
static GLFWbool waitForData(struct pollfd* fds, nfds_t count, double* timeout)
|
||||||
{
|
{
|
||||||
fd_set fds;
|
|
||||||
const int fd = ConnectionNumber(_glfw.x11.display);
|
|
||||||
int count = fd + 1;
|
|
||||||
|
|
||||||
#if defined(__linux__)
|
|
||||||
if (_glfw.linjs.inotify > fd)
|
|
||||||
count = _glfw.linjs.inotify + 1;
|
|
||||||
#endif
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
FD_ZERO(&fds);
|
|
||||||
FD_SET(fd, &fds);
|
|
||||||
#if defined(__linux__)
|
|
||||||
if (_glfw.linjs.inotify > 0)
|
|
||||||
FD_SET(_glfw.linjs.inotify, &fds);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (timeout)
|
if (timeout)
|
||||||
{
|
{
|
||||||
const long seconds = (long) *timeout;
|
|
||||||
const long microseconds = (long) ((*timeout - seconds) * 1e6);
|
|
||||||
struct timeval tv = { seconds, microseconds };
|
|
||||||
const uint64_t base = _glfwPlatformGetTimerValue();
|
const uint64_t base = _glfwPlatformGetTimerValue();
|
||||||
|
|
||||||
const int result = select(count, &fds, NULL, NULL, &tv);
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
|
||||||
const int error = errno;
|
const time_t seconds = (time_t) *timeout;
|
||||||
|
const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
|
||||||
|
const struct timespec ts = { seconds, nanoseconds };
|
||||||
|
const int result = ppoll(fds, count, &ts, NULL);
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
const time_t seconds = (time_t) *timeout;
|
||||||
|
const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
|
||||||
|
const struct timespec ts = { seconds, nanoseconds };
|
||||||
|
const int result = pollts(fds, count, &ts, NULL);
|
||||||
|
#else
|
||||||
|
const int milliseconds = (int) (*timeout * 1e3);
|
||||||
|
const int result = poll(fds, count, milliseconds);
|
||||||
|
#endif
|
||||||
|
const int error = errno; // clock_gettime may overwrite our error
|
||||||
|
|
||||||
*timeout -= (_glfwPlatformGetTimerValue() - base) /
|
*timeout -= (_glfwPlatformGetTimerValue() - base) /
|
||||||
(double) _glfwPlatformGetTimerFrequency();
|
(double) _glfwPlatformGetTimerFrequency();
|
||||||
|
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
if ((result == -1 && error == EINTR) || *timeout <= 0.0)
|
else if (result == -1 && error != EINTR && error != EAGAIN)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
else if (*timeout <= 0.0)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
else if (select(count, &fds, NULL, NULL, NULL) != -1 || errno != EINTR)
|
else
|
||||||
return GLFW_TRUE;
|
{
|
||||||
|
const int result = poll(fds, count, -1);
|
||||||
|
if (result > 0)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
else if (result == -1 && errno != EINTR && errno != EAGAIN)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for event data to arrive on the X11 display socket
|
||||||
|
// This avoids blocking other threads via the per-display Xlib lock that also
|
||||||
|
// covers GLX functions
|
||||||
|
//
|
||||||
|
static GLFWbool waitForX11Event(double* timeout)
|
||||||
|
{
|
||||||
|
struct pollfd fd = { ConnectionNumber(_glfw.x11.display), POLLIN };
|
||||||
|
|
||||||
|
while (!XPending(_glfw.x11.display))
|
||||||
|
{
|
||||||
|
if (!waitForData(&fd, 1, timeout))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for event data to arrive on any event file descriptor
|
||||||
|
// This avoids blocking other threads via the per-display Xlib lock that also
|
||||||
|
// covers GLX functions
|
||||||
|
//
|
||||||
|
static GLFWbool waitForAnyEvent(double* timeout)
|
||||||
|
{
|
||||||
|
nfds_t count = 2;
|
||||||
|
struct pollfd fds[3] =
|
||||||
|
{
|
||||||
|
{ ConnectionNumber(_glfw.x11.display), POLLIN },
|
||||||
|
{ _glfw.x11.emptyEventPipe[0], POLLIN }
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
if (_glfw.linjs.inotify > 0)
|
||||||
|
fds[count++] = (struct pollfd) { _glfw.linjs.inotify, POLLIN };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (!XPending(_glfw.x11.display))
|
||||||
|
{
|
||||||
|
if (!waitForData(fds, count, timeout))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
if (fds[i].revents & POLLIN)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Writes a byte to the empty event pipe
|
||||||
|
//
|
||||||
|
static void writeEmptyEvent(void)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
const char byte = 0;
|
||||||
|
const int result = write(_glfw.x11.emptyEventPipe[1], &byte, 1);
|
||||||
|
if (result == 1 || (result == -1 && errno != EINTR))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drains available data from the empty event pipe
|
||||||
|
//
|
||||||
|
static void drainEmptyEvents(void)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
char dummy[64];
|
||||||
|
const int result = read(_glfw.x11.emptyEventPipe[0], dummy, sizeof(dummy));
|
||||||
|
if (result == -1 && errno != EINTR)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +196,7 @@ static GLFWbool waitForVisibilityNotify(_GLFWwindow* window)
|
|||||||
VisibilityNotify,
|
VisibilityNotify,
|
||||||
&dummy))
|
&dummy))
|
||||||
{
|
{
|
||||||
if (!waitForEvent(&timeout))
|
if (!waitForX11Event(&timeout))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,45 +509,14 @@ static char** parseUriList(char* text, int* count)
|
|||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode a Unicode code point to a UTF-8 stream
|
|
||||||
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
|
||||||
//
|
|
||||||
static size_t encodeUTF8(char* s, unsigned int ch)
|
|
||||||
{
|
|
||||||
size_t count = 0;
|
|
||||||
|
|
||||||
if (ch < 0x80)
|
|
||||||
s[count++] = (char) ch;
|
|
||||||
else if (ch < 0x800)
|
|
||||||
{
|
|
||||||
s[count++] = (ch >> 6) | 0xc0;
|
|
||||||
s[count++] = (ch & 0x3f) | 0x80;
|
|
||||||
}
|
|
||||||
else if (ch < 0x10000)
|
|
||||||
{
|
|
||||||
s[count++] = (ch >> 12) | 0xe0;
|
|
||||||
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
|
|
||||||
s[count++] = (ch & 0x3f) | 0x80;
|
|
||||||
}
|
|
||||||
else if (ch < 0x110000)
|
|
||||||
{
|
|
||||||
s[count++] = (ch >> 18) | 0xf0;
|
|
||||||
s[count++] = ((ch >> 12) & 0x3f) | 0x80;
|
|
||||||
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
|
|
||||||
s[count++] = (ch & 0x3f) | 0x80;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Decode a Unicode code point from a UTF-8 stream
|
// Decode a Unicode code point from a UTF-8 stream
|
||||||
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
||||||
//
|
//
|
||||||
#if defined(X_HAVE_UTF8_STRING)
|
#if defined(X_HAVE_UTF8_STRING)
|
||||||
static unsigned int decodeUTF8(const char** s)
|
static uint32_t decodeUTF8(const char** s)
|
||||||
{
|
{
|
||||||
unsigned int ch = 0, count = 0;
|
uint32_t codepoint = 0, count = 0;
|
||||||
static const unsigned int offsets[] =
|
static const uint32_t offsets[] =
|
||||||
{
|
{
|
||||||
0x00000000u, 0x00003080u, 0x000e2080u,
|
0x00000000u, 0x00003080u, 0x000e2080u,
|
||||||
0x03c82080u, 0xfa082080u, 0x82082080u
|
0x03c82080u, 0xfa082080u, 0x82082080u
|
||||||
@@ -475,13 +524,13 @@ static unsigned int decodeUTF8(const char** s)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ch = (ch << 6) + (unsigned char) **s;
|
codepoint = (codepoint << 6) + (unsigned char) **s;
|
||||||
(*s)++;
|
(*s)++;
|
||||||
count++;
|
count++;
|
||||||
} while ((**s & 0xc0) == 0x80);
|
} while ((**s & 0xc0) == 0x80);
|
||||||
|
|
||||||
assert(count <= 6);
|
assert(count <= 6);
|
||||||
return ch - offsets[count - 1];
|
return codepoint - offsets[count - 1];
|
||||||
}
|
}
|
||||||
#endif /*X_HAVE_UTF8_STRING*/
|
#endif /*X_HAVE_UTF8_STRING*/
|
||||||
|
|
||||||
@@ -499,7 +548,7 @@ static char* convertLatin1toUTF8(const char* source)
|
|||||||
char* tp = target;
|
char* tp = target;
|
||||||
|
|
||||||
for (sp = source; *sp; sp++)
|
for (sp = source; *sp; sp++)
|
||||||
tp += encodeUTF8(tp, *sp);
|
tp += _glfwEncodeUTF8(tp, *sp);
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
@@ -1002,7 +1051,7 @@ static const char* getSelectionString(Atom selection)
|
|||||||
SelectionNotify,
|
SelectionNotify,
|
||||||
¬ification))
|
¬ification))
|
||||||
{
|
{
|
||||||
waitForEvent(NULL);
|
waitForX11Event(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification.xselection.property == None)
|
if (notification.xselection.property == None)
|
||||||
@@ -1038,7 +1087,7 @@ static const char* getSelectionString(Atom selection)
|
|||||||
isSelPropNewValueNotify,
|
isSelPropNewValueNotify,
|
||||||
(XPointer) ¬ification))
|
(XPointer) ¬ification))
|
||||||
{
|
{
|
||||||
waitForEvent(NULL);
|
waitForX11Event(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree(data);
|
XFree(data);
|
||||||
@@ -1283,7 +1332,7 @@ static void processEvent(XEvent *event)
|
|||||||
// (the server never sends a timestamp of zero)
|
// (the server never sends a timestamp of zero)
|
||||||
// NOTE: Timestamp difference is compared to handle wrap-around
|
// NOTE: Timestamp difference is compared to handle wrap-around
|
||||||
Time diff = event->xkey.time - window->x11.keyPressTimes[keycode];
|
Time diff = event->xkey.time - window->x11.keyPressTimes[keycode];
|
||||||
if (diff == event->xkey.time || (diff > 0 && diff < (1 << 31)))
|
if (diff == event->xkey.time || (diff > 0 && diff < ((Time)1 << 31)))
|
||||||
{
|
{
|
||||||
if (keycode)
|
if (keycode)
|
||||||
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
||||||
@@ -1359,9 +1408,9 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
||||||
|
|
||||||
const long character = _glfwKeySym2Unicode(keysym);
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
|
||||||
if (character != -1)
|
if (codepoint != GLFW_INVALID_CODEPOINT)
|
||||||
_glfwInputChar(window, character, mods, plain);
|
_glfwInputChar(window, codepoint, mods, plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1969,7 +2018,7 @@ void _glfwPushSelectionToManagerX11(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForEvent(NULL);
|
waitForX11Event(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2123,8 +2172,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
longCount += 2 + images[i].width * images[i].height;
|
longCount += 2 + images[i].width * images[i].height;
|
||||||
|
|
||||||
long* icon = calloc(longCount, sizeof(long));
|
unsigned long* icon = calloc(longCount, sizeof(unsigned long));
|
||||||
long* target = icon;
|
unsigned long* target = icon;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
@@ -2133,13 +2182,19 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||||||
|
|
||||||
for (j = 0; j < images[i].width * images[i].height; j++)
|
for (j = 0; j < images[i].width * images[i].height; j++)
|
||||||
{
|
{
|
||||||
*target++ = (images[i].pixels[j * 4 + 0] << 16) |
|
*target++ = (((unsigned long) images[i].pixels[j * 4 + 0]) << 16) |
|
||||||
(images[i].pixels[j * 4 + 1] << 8) |
|
(((unsigned long) images[i].pixels[j * 4 + 1]) << 8) |
|
||||||
(images[i].pixels[j * 4 + 2] << 0) |
|
(((unsigned long) images[i].pixels[j * 4 + 2]) << 0) |
|
||||||
(images[i].pixels[j * 4 + 3] << 24);
|
(((unsigned long) images[i].pixels[j * 4 + 3]) << 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: XChangeProperty expects 32-bit values like the image data above to be
|
||||||
|
// placed in the 32 least significant bits of individual longs. This is
|
||||||
|
// true even if long is 64-bit and a WM protocol calls for "packed" data.
|
||||||
|
// This is because of a historical mistake that then became part of the Xlib
|
||||||
|
// ABI. Xlib will pack these values into a regular array of 32-bit values
|
||||||
|
// before sending it over the wire.
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.NET_WM_ICON,
|
_glfw.x11.NET_WM_ICON,
|
||||||
XA_CARDINAL, 32,
|
XA_CARDINAL, 32,
|
||||||
@@ -2281,7 +2336,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|||||||
isFrameExtentsEvent,
|
isFrameExtentsEvent,
|
||||||
(XPointer) window))
|
(XPointer) window))
|
||||||
{
|
{
|
||||||
if (!waitForEvent(&timeout))
|
if (!waitForX11Event(&timeout))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue");
|
"X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue");
|
||||||
@@ -2500,7 +2555,11 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
|
{
|
||||||
|
_glfwPlatformSetWindowDecorated(window, window->decorated);
|
||||||
|
_glfwPlatformSetWindowFloating(window, window->floating);
|
||||||
releaseMonitor(window);
|
releaseMonitor(window);
|
||||||
|
}
|
||||||
|
|
||||||
_glfwInputWindowMonitor(window, monitor);
|
_glfwInputWindowMonitor(window, monitor);
|
||||||
updateNormalHints(window, width, height);
|
updateNormalHints(window, width, height);
|
||||||
@@ -2682,14 +2741,14 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -2699,15 +2758,15 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == count)
|
if (i < count)
|
||||||
return;
|
{
|
||||||
|
states[i] = states[count - 1];
|
||||||
|
count--;
|
||||||
|
|
||||||
states[i] = states[count - 1];
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
count--;
|
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||||
|
PropModeReplace, (unsigned char*) states, count);
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
}
|
||||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
|
||||||
PropModeReplace, (unsigned char*) states, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (states)
|
if (states)
|
||||||
@@ -2769,7 +2828,7 @@ GLFWbool _glfwPlatformRawMouseMotionSupported(void)
|
|||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window;
|
drainEmptyEvents();
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
_glfwDetectJoystickConnectionLinux();
|
_glfwDetectJoystickConnectionLinux();
|
||||||
@@ -2783,7 +2842,7 @@ void _glfwPlatformPollEvents(void)
|
|||||||
processEvent(&event);
|
processEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = _glfw.x11.disabledCursorWindow;
|
_GLFWwindow* window = _glfw.x11.disabledCursorWindow;
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -2803,32 +2862,19 @@ void _glfwPlatformPollEvents(void)
|
|||||||
|
|
||||||
void _glfwPlatformWaitEvents(void)
|
void _glfwPlatformWaitEvents(void)
|
||||||
{
|
{
|
||||||
while (!XPending(_glfw.x11.display))
|
waitForAnyEvent(NULL);
|
||||||
waitForEvent(NULL);
|
|
||||||
|
|
||||||
_glfwPlatformPollEvents();
|
_glfwPlatformPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformWaitEventsTimeout(double timeout)
|
void _glfwPlatformWaitEventsTimeout(double timeout)
|
||||||
{
|
{
|
||||||
while (!XPending(_glfw.x11.display))
|
waitForAnyEvent(&timeout);
|
||||||
{
|
|
||||||
if (!waitForEvent(&timeout))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwPlatformPollEvents();
|
_glfwPlatformPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformPostEmptyEvent(void)
|
void _glfwPlatformPostEmptyEvent(void)
|
||||||
{
|
{
|
||||||
XEvent event = { ClientMessage };
|
writeEmptyEvent();
|
||||||
event.xclient.window = _glfw.x11.helperWindowHandle;
|
|
||||||
event.xclient.format = 32; // Data is 32-bit longs
|
|
||||||
event.xclient.message_type = _glfw.x11.NULL_;
|
|
||||||
|
|
||||||
XSendEvent(_glfw.x11.display, _glfw.x11.helperWindowHandle, False, 0, &event);
|
|
||||||
XFlush(_glfw.x11.display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||||
@@ -2882,7 +2928,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");
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2892,11 +2938,11 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (keysym == NoSymbol)
|
if (keysym == NoSymbol)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const long ch = _glfwKeySym2Unicode(keysym);
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
|
||||||
if (ch == -1)
|
if (codepoint == GLFW_INVALID_CODEPOINT)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const size_t count = encodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch);
|
const size_t count = _glfwEncodeUTF8(_glfw.x11.keynames[key], codepoint);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -907,7 +907,7 @@ static const struct codepair {
|
|||||||
|
|
||||||
// Convert XKB KeySym to Unicode
|
// Convert XKB KeySym to Unicode
|
||||||
//
|
//
|
||||||
long _glfwKeySym2Unicode(unsigned int keysym)
|
uint32_t _glfwKeySym2Unicode(unsigned int keysym)
|
||||||
{
|
{
|
||||||
int min = 0;
|
int min = 0;
|
||||||
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
|
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
|
||||||
@@ -937,6 +937,6 @@ long _glfwKeySym2Unicode(unsigned int keysym)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No matching Unicode value found
|
// No matching Unicode value found
|
||||||
return -1;
|
return GLFW_INVALID_CODEPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -24,5 +24,7 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
long _glfwKeySym2Unicode(unsigned int keysym);
|
#define GLFW_INVALID_CODEPOINT 0xffffffffu
|
||||||
|
|
||||||
|
uint32_t _glfwKeySym2Unicode(unsigned int keysym);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ if (MATH_LIBRARY)
|
|||||||
link_libraries("${MATH_LIBRARY}")
|
link_libraries("${MATH_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
# Workaround for the MS CRT deprecating parts of the standard library
|
||||||
|
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()
|
||||||
|
|
||||||
@@ -69,9 +70,13 @@ set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
|||||||
FOLDER "GLFW3/Tests")
|
FOLDER "GLFW3/Tests")
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
# Tell MSVC to use main instead of WinMain
|
||||||
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)
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
{
|
{
|
||||||
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
|
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
|
||||||
|
if (!ramp)
|
||||||
|
{
|
||||||
|
glfwTerminate();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
const size_t array_size = ramp->size * sizeof(short);
|
const size_t array_size = ramp->size * sizeof(short);
|
||||||
orig_ramp.size = ramp->size;
|
orig_ramp.size = ramp->size;
|
||||||
orig_ramp.red = malloc(array_size);
|
orig_ramp.red = malloc(array_size);
|
||||||
|
|||||||
+3
-3
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
static int windowed_xpos, windowed_ypos, windowed_width, windowed_height;
|
static int windowed_xpos, windowed_ypos, windowed_width = 640, windowed_height = 480;
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
@@ -180,8 +180,8 @@ static GLFWwindow* create_window(GLFWmonitor* monitor)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = 640;
|
width = windowed_width;
|
||||||
height = 480;
|
height = windowed_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(width, height, "Iconify", monitor, NULL);
|
window = glfwCreateWindow(width, height, "Iconify", monitor, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user