mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 10:34:34 +00:00
Merge branch 'master' into webgpu
This commit is contained in:
commit
6cbd003914
@ -15,10 +15,10 @@ environment:
|
||||
- GENERATOR: MinGW Makefiles
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: -Werror
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
- GENERATOR: Visual Studio 12 2013
|
||||
BUILD_SHARED_LIBS: ON
|
||||
CFLAGS: /WX
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
- GENERATOR: Visual Studio 12 2013
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: /WX
|
||||
matrix:
|
||||
@ -30,14 +30,14 @@ for:
|
||||
- GENERATOR: MinGW Makefiles
|
||||
build_script:
|
||||
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
|
||||
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake --build build
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
- GENERATOR: Visual Studio 12 2013
|
||||
build_script:
|
||||
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake --build build --target glfw
|
||||
notifications:
|
||||
- provider: Email
|
||||
|
67
.editorconfig
Normal file
67
.editorconfig
Normal file
@ -0,0 +1,67 @@
|
||||
# EditorConfig for GLFW and its internal dependencies
|
||||
#
|
||||
# All files created by GLFW should indent with four spaces unless their format requires
|
||||
# otherwise. A few files still use other indent styles for historical reasons.
|
||||
#
|
||||
# Dependencies have (what seemed to be) their existing styles described. Those with
|
||||
# existing trailing whitespace have it preserved to avoid cluttering future commits.
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
|
||||
[include/GLFW/*.h]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[{src,examples,tests}/*.{c,m,h,rc,in}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[CMakeLists.txt]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[CMake/**.{cmake,in}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{md}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[DoxygenLayout.xml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[docs/*.{scss,html}]
|
||||
indent_style = tab
|
||||
indent_size = unset
|
||||
|
||||
[deps/mingw/*.h]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 8
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[deps/getopt.{c,h}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[deps/linmath.h]
|
||||
indent_style = tab
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[deps/nuklear*.h]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[deps/tinycthread.{c,h}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -1,8 +1,6 @@
|
||||
|
||||
* @elmindreda
|
||||
|
||||
src/wl_* @linkmauve
|
||||
|
||||
docs/*.css @glfw/webdev
|
||||
docs/*.scss @glfw/webdev
|
||||
docs/*.html @glfw/webdev
|
||||
|
114
.github/workflows/build.yml
vendored
114
.github/workflows/build.yml
vendored
@ -9,86 +9,92 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-linux-x11-clang:
|
||||
name: X11 (Linux, Clang)
|
||||
build-linux-clang:
|
||||
name: Linux (Clang)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 4
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
|
||||
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libwayland-dev libxkbcommon-dev
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
- name: Configure Null shared library
|
||||
run: cmake -B build-null-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build Null shared library
|
||||
run: cmake --build build-null-shared --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
- name: Configure X11 shared library
|
||||
run: cmake -B build-x11-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=ON -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build X11 shared library
|
||||
run: cmake --build build-x11-shared --parallel
|
||||
|
||||
build-linux-full-clang:
|
||||
name: X11+Wayland (Linux, Clang)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev
|
||||
- name: Configure Wayland shared library
|
||||
run: cmake -B build-wayland-shared -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build Wayland shared library
|
||||
run: cmake --build build-wayland-shared --parallel
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static -D GLFW_BUILD_WAYLAND=ON
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
- name: Configure Wayland+X11 static library
|
||||
run: cmake -B build-full-static -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=ON
|
||||
- name: Build Wayland+X11 static library
|
||||
run: cmake --build build-full-static --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
- name: Configure Wayland+X11 shared library
|
||||
run: cmake -B build-full-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON -D GLFW_BUILD_X11=ON
|
||||
- name: Build Wayland+X11 shared library
|
||||
run: cmake --build build-full-shared --parallel
|
||||
|
||||
build-macos-cocoa-clang:
|
||||
name: Cocoa (macOS, Clang)
|
||||
build-macos-clang:
|
||||
name: macOS (Clang)
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 4
|
||||
env:
|
||||
CFLAGS: -Werror
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.8
|
||||
CMAKE_OSX_ARCHITECTURES: x86_64;arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
- name: Configure Null shared library
|
||||
run: cmake -B build-null-shared -D GLFW_BUILD_COCOA=OFF -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build Null shared library
|
||||
run: cmake --build build-null-shared --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
- name: Configure Cocoa static library
|
||||
run: cmake -B build-cocoa-static
|
||||
- name: Build Cocoa static library
|
||||
run: cmake --build build-cocoa-static --parallel
|
||||
|
||||
build-windows-win32-vs2022:
|
||||
name: Win32 (Windows, VS2022)
|
||||
- name: Configure Cocoa shared library
|
||||
run: cmake -B build-cocoa-shared -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build Cocoa shared library
|
||||
run: cmake --build build-cocoa-shared --parallel
|
||||
|
||||
build-windows-vs2022:
|
||||
name: Windows (VS2022)
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 4
|
||||
env:
|
||||
CFLAGS: /WX
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static -G "Visual Studio 17 2022"
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
- name: Configure Win32 shared x86 library
|
||||
run: cmake -B build-win32-shared-x86 -G "Visual Studio 17 2022" -A Win32 -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build Win32 shared x86 library
|
||||
run: cmake --build build-win32-shared-x86 --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -G "Visual Studio 17 2022" -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
- name: Configure Win32 static x64 library
|
||||
run: cmake -B build-win32-static-x64 -G "Visual Studio 17 2022" -A x64
|
||||
- name: Build Win32 static x64 library
|
||||
run: cmake --build build-win32-static-x64 --parallel
|
||||
|
||||
- name: Configure Win32 shared x64 library
|
||||
run: cmake -B build-win32-shared-x64 -G "Visual Studio 17 2022" -A x64 -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build Win32 shared x64 library
|
||||
run: cmake --build build-win32-shared-x64 --parallel
|
||||
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
# The canonical out-of-tree build subdirectory
|
||||
build
|
||||
build-*
|
||||
|
||||
# Visual Studio clutter
|
||||
_ReSharper*
|
||||
|
@ -8,6 +8,6 @@ Description: A multi-platform library for OpenGL, window and input
|
||||
Version: @GLFW_VERSION@
|
||||
URL: https://www.glfw.org/
|
||||
Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
|
||||
Libs: -L${libdir} -l@GLFW_LIB_NAME@
|
||||
Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
|
||||
Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
|
||||
Cflags: -I${includedir}
|
||||
|
@ -27,11 +27,15 @@ if (GLFW_USE_OSMESA)
|
||||
message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint")
|
||||
endif()
|
||||
|
||||
if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE)
|
||||
message(FATAL_ERROR
|
||||
"GLFW_USE_WAYLAND has been removed; set the GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 options")
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland"
|
||||
"${GLFW_USE_WAYLAND}" "UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF)
|
||||
|
||||
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
|
||||
"WIN32" OFF)
|
||||
@ -56,11 +60,6 @@ list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if (GLFW_BUILD_DOCS)
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Report backend selection
|
||||
#--------------------------------------------------------------------
|
||||
@ -134,7 +133,7 @@ if (GLFW_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
|
||||
if (GLFW_BUILD_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif()
|
||||
|
||||
@ -156,11 +155,6 @@ if (GLFW_INSTALL)
|
||||
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
|
||||
install(DIRECTORY "${GLFW_BINARY_DIR}/docs/html"
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||
endif()
|
||||
|
||||
# Only generate this target if no higher-level project already has
|
||||
if (NOT TARGET uninstall)
|
||||
configure_file(CMake/cmake_uninstall.cmake.in
|
||||
|
@ -33,6 +33,7 @@ video tutorials.
|
||||
- David Carlier
|
||||
- Arturo Castro
|
||||
- Chi-kwan Chan
|
||||
- Victor Chernyakin
|
||||
- TheChocolateOre
|
||||
- Ali Chraghi
|
||||
- Joseph Chua
|
||||
@ -47,6 +48,7 @@ video tutorials.
|
||||
- Bailey Cosier
|
||||
- Noel Cower
|
||||
- CuriouserThing
|
||||
- Bill Currie
|
||||
- Jason Daly
|
||||
- danhambleton
|
||||
- Jarrod Davis
|
||||
@ -66,11 +68,13 @@ video tutorials.
|
||||
- Nikita Fediuchin
|
||||
- Felipe Ferreira
|
||||
- Michael Fogleman
|
||||
- forworldm
|
||||
- Jason Francis
|
||||
- Gerald Franz
|
||||
- Mário Freitas
|
||||
- GeO4d
|
||||
- Marcus Geelnard
|
||||
- Gegy
|
||||
- ghuser404
|
||||
- Charles Giessen
|
||||
- Ryan C. Gordon
|
||||
@ -78,11 +82,14 @@ video tutorials.
|
||||
- Kovid Goyal
|
||||
- Kevin Grandemange
|
||||
- Eloi Marín Gratacós
|
||||
- Grzesiek11
|
||||
- Stefan Gustavson
|
||||
- Andrew Gutekanst
|
||||
- Stephen Gutekanst
|
||||
- Jonathan Hale
|
||||
- Daniel Hauser
|
||||
- hdf89shfdfs
|
||||
- Moritz Heinemann
|
||||
- Sylvain Hellegouarch
|
||||
- Björn Hempel
|
||||
- Matthew Henry
|
||||
@ -100,6 +107,7 @@ video tutorials.
|
||||
- JannikGM
|
||||
- Erik S. V. Jansson
|
||||
- jjYBdx4IL
|
||||
- Peter Johnson
|
||||
- Toni Jovanoski
|
||||
- Arseny Kapoulkine
|
||||
- Cem Karan
|
||||
@ -114,6 +122,7 @@ video tutorials.
|
||||
- Rokas Kupstys
|
||||
- Konstantin Käfer
|
||||
- Eric Larson
|
||||
- Guillaume Lebrun
|
||||
- Francis Lecavalier
|
||||
- Jong Won Lee
|
||||
- Robin Leffmann
|
||||
@ -122,11 +131,14 @@ video tutorials.
|
||||
- Anders Lindqvist
|
||||
- Leon Linhart
|
||||
- Marco Lizza
|
||||
- lo-v-ol
|
||||
- Eyal Lotem
|
||||
- Aaron Loucks
|
||||
- Ned Loynd
|
||||
- Luflosi
|
||||
- lukect
|
||||
- Tristam MacDonald
|
||||
- Jean-Luc Mackail
|
||||
- Hans Mackowiak
|
||||
- Ramiro Magno
|
||||
- Дмитри Малышев
|
||||
@ -141,6 +153,7 @@ video tutorials.
|
||||
- Marcel Metz
|
||||
- Liam Middlebrook
|
||||
- Ave Milia
|
||||
- Icyllis Milica
|
||||
- Jonathan Miller
|
||||
- Kenneth Miller
|
||||
- Bruce Mitchener
|
||||
@ -155,6 +168,9 @@ video tutorials.
|
||||
- Pascal Muetschard
|
||||
- James Murphy
|
||||
- Julian Møller
|
||||
- Julius Häger
|
||||
- Nat
|
||||
- NateIsStalling
|
||||
- ndogxj
|
||||
- F. Nedelec
|
||||
- n3rdopolis
|
||||
@ -182,6 +198,7 @@ video tutorials.
|
||||
- Stanislav Podgorskiy
|
||||
- Konstantin Podsvirov
|
||||
- Nathan Poirier
|
||||
- Pokechu22
|
||||
- Alexandre Pretyman
|
||||
- Pablo Prietz
|
||||
- przemekmirek
|
||||
@ -204,15 +221,20 @@ video tutorials.
|
||||
- Yoshinori Sano
|
||||
- Brandon Schaefer
|
||||
- Sebastian Schuberth
|
||||
- Scr3amer
|
||||
- Jan Schuerkamp
|
||||
- Christian Sdunek
|
||||
- Matt Sealey
|
||||
- Steve Sexton
|
||||
- Arkady Shapkin
|
||||
- Mingjie Shen
|
||||
- Ali Sherief
|
||||
- Yoshiki Shibukawa
|
||||
- Dmitri Shuralyov
|
||||
- Joao da Silva
|
||||
- Daniel Sieger
|
||||
- Daljit Singh
|
||||
- Michael Skec
|
||||
- Daniel Skorupski
|
||||
- Slemmie
|
||||
- Anthony Smith
|
||||
@ -230,6 +252,7 @@ video tutorials.
|
||||
- Paul Sultana
|
||||
- Nathan Sweet
|
||||
- TTK-Bandit
|
||||
- Nuno Teixeira
|
||||
- Jared Tiala
|
||||
- Sergey Tikhomirov
|
||||
- Arthur Tombs
|
||||
@ -243,10 +266,12 @@ video tutorials.
|
||||
- Jari Vetoniemi
|
||||
- Ricardo Vieira
|
||||
- Nicholas Vitovitch
|
||||
- Vladimír Vondruš
|
||||
- Simon Voordouw
|
||||
- Corentin Wallez
|
||||
- Torsten Walluhn
|
||||
- Patrick Walton
|
||||
- Jim Wang
|
||||
- Xo Wang
|
||||
- Andre Weissflog
|
||||
- Jay Weisskopf
|
||||
|
97
README.md
97
README.md
@ -47,18 +47,19 @@ features or fixing bugs.
|
||||
|
||||
## Compiling GLFW
|
||||
|
||||
GLFW itself requires only the headers and libraries for your OS and window
|
||||
system. It does not need the headers for any context creation API (WGL, GLX,
|
||||
EGL, NSGL, OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable
|
||||
support for them.
|
||||
GLFW is written primarily in C99, with parts of macOS support being written in
|
||||
Objective-C. GLFW itself requires only the headers and libraries for your OS
|
||||
and window system. It does not need any additional headers for context creation
|
||||
APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan)
|
||||
to enable support for them.
|
||||
|
||||
GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and
|
||||
GLFW supports compilation on Windows with Visual C++ 2013 and later, MinGW and
|
||||
MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
|
||||
and Clang. It will likely compile in other environments as well, but this is
|
||||
not regularly tested.
|
||||
|
||||
There are [pre-compiled Windows binaries](https://www.glfw.org/download.html)
|
||||
available for all supported compilers.
|
||||
There are [pre-compiled binaries](https://www.glfw.org/download.html) available
|
||||
for all supported compilers on Windows and macOS.
|
||||
|
||||
See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
|
||||
more information about how to compile GLFW yourself.
|
||||
@ -119,7 +120,7 @@ guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for
|
||||
information on what to include when reporting a bug.
|
||||
|
||||
|
||||
## Changelog
|
||||
## Changelog since 3.3.9
|
||||
|
||||
- Added `GLFW_PLATFORM` init hint for runtime platform selection (#1958)
|
||||
- Added `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
|
||||
@ -143,6 +144,7 @@ information on what to include when reporting a bug.
|
||||
content area (#58)
|
||||
- Added `GLFW_POSITION_X` and `GLFW_POSITION_Y` window hints for initial position
|
||||
(#1603,#1747)
|
||||
- Added `GLFW_SCALE_FRAMEBUFFER` window hint for Wayland and macOS scaling (#2457)
|
||||
- Added `GLFW_ANY_POSITION` hint value for letting the window manager choose (#1603,#1747)
|
||||
- Added `GLFW_PLATFORM_UNAVAILABLE` error for platform detection failures (#1958)
|
||||
- Added `GLFW_FEATURE_UNAVAILABLE` error for platform limitations (#1692)
|
||||
@ -153,22 +155,58 @@ information on what to include when reporting a bug.
|
||||
values to select ANGLE backend (#1380)
|
||||
- Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan
|
||||
surface extension (#1793)
|
||||
- Added `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu
|
||||
- Added `GLFW_WIN32_SHOWDEFAULT` window hint for applying the parent process
|
||||
show command (#2359)
|
||||
- Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
|
||||
- Added `GLFW_BUILD_WIN32` CMake option for enabling Win32 support (#1958)
|
||||
- Added `GLFW_BUILD_COCOA` CMake option for enabling Cocoa support (#1958)
|
||||
- Added `GLFW_BUILD_X11` CMake option for enabling X11 support (#1958)
|
||||
- Added `GLFW_LIBRARY_TYPE` CMake variable for overriding the library type
|
||||
(#279,#1307,#1497,#1574,#1928)
|
||||
- Added support for `XDG_SESSION_TYPE` environment variable
|
||||
- Added `GLFW_PKG_CONFIG_REQUIRES_PRIVATE` and `GLFW_PKG_CONFIG_LIBS_PRIVATE` CMake
|
||||
variables exposing pkg-config dependencies (#1307)
|
||||
- Made joystick subsystem initialize at first use (#1284,#1646)
|
||||
- Made `GLFW_DOUBLEBUFFER` a read-only window attribute
|
||||
- Updated the minimum required CMake version to 3.1
|
||||
- Updated gamepad mappings from upstream
|
||||
- Disabled tests and examples by default when built as a CMake subdirectory
|
||||
- Renamed `GLFW_USE_WAYLAND` CMake option to `GLFW_BUILD_WAYLAND` (#1958)
|
||||
- Disabled tests and examples by default when built as a CMake subdirectory
|
||||
- Removed `GLFW_USE_OSMESA` CMake option enabling the Null platform (#1958)
|
||||
- Removed CMake generated configuration header
|
||||
- [Win32] Added a version info resource to the GLFW DLL
|
||||
- [Win32] Made hidden helper window use its own window class
|
||||
- [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
|
||||
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
||||
- [Cocoa] Bugfix: Touching event queue from secondary thread before main thread
|
||||
would abort (#1649)
|
||||
- [Wayland] Added support for `glfwRequestWindowAttention` (#2287)
|
||||
- [Wayland] Added support for `glfwFocusWindow`
|
||||
- [Wayland] Added support for `GLFW_RESIZABLE` (#2203)
|
||||
- [Wayland] Added support for fractional scaling of window contents
|
||||
- [Wayland] Added dynamic loading of all Wayland libraries
|
||||
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
|
||||
- [Wayland] Bugfix: `GLFW_HOVERED` was true when the cursor was over any
|
||||
fallback window decoration
|
||||
- [Wayland] Bugfix: Fallback decorations allowed resizing to invalid size
|
||||
(#2204)
|
||||
- [X11] Bugfix: Termination would segfault if the IM had been destroyed
|
||||
- [X11] Bugfix: Any IM started after initialization would not be detected
|
||||
- [Linux] Bugfix: Joystick evdev fds remained open in forks (#2446)
|
||||
- [POSIX] Removed use of deprecated function `gettimeofday`
|
||||
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
|
||||
- [NSGL] Removed enforcement of forward-compatible flag for core contexts
|
||||
- [EGL] Added platform selection via the `EGL_EXT_platform_base` extension
|
||||
(#442)
|
||||
- [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension
|
||||
(#1380)
|
||||
|
||||
|
||||
## Changelog since 3.3
|
||||
|
||||
- Added `GLFW_WAYLAND_LIBDECOR` init hint for disabling libdecor support (#1639,#1693)
|
||||
- Bugfix: The CMake config-file package used an absolute path and was not
|
||||
relocatable (#1470)
|
||||
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
|
||||
@ -183,10 +221,8 @@ information on what to include when reporting a bug.
|
||||
- Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization
|
||||
- Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization
|
||||
- Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092)
|
||||
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
|
||||
to the window menu
|
||||
- [Win32] Added a version info resource to the GLFW DLL
|
||||
- [Win32] Made hidden helper window use its own window class
|
||||
- Bugfix: `glfwGetKeyScancode` returned `0` on error when initialized instead of `-1`
|
||||
- Bugfix: Failure to make a newly created context current could cause segfault (#2327)
|
||||
- [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are
|
||||
opaque (#1512)
|
||||
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
||||
@ -213,7 +249,6 @@ information on what to include when reporting a bug.
|
||||
- [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
|
||||
later (#1783,#1796)
|
||||
- [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
|
||||
- [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
|
||||
- [Win32] Bugfix: Content scale queries could fail silently (#1615)
|
||||
- [Win32] Bugfix: Content scales could have garbage values if monitor was recently
|
||||
disconnected (#1615)
|
||||
@ -229,9 +264,13 @@ information on what to include when reporting a bug.
|
||||
- [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395)
|
||||
- [Win32] Bugfix: The OSMesa library was not unloaded on termination
|
||||
- [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050)
|
||||
- [Win32] Bugfix: `glfwWaitEventsTimeout` did not return for some sent messages (#2408)
|
||||
- [Win32] Bugfix: Fix pkg-config for dynamic library on Windows (#2386, #2420)
|
||||
- [Win32] Bugfix: XInput could reportedly provide invalid DPad bit masks (#2291)
|
||||
- [Win32] Bugfix: Rapid clipboard calls could fail due to Clipboard History
|
||||
- [Win32] Bugfix: Disabled cursor mode doesn't work right when connected over RDP (#1276,#1279,#2431)
|
||||
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
||||
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
||||
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
||||
- [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169)
|
||||
- [Cocoa] Changed F13 key to report Print Screen for cross-platform consistency
|
||||
(#1786)
|
||||
@ -242,8 +281,6 @@ information on what to include when reporting a bug.
|
||||
(#1412)
|
||||
- [Cocoa] Bugfix: Event processing before window creation would assert (#1543)
|
||||
- [Cocoa] Bugfix: Undecorated windows could not be iconified on recent macOS
|
||||
- [Cocoa] Bugfix: Touching event queue from secondary thread before main thread
|
||||
would abort (#1649)
|
||||
- [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16
|
||||
(#1635)
|
||||
- [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays
|
||||
@ -269,6 +306,10 @@ information on what to include when reporting a bug.
|
||||
application (#2110)
|
||||
- [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle
|
||||
subdirectory (#2113,#2120)
|
||||
- [Cocoa] Bugfix: Compilation failed on OS X 10.8 due to unconditional use of 10.9+
|
||||
symbols (#2161)
|
||||
- [Cocoa] Bugfix: Querying joystick elements could reportedly segfault on macOS
|
||||
13 Ventura (#2320)
|
||||
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
|
||||
- [X11] Bugfix: Key names were not updated when the keyboard layout changed
|
||||
(#1462,#1528)
|
||||
@ -283,8 +324,6 @@ information on what to include when reporting a bug.
|
||||
- [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
|
||||
- [X11] Bugfix: Querying a disconnected monitor could segfault (#1602)
|
||||
- [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
|
||||
- [X11] Bugfix: Termination would segfault if the IM had been destroyed
|
||||
- [X11] Bugfix: Any IM started after initialization would not be detected
|
||||
- [X11] Bugfix: Xlib errors caused by other parts of the application could be
|
||||
reported as GLFW errors
|
||||
- [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633)
|
||||
@ -312,7 +351,6 @@ information on what to include when reporting a bug.
|
||||
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault
|
||||
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
|
||||
- [Wayland] Added improved fallback window decorations via libdecor (#1639,#1693)
|
||||
- [Wayland] Added dynamic loading of all Wayland libraries
|
||||
- [Wayland] Added support for key names via xkbcommon
|
||||
- [Wayland] Added support for file path drop events (#2040)
|
||||
- [Wayland] Added support for more human-readable monitor names where available
|
||||
@ -320,7 +358,6 @@ information on what to include when reporting a bug.
|
||||
`EGL_EXT_present_opaque` (#1895)
|
||||
- [Wayland] Removed support for `wl_shell` (#1443)
|
||||
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
|
||||
- [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
|
||||
@ -384,22 +421,17 @@ information on what to include when reporting a bug.
|
||||
decorations
|
||||
- [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450)
|
||||
- [Wayland] Bugfix: Joysticks connected after `glfwInit` were not detected (#2198)
|
||||
- [POSIX] Removed use of deprecated function `gettimeofday`
|
||||
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||
- [Wayland] Bugfix: Fallback decorations emitted `GLFW_CURSOR_UNAVAILABLE` errors
|
||||
- [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043)
|
||||
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
|
||||
- [NSGL] Removed enforcement of forward-compatible flag for core contexts
|
||||
- [Linux] Bugfix: A small amount of memory could leak if initialization failed (#2229)
|
||||
- [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
|
||||
macOS versions (#1442)
|
||||
- [NSGL] Bugfix: Workaround for swap interval on 10.14 broke on 10.12 (#1483)
|
||||
- [NSGL] Bugfix: Defining `GL_SILENCE_DEPRECATION` externally caused
|
||||
a duplicate definition warning (#1840)
|
||||
- [EGL] Added platform selection via the `EGL_EXT_platform_base` extension
|
||||
(#442)
|
||||
- [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension
|
||||
(#1380)
|
||||
[EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL
|
||||
- [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL
|
||||
- [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
|
||||
- [EGL] Bugfix: Setting `GLFW_CONTEXT_DEBUG` caused creation to fail (#2348)
|
||||
- [GLX] Added loading of glvnd `libGLX.so.0` where available
|
||||
- [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library
|
||||
|
||||
@ -410,13 +442,12 @@ 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.
|
||||
|
||||
If you have questions related to the use of GLFW, we have a
|
||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||
[Libera.Chat](https://libera.chat/).
|
||||
[forum](https://discourse.glfw.org/).
|
||||
|
||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||
request, please file it in the
|
||||
[issue tracker](https://github.com/glfw/glfw/issues) on GitHub.
|
||||
|
||||
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 or GitHub.
|
||||
|
||||
|
247
deps/vs2008/stdint.h
vendored
247
deps/vs2008/stdint.h
vendored
@ -1,247 +0,0 @@
|
||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
|
||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
||||
// realize that, e.g. char has the same size as __int8
|
||||
// so we give up on __intX for them.
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 signed int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
102
deps/wayland/fractional-scale-v1.xml
vendored
Normal file
102
deps/wayland/fractional-scale-v1.xml
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="fractional_scale_v1">
|
||||
<copyright>
|
||||
Copyright © 2022 Kenny Levinsen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<description summary="Protocol for requesting fractional surface scales">
|
||||
This protocol allows a compositor to suggest for surfaces to render at
|
||||
fractional scales.
|
||||
|
||||
A client can submit scaled content by utilizing wp_viewport. This is done by
|
||||
creating a wp_viewport object for the surface and setting the destination
|
||||
rectangle to the surface size before the scale factor is applied.
|
||||
|
||||
The buffer size is calculated by multiplying the surface size by the
|
||||
intended scale.
|
||||
|
||||
The wl_surface buffer scale should remain set to 1.
|
||||
|
||||
If a surface has a surface-local size of 100 px by 50 px and wishes to
|
||||
submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
|
||||
be used and the wp_viewport destination rectangle should be 100 px by 50 px.
|
||||
|
||||
For toplevel surfaces, the size is rounded halfway away from zero. The
|
||||
rounding algorithm for subsurface position and size is not defined.
|
||||
</description>
|
||||
|
||||
<interface name="wp_fractional_scale_manager_v1" version="1">
|
||||
<description summary="fractional surface scale information">
|
||||
A global interface for requesting surfaces to use fractional scales.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="unbind the fractional surface scale interface">
|
||||
Informs the server that the client will not be using this protocol
|
||||
object anymore. This does not affect any other objects,
|
||||
wp_fractional_scale_v1 objects included.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="fractional_scale_exists" value="0"
|
||||
summary="the surface already has a fractional_scale object associated"/>
|
||||
</enum>
|
||||
|
||||
<request name="get_fractional_scale">
|
||||
<description summary="extend surface interface for scale information">
|
||||
Create an add-on object for the the wl_surface to let the compositor
|
||||
request fractional scales. If the given wl_surface already has a
|
||||
wp_fractional_scale_v1 object associated, the fractional_scale_exists
|
||||
protocol error is raised.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="wp_fractional_scale_v1"
|
||||
summary="the new surface scale info interface id"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="the surface"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="wp_fractional_scale_v1" version="1">
|
||||
<description summary="fractional scale interface to a wl_surface">
|
||||
An additional interface to a wl_surface object which allows the compositor
|
||||
to inform the client of the preferred scale.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="remove surface scale information for surface">
|
||||
Destroy the fractional scale object. When this object is destroyed,
|
||||
preferred_scale events will no longer be sent.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="preferred_scale">
|
||||
<description summary="notify of new preferred scale">
|
||||
Notification of a new preferred scale for this surface that the
|
||||
compositor suggests that the client should use.
|
||||
|
||||
The sent scale is the numerator of a fraction with a denominator of 120.
|
||||
</description>
|
||||
<arg name="scale" type="uint" summary="the new preferred scale"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
83
deps/wayland/idle-inhibit-unstable-v1.xml
vendored
Normal file
83
deps/wayland/idle-inhibit-unstable-v1.xml
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="idle_inhibit_unstable_v1">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2015 Samsung Electronics Co., Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwp_idle_inhibit_manager_v1" version="1">
|
||||
<description summary="control behavior when display idles">
|
||||
This interface permits inhibiting the idle behavior such as screen
|
||||
blanking, locking, and screensaving. The client binds the idle manager
|
||||
globally, then creates idle-inhibitor objects for each surface.
|
||||
|
||||
Warning! The protocol described in this file is experimental and
|
||||
backward incompatible changes may be made. Backward compatible changes
|
||||
may be added together with the corresponding interface version bump.
|
||||
Backward incompatible changes are done by bumping the version number in
|
||||
the protocol and interface names and resetting the interface version.
|
||||
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
version number in the protocol and interface names are removed and the
|
||||
interface version number is reset.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the idle inhibitor object">
|
||||
Destroy the inhibit manager.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="create_inhibitor">
|
||||
<description summary="create a new inhibitor object">
|
||||
Create a new inhibitor object associated with the given surface.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_idle_inhibitor_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="the surface that inhibits the idle behavior"/>
|
||||
</request>
|
||||
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_idle_inhibitor_v1" version="1">
|
||||
<description summary="context object for inhibiting idle behavior">
|
||||
An idle inhibitor prevents the output that the associated surface is
|
||||
visible on from being set to a state where it is not visually usable due
|
||||
to lack of user interaction (e.g. blanked, dimmed, locked, set to power
|
||||
save, etc.) Any screensaver processes are also blocked from displaying.
|
||||
|
||||
If the surface is destroyed, unmapped, becomes occluded, loses
|
||||
visibility, or otherwise becomes not visually relevant for the user, the
|
||||
idle inhibitor will not be honored by the compositor; if the surface
|
||||
subsequently regains visibility the inhibitor takes effect once again.
|
||||
Likewise, the inhibitor isn't honored if the system was already idled at
|
||||
the time the inhibitor was established, although if the system later
|
||||
de-idles and re-idles the inhibitor will take effect.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the idle inhibitor object">
|
||||
Remove the inhibitor effect from the associated wl_surface.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
</interface>
|
||||
</protocol>
|
339
deps/wayland/pointer-constraints-unstable-v1.xml
vendored
Normal file
339
deps/wayland/pointer-constraints-unstable-v1.xml
vendored
Normal file
@ -0,0 +1,339 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="pointer_constraints_unstable_v1">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2014 Jonas Ådahl
|
||||
Copyright © 2015 Red Hat Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<description summary="protocol for constraining pointer motions">
|
||||
This protocol specifies a set of interfaces used for adding constraints to
|
||||
the motion of a pointer. Possible constraints include confining pointer
|
||||
motions to a given region, or locking it to its current position.
|
||||
|
||||
In order to constrain the pointer, a client must first bind the global
|
||||
interface "wp_pointer_constraints" which, if a compositor supports pointer
|
||||
constraints, is exposed by the registry. Using the bound global object, the
|
||||
client uses the request that corresponds to the type of constraint it wants
|
||||
to make. See wp_pointer_constraints for more details.
|
||||
|
||||
Warning! The protocol described in this file is experimental and backward
|
||||
incompatible changes may be made. Backward compatible changes may be added
|
||||
together with the corresponding interface version bump. Backward
|
||||
incompatible changes are done by bumping the version number in the protocol
|
||||
and interface names and resetting the interface version. Once the protocol
|
||||
is to be declared stable, the 'z' prefix and the version number in the
|
||||
protocol and interface names are removed and the interface version number is
|
||||
reset.
|
||||
</description>
|
||||
|
||||
<interface name="zwp_pointer_constraints_v1" version="1">
|
||||
<description summary="constrain the movement of a pointer">
|
||||
The global interface exposing pointer constraining functionality. It
|
||||
exposes two requests: lock_pointer for locking the pointer to its
|
||||
position, and confine_pointer for locking the pointer to a region.
|
||||
|
||||
The lock_pointer and confine_pointer requests create the objects
|
||||
wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||
use these objects to interact with the lock.
|
||||
|
||||
For any surface, only one lock or confinement may be active across all
|
||||
wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||
when another lock or confinement is active or requested on the same surface
|
||||
and with any of the wl_pointer objects of the same seat, an
|
||||
'already_constrained' error will be raised.
|
||||
</description>
|
||||
|
||||
<enum name="error">
|
||||
<description summary="wp_pointer_constraints error values">
|
||||
These errors can be emitted in response to wp_pointer_constraints
|
||||
requests.
|
||||
</description>
|
||||
<entry name="already_constrained" value="1"
|
||||
summary="pointer constraint already requested on that surface"/>
|
||||
</enum>
|
||||
|
||||
<enum name="lifetime">
|
||||
<description summary="constraint lifetime">
|
||||
These values represent different lifetime semantics. They are passed
|
||||
as arguments to the factory requests to specify how the constraint
|
||||
lifetimes should be managed.
|
||||
</description>
|
||||
<entry name="oneshot" value="1">
|
||||
<description summary="the pointer constraint is defunct once deactivated">
|
||||
A oneshot pointer constraint will never reactivate once it has been
|
||||
deactivated. See the corresponding deactivation event
|
||||
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||
details.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="persistent" value="2">
|
||||
<description summary="the pointer constraint may reactivate">
|
||||
A persistent pointer constraint may again reactivate once it has
|
||||
been deactivated. See the corresponding deactivation event
|
||||
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||
details.
|
||||
</description>
|
||||
</entry>
|
||||
</enum>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the pointer constraints manager object">
|
||||
Used by the client to notify the server that it will no longer use this
|
||||
pointer constraints object.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="lock_pointer">
|
||||
<description summary="lock pointer to a position">
|
||||
The lock_pointer request lets the client request to disable movements of
|
||||
the virtual pointer (i.e. the cursor), effectively locking the pointer
|
||||
to a position. This request may not take effect immediately; in the
|
||||
future, when the compositor deems implementation-specific constraints
|
||||
are satisfied, the pointer lock will be activated and the compositor
|
||||
sends a locked event.
|
||||
|
||||
The protocol provides no guarantee that the constraints are ever
|
||||
satisfied, and does not require the compositor to send an error if the
|
||||
constraints cannot ever be satisfied. It is thus possible to request a
|
||||
lock that will never activate.
|
||||
|
||||
There may not be another pointer constraint of any kind requested or
|
||||
active on the surface for any of the wl_pointer objects of the seat of
|
||||
the passed pointer when requesting a lock. If there is, an error will be
|
||||
raised. See general pointer lock documentation for more details.
|
||||
|
||||
The intersection of the region passed with this request and the input
|
||||
region of the surface is used to determine where the pointer must be
|
||||
in order for the lock to activate. It is up to the compositor whether to
|
||||
warp the pointer or require some kind of user interaction for the lock
|
||||
to activate. If the region is null the surface input region is used.
|
||||
|
||||
A surface may receive pointer focus without the lock being activated.
|
||||
|
||||
The request creates a new object wp_locked_pointer which is used to
|
||||
interact with the lock as well as receive updates about its state. See
|
||||
the the description of wp_locked_pointer for further information.
|
||||
|
||||
Note that while a pointer is locked, the wl_pointer objects of the
|
||||
corresponding seat will not emit any wl_pointer.motion events, but
|
||||
relative motion events will still be emitted via wp_relative_pointer
|
||||
objects of the same seat. wl_pointer.axis and wl_pointer.button events
|
||||
are unaffected.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="surface to lock pointer to"/>
|
||||
<arg name="pointer" type="object" interface="wl_pointer"
|
||||
summary="the pointer that should be locked"/>
|
||||
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||
summary="region of surface"/>
|
||||
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
|
||||
</request>
|
||||
|
||||
<request name="confine_pointer">
|
||||
<description summary="confine pointer to a region">
|
||||
The confine_pointer request lets the client request to confine the
|
||||
pointer cursor to a given region. This request may not take effect
|
||||
immediately; in the future, when the compositor deems implementation-
|
||||
specific constraints are satisfied, the pointer confinement will be
|
||||
activated and the compositor sends a confined event.
|
||||
|
||||
The intersection of the region passed with this request and the input
|
||||
region of the surface is used to determine where the pointer must be
|
||||
in order for the confinement to activate. It is up to the compositor
|
||||
whether to warp the pointer or require some kind of user interaction for
|
||||
the confinement to activate. If the region is null the surface input
|
||||
region is used.
|
||||
|
||||
The request will create a new object wp_confined_pointer which is used
|
||||
to interact with the confinement as well as receive updates about its
|
||||
state. See the the description of wp_confined_pointer for further
|
||||
information.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="surface to lock pointer to"/>
|
||||
<arg name="pointer" type="object" interface="wl_pointer"
|
||||
summary="the pointer that should be confined"/>
|
||||
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||
summary="region of surface"/>
|
||||
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_locked_pointer_v1" version="1">
|
||||
<description summary="receive relative pointer motion events">
|
||||
The wp_locked_pointer interface represents a locked pointer state.
|
||||
|
||||
While the lock of this object is active, the wl_pointer objects of the
|
||||
associated seat will not emit any wl_pointer.motion events.
|
||||
|
||||
This object will send the event 'locked' when the lock is activated.
|
||||
Whenever the lock is activated, it is guaranteed that the locked surface
|
||||
will already have received pointer focus and that the pointer will be
|
||||
within the region passed to the request creating this object.
|
||||
|
||||
To unlock the pointer, send the destroy request. This will also destroy
|
||||
the wp_locked_pointer object.
|
||||
|
||||
If the compositor decides to unlock the pointer the unlocked event is
|
||||
sent. See wp_locked_pointer.unlock for details.
|
||||
|
||||
When unlocking, the compositor may warp the cursor position to the set
|
||||
cursor position hint. If it does, it will not result in any relative
|
||||
motion events emitted via wp_relative_pointer.
|
||||
|
||||
If the surface the lock was requested on is destroyed and the lock is not
|
||||
yet activated, the wp_locked_pointer object is now defunct and must be
|
||||
destroyed.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the locked pointer object">
|
||||
Destroy the locked pointer object. If applicable, the compositor will
|
||||
unlock the pointer.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="set_cursor_position_hint">
|
||||
<description summary="set the pointer cursor position hint">
|
||||
Set the cursor position hint relative to the top left corner of the
|
||||
surface.
|
||||
|
||||
If the client is drawing its own cursor, it should update the position
|
||||
hint to the position of its own cursor. A compositor may use this
|
||||
information to warp the pointer upon unlock in order to avoid pointer
|
||||
jumps.
|
||||
|
||||
The cursor position hint is double buffered. The new hint will only take
|
||||
effect when the associated surface gets it pending state applied. See
|
||||
wl_surface.commit for details.
|
||||
</description>
|
||||
<arg name="surface_x" type="fixed"
|
||||
summary="surface-local x coordinate"/>
|
||||
<arg name="surface_y" type="fixed"
|
||||
summary="surface-local y coordinate"/>
|
||||
</request>
|
||||
|
||||
<request name="set_region">
|
||||
<description summary="set a new lock region">
|
||||
Set a new region used to lock the pointer.
|
||||
|
||||
The new lock region is double-buffered. The new lock region will
|
||||
only take effect when the associated surface gets its pending state
|
||||
applied. See wl_surface.commit for details.
|
||||
|
||||
For details about the lock region, see wp_locked_pointer.
|
||||
</description>
|
||||
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||
summary="region of surface"/>
|
||||
</request>
|
||||
|
||||
<event name="locked">
|
||||
<description summary="lock activation event">
|
||||
Notification that the pointer lock of the seat's pointer is activated.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="unlocked">
|
||||
<description summary="lock deactivation event">
|
||||
Notification that the pointer lock of the seat's pointer is no longer
|
||||
active. If this is a oneshot pointer lock (see
|
||||
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||
be destroyed. If this is a persistent pointer lock (see
|
||||
wp_pointer_constraints.lifetime) this pointer lock may again
|
||||
reactivate in the future.
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_confined_pointer_v1" version="1">
|
||||
<description summary="confined pointer object">
|
||||
The wp_confined_pointer interface represents a confined pointer state.
|
||||
|
||||
This object will send the event 'confined' when the confinement is
|
||||
activated. Whenever the confinement is activated, it is guaranteed that
|
||||
the surface the pointer is confined to will already have received pointer
|
||||
focus and that the pointer will be within the region passed to the request
|
||||
creating this object. It is up to the compositor to decide whether this
|
||||
requires some user interaction and if the pointer will warp to within the
|
||||
passed region if outside.
|
||||
|
||||
To unconfine the pointer, send the destroy request. This will also destroy
|
||||
the wp_confined_pointer object.
|
||||
|
||||
If the compositor decides to unconfine the pointer the unconfined event is
|
||||
sent. The wp_confined_pointer object is at this point defunct and should
|
||||
be destroyed.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the confined pointer object">
|
||||
Destroy the confined pointer object. If applicable, the compositor will
|
||||
unconfine the pointer.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="set_region">
|
||||
<description summary="set a new confine region">
|
||||
Set a new region used to confine the pointer.
|
||||
|
||||
The new confine region is double-buffered. The new confine region will
|
||||
only take effect when the associated surface gets its pending state
|
||||
applied. See wl_surface.commit for details.
|
||||
|
||||
If the confinement is active when the new confinement region is applied
|
||||
and the pointer ends up outside of newly applied region, the pointer may
|
||||
warped to a position within the new confinement region. If warped, a
|
||||
wl_pointer.motion event will be emitted, but no
|
||||
wp_relative_pointer.relative_motion event.
|
||||
|
||||
The compositor may also, instead of using the new region, unconfine the
|
||||
pointer.
|
||||
|
||||
For details about the confine region, see wp_confined_pointer.
|
||||
</description>
|
||||
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||
summary="region of surface"/>
|
||||
</request>
|
||||
|
||||
<event name="confined">
|
||||
<description summary="pointer confined">
|
||||
Notification that the pointer confinement of the seat's pointer is
|
||||
activated.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="unconfined">
|
||||
<description summary="pointer unconfined">
|
||||
Notification that the pointer confinement of the seat's pointer is no
|
||||
longer active. If this is a oneshot pointer confinement (see
|
||||
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||
be destroyed. If this is a persistent pointer confinement (see
|
||||
wp_pointer_constraints.lifetime) this pointer confinement may again
|
||||
reactivate in the future.
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
</protocol>
|
136
deps/wayland/relative-pointer-unstable-v1.xml
vendored
Normal file
136
deps/wayland/relative-pointer-unstable-v1.xml
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="relative_pointer_unstable_v1">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2014 Jonas Ådahl
|
||||
Copyright © 2015 Red Hat Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<description summary="protocol for relative pointer motion events">
|
||||
This protocol specifies a set of interfaces used for making clients able to
|
||||
receive relative pointer events not obstructed by barriers (such as the
|
||||
monitor edge or other pointer barriers).
|
||||
|
||||
To start receiving relative pointer events, a client must first bind the
|
||||
global interface "wp_relative_pointer_manager" which, if a compositor
|
||||
supports relative pointer motion events, is exposed by the registry. After
|
||||
having created the relative pointer manager proxy object, the client uses
|
||||
it to create the actual relative pointer object using the
|
||||
"get_relative_pointer" request given a wl_pointer. The relative pointer
|
||||
motion events will then, when applicable, be transmitted via the proxy of
|
||||
the newly created relative pointer object. See the documentation of the
|
||||
relative pointer interface for more details.
|
||||
|
||||
Warning! The protocol described in this file is experimental and backward
|
||||
incompatible changes may be made. Backward compatible changes may be added
|
||||
together with the corresponding interface version bump. Backward
|
||||
incompatible changes are done by bumping the version number in the protocol
|
||||
and interface names and resetting the interface version. Once the protocol
|
||||
is to be declared stable, the 'z' prefix and the version number in the
|
||||
protocol and interface names are removed and the interface version number is
|
||||
reset.
|
||||
</description>
|
||||
|
||||
<interface name="zwp_relative_pointer_manager_v1" version="1">
|
||||
<description summary="get relative pointer objects">
|
||||
A global interface used for getting the relative pointer object for a
|
||||
given pointer.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the relative pointer manager object">
|
||||
Used by the client to notify the server that it will no longer use this
|
||||
relative pointer manager object.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="get_relative_pointer">
|
||||
<description summary="get a relative pointer object">
|
||||
Create a relative pointer interface given a wl_pointer object. See the
|
||||
wp_relative_pointer interface for more details.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
|
||||
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_relative_pointer_v1" version="1">
|
||||
<description summary="relative pointer object">
|
||||
A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||
used for emitting relative pointer events. It shares the same focus as
|
||||
wl_pointer objects of the same seat and will only emit events when it has
|
||||
focus.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="release the relative pointer object"/>
|
||||
</request>
|
||||
|
||||
<event name="relative_motion">
|
||||
<description summary="relative pointer motion">
|
||||
Relative x/y pointer motion from the pointer of the seat associated with
|
||||
this object.
|
||||
|
||||
A relative motion is in the same dimension as regular wl_pointer motion
|
||||
events, except they do not represent an absolute position. For example,
|
||||
moving a pointer from (x, y) to (x', y') would have the equivalent
|
||||
relative motion (x' - x, y' - y). If a pointer motion caused the
|
||||
absolute pointer position to be clipped by for example the edge of the
|
||||
monitor, the relative motion is unaffected by the clipping and will
|
||||
represent the unclipped motion.
|
||||
|
||||
This event also contains non-accelerated motion deltas. The
|
||||
non-accelerated delta is, when applicable, the regular pointer motion
|
||||
delta as it was before having applied motion acceleration and other
|
||||
transformations such as normalization.
|
||||
|
||||
Note that the non-accelerated delta does not represent 'raw' events as
|
||||
they were read from some device. Pointer motion acceleration is device-
|
||||
and configuration-specific and non-accelerated deltas and accelerated
|
||||
deltas may have the same value on some devices.
|
||||
|
||||
Relative motions are not coupled to wl_pointer.motion events, and can be
|
||||
sent in combination with such events, but also independently. There may
|
||||
also be scenarios where wl_pointer.motion is sent, but there is no
|
||||
relative motion. The order of an absolute and relative motion event
|
||||
originating from the same physical motion is not guaranteed.
|
||||
|
||||
If the client needs button events or focus state, it can receive them
|
||||
from a wl_pointer object of the same seat that the wp_relative_pointer
|
||||
object is associated with.
|
||||
</description>
|
||||
<arg name="utime_hi" type="uint"
|
||||
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||
<arg name="utime_lo" type="uint"
|
||||
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||
<arg name="dx" type="fixed"
|
||||
summary="the x component of the motion vector"/>
|
||||
<arg name="dy" type="fixed"
|
||||
summary="the y component of the motion vector"/>
|
||||
<arg name="dx_unaccel" type="fixed"
|
||||
summary="the x component of the unaccelerated motion vector"/>
|
||||
<arg name="dy_unaccel" type="fixed"
|
||||
summary="the y component of the unaccelerated motion vector"/>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
</protocol>
|
180
deps/wayland/viewporter.xml
vendored
Normal file
180
deps/wayland/viewporter.xml
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="viewporter">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2013-2016 Collabora, Ltd.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="wp_viewporter" version="1">
|
||||
<description summary="surface cropping and scaling">
|
||||
The global interface exposing surface cropping and scaling
|
||||
capabilities is used to instantiate an interface extension for a
|
||||
wl_surface object. This extended interface will then allow
|
||||
cropping and scaling the surface contents, effectively
|
||||
disconnecting the direct relationship between the buffer and the
|
||||
surface size.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="unbind from the cropping and scaling interface">
|
||||
Informs the server that the client will not be using this
|
||||
protocol object anymore. This does not affect any other objects,
|
||||
wp_viewport objects included.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="viewport_exists" value="0"
|
||||
summary="the surface already has a viewport object associated"/>
|
||||
</enum>
|
||||
|
||||
<request name="get_viewport">
|
||||
<description summary="extend surface interface for crop and scale">
|
||||
Instantiate an interface extension for the given wl_surface to
|
||||
crop and scale its content. If the given wl_surface already has
|
||||
a wp_viewport object associated, the viewport_exists
|
||||
protocol error is raised.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="wp_viewport"
|
||||
summary="the new viewport interface id"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="the surface"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="wp_viewport" version="1">
|
||||
<description summary="crop and scale interface to a wl_surface">
|
||||
An additional interface to a wl_surface object, which allows the
|
||||
client to specify the cropping and scaling of the surface
|
||||
contents.
|
||||
|
||||
This interface works with two concepts: the source rectangle (src_x,
|
||||
src_y, src_width, src_height), and the destination size (dst_width,
|
||||
dst_height). The contents of the source rectangle are scaled to the
|
||||
destination size, and content outside the source rectangle is ignored.
|
||||
This state is double-buffered, and is applied on the next
|
||||
wl_surface.commit.
|
||||
|
||||
The two parts of crop and scale state are independent: the source
|
||||
rectangle, and the destination size. Initially both are unset, that
|
||||
is, no scaling is applied. The whole of the current wl_buffer is
|
||||
used as the source, and the surface size is as defined in
|
||||
wl_surface.attach.
|
||||
|
||||
If the destination size is set, it causes the surface size to become
|
||||
dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||
this size. This overrides whatever the attached wl_buffer size is,
|
||||
unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||
has no content and therefore no size. Otherwise, the size is always
|
||||
at least 1x1 in surface local coordinates.
|
||||
|
||||
If the source rectangle is set, it defines what area of the wl_buffer is
|
||||
taken as the source. If the source rectangle is set and the destination
|
||||
size is not set, then src_width and src_height must be integers, and the
|
||||
surface size becomes the source rectangle size. This results in cropping
|
||||
without scaling. If src_width or src_height are not integers and
|
||||
destination size is not set, the bad_size protocol error is raised when
|
||||
the surface state is applied.
|
||||
|
||||
The coordinate transformations from buffer pixel coordinates up to
|
||||
the surface-local coordinates happen in the following order:
|
||||
1. buffer_transform (wl_surface.set_buffer_transform)
|
||||
2. buffer_scale (wl_surface.set_buffer_scale)
|
||||
3. crop and scale (wp_viewport.set*)
|
||||
This means, that the source rectangle coordinates of crop and scale
|
||||
are given in the coordinates after the buffer transform and scale,
|
||||
i.e. in the coordinates that would be the surface-local coordinates
|
||||
if the crop and scale was not applied.
|
||||
|
||||
If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||
Otherwise, if the source rectangle is partially or completely outside of
|
||||
the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||
when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
out_of_buffer error.
|
||||
|
||||
If the wl_surface associated with the wp_viewport is destroyed,
|
||||
all wp_viewport requests except 'destroy' raise the protocol error
|
||||
no_surface.
|
||||
|
||||
If the wp_viewport object is destroyed, the crop and scale
|
||||
state is removed from the wl_surface. The change will be applied
|
||||
on the next wl_surface.commit.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="remove scaling and cropping from the surface">
|
||||
The associated wl_surface's crop and scale state is removed.
|
||||
The change is applied on the next wl_surface.commit.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="bad_value" value="0"
|
||||
summary="negative or zero values in width or height"/>
|
||||
<entry name="bad_size" value="1"
|
||||
summary="destination size is not integer"/>
|
||||
<entry name="out_of_buffer" value="2"
|
||||
summary="source rectangle extends outside of the content area"/>
|
||||
<entry name="no_surface" value="3"
|
||||
summary="the wl_surface was destroyed"/>
|
||||
</enum>
|
||||
|
||||
<request name="set_source">
|
||||
<description summary="set the source rectangle for cropping">
|
||||
Set the source rectangle of the associated wl_surface. See
|
||||
wp_viewport for the description, and relation to the wl_buffer
|
||||
size.
|
||||
|
||||
If all of x, y, width and height are -1.0, the source rectangle is
|
||||
unset instead. Any other set of values where width or height are zero
|
||||
or negative, or x or y are negative, raise the bad_value protocol
|
||||
error.
|
||||
|
||||
The crop and scale state is double-buffered state, and will be
|
||||
applied on the next wl_surface.commit.
|
||||
</description>
|
||||
<arg name="x" type="fixed" summary="source rectangle x"/>
|
||||
<arg name="y" type="fixed" summary="source rectangle y"/>
|
||||
<arg name="width" type="fixed" summary="source rectangle width"/>
|
||||
<arg name="height" type="fixed" summary="source rectangle height"/>
|
||||
</request>
|
||||
|
||||
<request name="set_destination">
|
||||
<description summary="set the surface size for scaling">
|
||||
Set the destination size of the associated wl_surface. See
|
||||
wp_viewport for the description, and relation to the wl_buffer
|
||||
size.
|
||||
|
||||
If width is -1 and height is -1, the destination size is unset
|
||||
instead. Any other pair of values for width and height that
|
||||
contains zero or negative values raises the bad_value protocol
|
||||
error.
|
||||
|
||||
The crop and scale state is double-buffered state, and will be
|
||||
applied on the next wl_surface.commit.
|
||||
</description>
|
||||
<arg name="width" type="int" summary="surface width"/>
|
||||
<arg name="height" type="int" summary="surface height"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
</protocol>
|
3151
deps/wayland/wayland.xml
vendored
Normal file
3151
deps/wayland/wayland.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
200
deps/wayland/xdg-activation-v1.xml
vendored
Normal file
200
deps/wayland/xdg-activation-v1.xml
vendored
Normal file
@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="xdg_activation_v1">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<description summary="Protocol for requesting activation of surfaces">
|
||||
The way for a client to pass focus to another toplevel is as follows.
|
||||
|
||||
The client that intends to activate another toplevel uses the
|
||||
xdg_activation_v1.get_activation_token request to get an activation token.
|
||||
This token is then forwarded to the client, which is supposed to activate
|
||||
one of its surfaces, through a separate band of communication.
|
||||
|
||||
One established way of doing this is through the XDG_ACTIVATION_TOKEN
|
||||
environment variable of a newly launched child process. The child process
|
||||
should unset the environment variable again right after reading it out in
|
||||
order to avoid propagating it to other child processes.
|
||||
|
||||
Another established way exists for Applications implementing the D-Bus
|
||||
interface org.freedesktop.Application, which should get their token under
|
||||
activation-token on their platform_data.
|
||||
|
||||
In general activation tokens may be transferred across clients through
|
||||
means not described in this protocol.
|
||||
|
||||
The client to be activated will then pass the token
|
||||
it received to the xdg_activation_v1.activate request. The compositor can
|
||||
then use this token to decide how to react to the activation request.
|
||||
|
||||
The token the activating client gets may be ineffective either already at
|
||||
the time it receives it, for example if it was not focused, for focus
|
||||
stealing prevention. The activating client will have no way to discover
|
||||
the validity of the token, and may still forward it to the to be activated
|
||||
client.
|
||||
|
||||
The created activation token may optionally get information attached to it
|
||||
that can be used by the compositor to identify the application that we
|
||||
intend to activate. This can for example be used to display a visual hint
|
||||
about what application is being started.
|
||||
|
||||
Warning! The protocol described in this file is currently in the testing
|
||||
phase. Backward compatible changes may be added together with the
|
||||
corresponding interface version bump. Backward incompatible changes can
|
||||
only be done by creating a new major version of the extension.
|
||||
</description>
|
||||
|
||||
<interface name="xdg_activation_v1" version="1">
|
||||
<description summary="interface for activating surfaces">
|
||||
A global interface used for informing the compositor about applications
|
||||
being activated or started, or for applications to request to be
|
||||
activated.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the xdg_activation object">
|
||||
Notify the compositor that the xdg_activation object will no longer be
|
||||
used.
|
||||
|
||||
The child objects created via this interface are unaffected and should
|
||||
be destroyed separately.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="get_activation_token">
|
||||
<description summary="requests a token">
|
||||
Creates an xdg_activation_token_v1 object that will provide
|
||||
the initiating client with a unique token for this activation. This
|
||||
token should be offered to the clients to be activated.
|
||||
</description>
|
||||
|
||||
<arg name="id" type="new_id" interface="xdg_activation_token_v1"/>
|
||||
</request>
|
||||
|
||||
<request name="activate">
|
||||
<description summary="notify new interaction being available">
|
||||
Requests surface activation. It's up to the compositor to display
|
||||
this information as desired, for example by placing the surface above
|
||||
the rest.
|
||||
|
||||
The compositor may know who requested this by checking the activation
|
||||
token and might decide not to follow through with the activation if it's
|
||||
considered unwanted.
|
||||
|
||||
Compositors can ignore unknown activation tokens when an invalid
|
||||
token is passed.
|
||||
</description>
|
||||
<arg name="token" type="string" summary="the activation token of the initiating client"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="the wl_surface to activate"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="xdg_activation_token_v1" version="1">
|
||||
<description summary="an exported activation handle">
|
||||
An object for setting up a token and receiving a token handle that can
|
||||
be passed as an activation token to another client.
|
||||
|
||||
The object is created using the xdg_activation_v1.get_activation_token
|
||||
request. This object should then be populated with the app_id, surface
|
||||
and serial information and committed. The compositor shall then issue a
|
||||
done event with the token. In case the request's parameters are invalid,
|
||||
the compositor will provide an invalid token.
|
||||
</description>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="already_used" value="0"
|
||||
summary="The token has already been used previously"/>
|
||||
</enum>
|
||||
|
||||
<request name="set_serial">
|
||||
<description summary="specifies the seat and serial of the activating event">
|
||||
Provides information about the seat and serial event that requested the
|
||||
token.
|
||||
|
||||
The serial can come from an input or focus event. For instance, if a
|
||||
click triggers the launch of a third-party client, the launcher client
|
||||
should send a set_serial request with the serial and seat from the
|
||||
wl_pointer.button event.
|
||||
|
||||
Some compositors might refuse to activate toplevels when the token
|
||||
doesn't have a valid and recent enough event serial.
|
||||
|
||||
Must be sent before commit. This information is optional.
|
||||
</description>
|
||||
<arg name="serial" type="uint"
|
||||
summary="the serial of the event that triggered the activation"/>
|
||||
<arg name="seat" type="object" interface="wl_seat"
|
||||
summary="the wl_seat of the event"/>
|
||||
</request>
|
||||
|
||||
<request name="set_app_id">
|
||||
<description summary="specifies the application being activated">
|
||||
The requesting client can specify an app_id to associate the token
|
||||
being created with it.
|
||||
|
||||
Must be sent before commit. This information is optional.
|
||||
</description>
|
||||
<arg name="app_id" type="string"
|
||||
summary="the application id of the client being activated."/>
|
||||
</request>
|
||||
|
||||
<request name="set_surface">
|
||||
<description summary="specifies the surface requesting activation">
|
||||
This request sets the surface requesting the activation. Note, this is
|
||||
different from the surface that will be activated.
|
||||
|
||||
Some compositors might refuse to activate toplevels when the token
|
||||
doesn't have a requesting surface.
|
||||
|
||||
Must be sent before commit. This information is optional.
|
||||
</description>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="the requesting surface"/>
|
||||
</request>
|
||||
|
||||
<request name="commit">
|
||||
<description summary="issues the token request">
|
||||
Requests an activation token based on the different parameters that
|
||||
have been offered through set_serial, set_surface and set_app_id.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="done">
|
||||
<description summary="the exported activation token">
|
||||
The 'done' event contains the unique token of this activation request
|
||||
and notifies that the provider is done.
|
||||
</description>
|
||||
<arg name="token" type="string" summary="the exported activation token"/>
|
||||
</event>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the xdg_activation_token_v1 object">
|
||||
Notify the compositor that the xdg_activation_token_v1 object will no
|
||||
longer be used. The received token stays valid.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
156
deps/wayland/xdg-decoration-unstable-v1.xml
vendored
Normal file
156
deps/wayland/xdg-decoration-unstable-v1.xml
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="xdg_decoration_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2018 Simon Ser
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zxdg_decoration_manager_v1" version="1">
|
||||
<description summary="window decoration manager">
|
||||
This interface allows a compositor to announce support for server-side
|
||||
decorations.
|
||||
|
||||
A window decoration is a set of window controls as deemed appropriate by
|
||||
the party managing them, such as user interface components used to move,
|
||||
resize and change a window's state.
|
||||
|
||||
A client can use this protocol to request being decorated by a supporting
|
||||
compositor.
|
||||
|
||||
If compositor and client do not negotiate the use of a server-side
|
||||
decoration using this protocol, clients continue to self-decorate as they
|
||||
see fit.
|
||||
|
||||
Warning! The protocol described in this file is experimental and
|
||||
backward incompatible changes may be made. Backward compatible changes
|
||||
may be added together with the corresponding interface version bump.
|
||||
Backward incompatible changes are done by bumping the version number in
|
||||
the protocol and interface names and resetting the interface version.
|
||||
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
version number in the protocol and interface names are removed and the
|
||||
interface version number is reset.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the decoration manager object">
|
||||
Destroy the decoration manager. This doesn't destroy objects created
|
||||
with the manager.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="get_toplevel_decoration">
|
||||
<description summary="create a new toplevel decoration object">
|
||||
Create a new decoration object associated with the given toplevel.
|
||||
|
||||
Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
|
||||
buffer attached or committed is a client error, and any attempts by a
|
||||
client to attach or manipulate a buffer prior to the first
|
||||
xdg_toplevel_decoration.configure event must also be treated as
|
||||
errors.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
|
||||
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zxdg_toplevel_decoration_v1" version="1">
|
||||
<description summary="decoration object for a toplevel surface">
|
||||
The decoration object allows the compositor to toggle server-side window
|
||||
decorations for a toplevel surface. The client can request to switch to
|
||||
another mode.
|
||||
|
||||
The xdg_toplevel_decoration object must be destroyed before its
|
||||
xdg_toplevel.
|
||||
</description>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="unconfigured_buffer" value="0"
|
||||
summary="xdg_toplevel has a buffer attached before configure"/>
|
||||
<entry name="already_constructed" value="1"
|
||||
summary="xdg_toplevel already has a decoration object"/>
|
||||
<entry name="orphaned" value="2"
|
||||
summary="xdg_toplevel destroyed before the decoration object"/>
|
||||
</enum>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the decoration object">
|
||||
Switch back to a mode without any server-side decorations at the next
|
||||
commit.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<enum name="mode">
|
||||
<description summary="window decoration modes">
|
||||
These values describe window decoration modes.
|
||||
</description>
|
||||
<entry name="client_side" value="1"
|
||||
summary="no server-side window decoration"/>
|
||||
<entry name="server_side" value="2"
|
||||
summary="server-side window decoration"/>
|
||||
</enum>
|
||||
|
||||
<request name="set_mode">
|
||||
<description summary="set the decoration mode">
|
||||
Set the toplevel surface decoration mode. This informs the compositor
|
||||
that the client prefers the provided decoration mode.
|
||||
|
||||
After requesting a decoration mode, the compositor will respond by
|
||||
emitting an xdg_surface.configure event. The client should then update
|
||||
its content, drawing it without decorations if the received mode is
|
||||
server-side decorations. The client must also acknowledge the configure
|
||||
when committing the new content (see xdg_surface.ack_configure).
|
||||
|
||||
The compositor can decide not to use the client's mode and enforce a
|
||||
different mode instead.
|
||||
|
||||
Clients whose decoration mode depend on the xdg_toplevel state may send
|
||||
a set_mode request in response to an xdg_surface.configure event and wait
|
||||
for the next xdg_surface.configure event to prevent unwanted state.
|
||||
Such clients are responsible for preventing configure loops and must
|
||||
make sure not to send multiple successive set_mode requests with the
|
||||
same decoration mode.
|
||||
</description>
|
||||
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||
</request>
|
||||
|
||||
<request name="unset_mode">
|
||||
<description summary="unset the decoration mode">
|
||||
Unset the toplevel surface decoration mode. This informs the compositor
|
||||
that the client doesn't prefer a particular decoration mode.
|
||||
|
||||
This request has the same semantics as set_mode.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="configure">
|
||||
<description summary="suggest a surface change">
|
||||
The configure event asks the client to change its decoration mode. The
|
||||
configured state should not be applied immediately. Clients must send an
|
||||
ack_configure in response to this event. See xdg_surface.configure and
|
||||
xdg_surface.ack_configure for details.
|
||||
|
||||
A configure event can be sent at any time. The specified mode must be
|
||||
obeyed by the client.
|
||||
</description>
|
||||
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
1370
deps/wayland/xdg-shell.xml
vendored
Normal file
1370
deps/wayland/xdg-shell.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,20 +2,20 @@
|
||||
# NOTE: The order of this list determines the order of items in the Guides
|
||||
# (i.e. Pages) list in the generated documentation
|
||||
set(source_files
|
||||
main.dox
|
||||
news.dox
|
||||
quick.dox
|
||||
moving.dox
|
||||
compile.dox
|
||||
build.dox
|
||||
intro.dox
|
||||
context.dox
|
||||
monitor.dox
|
||||
window.dox
|
||||
input.dox
|
||||
vulkan.dox
|
||||
compat.dox
|
||||
internal.dox)
|
||||
main.md
|
||||
news.md
|
||||
quick.md
|
||||
moving.md
|
||||
compile.md
|
||||
build.md
|
||||
intro.md
|
||||
context.md
|
||||
monitor.md
|
||||
window.md
|
||||
input.md
|
||||
vulkan.md
|
||||
compat.md
|
||||
internal.md)
|
||||
|
||||
set(extra_files DoxygenLayout.xml header.html footer.html extra.css spaces.svg)
|
||||
|
||||
@ -31,16 +31,27 @@ foreach(file IN LISTS source_files)
|
||||
string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"")
|
||||
endforeach()
|
||||
|
||||
configure_file(Doxyfile.in Doxyfile @ONLY)
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
|
||||
add_custom_command(OUTPUT "html/index.html"
|
||||
COMMAND "${DOXYGEN_EXECUTABLE}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
MAIN_DEPENDENCY Doxyfile
|
||||
DEPENDS ${header_paths} ${source_files} ${extra_files}
|
||||
COMMENT "Generating HTML documentation"
|
||||
VERBATIM)
|
||||
if (NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS "1.9.8")
|
||||
message(STATUS "Documentation generation requires Doxygen 1.9.8 or later")
|
||||
else()
|
||||
configure_file(Doxyfile.in Doxyfile @ONLY)
|
||||
add_custom_command(OUTPUT "html/index.html"
|
||||
COMMAND "${DOXYGEN_EXECUTABLE}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
MAIN_DEPENDENCY Doxyfile
|
||||
DEPENDS ${header_paths} ${source_files} ${extra_files}
|
||||
COMMENT "Generating HTML documentation"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(docs ALL SOURCES "html/index.html")
|
||||
set_target_properties(docs PROPERTIES FOLDER "GLFW3")
|
||||
add_custom_target(docs ALL SOURCES "html/index.html")
|
||||
set_target_properties(docs PROPERTIES FOLDER "GLFW3")
|
||||
|
||||
if (GLFW_INSTALL)
|
||||
install(DIRECTORY "${GLFW_BINARY_DIR}/docs/html"
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -23,13 +23,12 @@ Questions about how to use GLFW should be asked either in the [support
|
||||
section](https://discourse.glfw.org/c/support) of the forum, under the [Stack
|
||||
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
||||
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
||||
Stack Exchange or in the IRC channel `#glfw` on
|
||||
[Libera.Chat](https://libera.chat/).
|
||||
Stack Exchange.
|
||||
|
||||
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
|
||||
forum or in the IRC channel. Please don't open a GitHub issue to discuss design
|
||||
questions without first checking with a maintainer.
|
||||
forum. Please don't open a GitHub issue to discuss design questions without
|
||||
first checking with a maintainer.
|
||||
|
||||
|
||||
## Reporting a bug
|
||||
@ -327,7 +326,7 @@ a thousand line one, if that is the appropriate size for the fix.
|
||||
In addition to the code, a complete bug fix includes:
|
||||
|
||||
- Change log entry in `README.md`, describing the incorrect behavior
|
||||
- Credits entries for all authors of the bug fix
|
||||
- Credits entries in `CONTRIBUTORS.md` for all authors of the bug fix
|
||||
|
||||
Bug fixes will not be rejected because they don't include all the above parts,
|
||||
but please keep in mind that maintainer time is finite and that there are many
|
||||
@ -358,11 +357,11 @@ feature.
|
||||
In addition to the code, a complete feature includes:
|
||||
|
||||
- Change log entry in `README.md`, listing all new symbols
|
||||
- News page entry, briefly describing the feature
|
||||
- Guide documentation, with minimal examples, in the relevant guide
|
||||
- News page entry in `docs/news.md`, briefly describing the feature
|
||||
- Guide documentation, with minimal examples, in the relevant guide in the `docs` folder
|
||||
- Reference documentation, with all applicable tags
|
||||
- Cross-references and mentions in appropriate places
|
||||
- Credits entries for all authors of the feature
|
||||
- Credits entries in `CONTRIBUTORS.md` for all authors of the feature
|
||||
|
||||
If the feature requires platform-specific code, at minimum stubs must be added
|
||||
for the new platform function to all supported and experimental platforms.
|
||||
@ -374,7 +373,7 @@ If it adds a new monitor property, support for it must be added to
|
||||
|
||||
If it adds a new OpenGL, OpenGL ES or Vulkan option or extension, support
|
||||
for it must be added to `tests/glfwinfo.c` and the behavior of the library when
|
||||
the extension is missing documented in `docs/compat.dox`.
|
||||
the extension is missing documented in `docs/compat.md`.
|
||||
|
||||
If you haven't already, read the excellent article [How to Write a Git Commit
|
||||
Message](https://chris.beams.io/posts/git-commit/).
|
||||
|
180
docs/Doxyfile.in
180
docs/Doxyfile.in
@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.9.5
|
||||
# Doxyfile 1.9.7
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@ -86,7 +86,7 @@ CREATE_SUBDIRS = NO
|
||||
# level increment doubles the number of directories, resulting in 4096
|
||||
# directories at level 8 which is the default and also the maximum value. The
|
||||
# sub-directories are organized in 2 levels, the first level always has a fixed
|
||||
# numer of 16 directories.
|
||||
# number of 16 directories.
|
||||
# Minimum value: 0, maximum value: 8, default value: 8.
|
||||
# This tag requires that the tag CREATE_SUBDIRS is set to YES.
|
||||
|
||||
@ -364,6 +364,17 @@ MARKDOWN_SUPPORT = YES
|
||||
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
|
||||
# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to
|
||||
# generate identifiers for the Markdown headings. Note: Every identifier is
|
||||
# unique.
|
||||
# Possible values are: DOXYGEN Use a fixed 'autotoc_md' string followed by a
|
||||
# sequence number starting at 0. and GITHUB Use the lower case version of title
|
||||
# with any whitespace replaced by '-' and punctations characters removed..
|
||||
# The default value is: DOXYGEN.
|
||||
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
|
||||
|
||||
MARKDOWN_ID_STYLE = DOXYGEN
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented
|
||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||
# be prevented in individual cases by putting a % sign in front of the word or
|
||||
@ -404,7 +415,7 @@ SIP_SUPPORT = NO
|
||||
# should set this option to NO.
|
||||
# The default value is: YES.
|
||||
|
||||
IDL_PROPERTY_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
|
||||
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
||||
# tag is set to YES then doxygen will reuse the documentation of the first
|
||||
@ -488,6 +499,14 @@ LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
NUM_PROC_THREADS = 1
|
||||
|
||||
# If the TIMESTAMP tag is set different from NO then each generated page will
|
||||
# contain the date or date and time when the page was generated. Setting this to
|
||||
# NO can help when comparing the output of multiple runs.
|
||||
# Possible values are: YES, NO, DATETIME and DATE.
|
||||
# The default value is: NO.
|
||||
|
||||
TIMESTAMP = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@ -569,7 +588,8 @@ HIDE_UNDOC_MEMBERS = NO
|
||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
|
||||
# undocumented classes that are normally visible in the class hierarchy. If set
|
||||
# to NO, these classes will be included in the various overviews. This option
|
||||
# has no effect if EXTRACT_ALL is enabled.
|
||||
# will also hide undocumented C++ concepts if enabled. This option has no effect
|
||||
# if EXTRACT_ALL is enabled.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
@ -860,11 +880,26 @@ WARN_IF_INCOMPLETE_DOC = YES
|
||||
|
||||
WARN_NO_PARAMDOC = YES
|
||||
|
||||
# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about
|
||||
# undocumented enumeration values. If set to NO, doxygen will accept
|
||||
# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag
|
||||
# will automatically be disabled.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_IF_UNDOC_ENUM_VAL = NO
|
||||
|
||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
||||
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
||||
# at the end of the doxygen process doxygen will return with a non-zero status.
|
||||
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
||||
# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves
|
||||
# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not
|
||||
# write the warning messages in between other messages but write them at the end
|
||||
# of a run, in case a WARN_LOGFILE is defined the warning messages will be
|
||||
# besides being in the defined file also be shown at the end of a run, unless
|
||||
# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case
|
||||
# the behavior will remain as with the setting FAIL_ON_WARNINGS.
|
||||
# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
@ -987,9 +1022,6 @@ EXCLUDE_PATTERNS =
|
||||
# output. The symbol name can be a fully qualified name, a word, or if the
|
||||
# wildcard * is used, a substring. Examples: ANamespace, AClass,
|
||||
# ANamespace::AClass, ANamespace::*Test
|
||||
#
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories use the pattern */test/*
|
||||
|
||||
EXCLUDE_SYMBOLS = APIENTRY GLFWAPI
|
||||
|
||||
@ -1186,10 +1218,11 @@ VERBATIM_HEADERS = YES
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
# 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. The IGNORE_PREFIX tag
|
||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||
# while generating the index headers.
|
||||
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
|
||||
# that should be ignored while generating the index headers. The IGNORE_PREFIX
|
||||
# tag works for classes, function and member names. The entity will be placed in
|
||||
# the alphabetical list under the first letter of the entity name that remains
|
||||
# after removing the prefix.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
IGNORE_PREFIX = glfw GLFW_
|
||||
@ -1268,7 +1301,12 @@ HTML_STYLESHEET =
|
||||
# Doxygen will copy the style sheet files to the output directory.
|
||||
# Note: The order of the extra style sheet files is of importance (e.g. the last
|
||||
# style sheet in the list overrules the setting of the previous ones in the
|
||||
# list). For an example see the documentation.
|
||||
# list).
|
||||
# Note: Since the styling of scrollbars can currently not be overruled in
|
||||
# Webkit/Chromium, the styling will be left out of the default doxygen.css if
|
||||
# one or more extra stylesheets have been specified. So if scrollbar
|
||||
# customization is desired it has to be added explicitly. For an example see the
|
||||
# documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css"
|
||||
@ -1284,17 +1322,13 @@ HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css"
|
||||
HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg"
|
||||
|
||||
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
|
||||
# should be rendered with a dark or light theme. Default setting AUTO_LIGHT
|
||||
# enables light output unless the user preference is dark output. Other options
|
||||
# are DARK to always use dark mode, LIGHT to always use light mode, AUTO_DARK to
|
||||
# default to dark mode unless the user prefers light mode, and TOGGLE to let the
|
||||
# user toggle between dark and light mode via a button.
|
||||
# Possible values are: LIGHT Always generate light output., DARK Always generate
|
||||
# dark output., AUTO_LIGHT Automatically set the mode according to the user
|
||||
# preference, use light mode if no preference is set (the default)., AUTO_DARK
|
||||
# Automatically set the mode according to the user preference, use dark mode if
|
||||
# no preference is set. and TOGGLE Allow to user to switch between light and
|
||||
# dark mode via a button..
|
||||
# should be rendered with a dark or light theme.
|
||||
# Possible values are: LIGHT always generate light mode output, DARK always
|
||||
# generate dark mode output, AUTO_LIGHT automatically set the mode according to
|
||||
# the user preference, use light mode if no preference is set (the default),
|
||||
# AUTO_DARK automatically set the mode according to the user preference, use
|
||||
# dark mode if no preference is set and TOGGLE allow to user to switch between
|
||||
# light and dark mode via a button.
|
||||
# The default value is: AUTO_LIGHT.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
@ -1330,15 +1364,6 @@ HTML_COLORSTYLE_SAT = 100
|
||||
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
|
||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to YES can help to show when doxygen was last run and thus if the
|
||||
# documentation is up to date.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = YES
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via JavaScript. If disabled, the navigation index will
|
||||
@ -1488,6 +1513,16 @@ BINARY_TOC = NO
|
||||
|
||||
TOC_EXPAND = NO
|
||||
|
||||
# The SITEMAP_URL tag is used to specify the full URL of the place where the
|
||||
# generated documentation will be placed on the server by the user during the
|
||||
# deployment of the documentation. The generated sitemap is called sitemap.xml
|
||||
# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL
|
||||
# is specified no sitemap is generated. For information about the sitemap
|
||||
# protocol see https://www.sitemaps.org
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
SITEMAP_URL =
|
||||
|
||||
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
|
||||
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
|
||||
# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
|
||||
@ -1627,7 +1662,7 @@ ENUM_VALUES_PER_LINE = 4
|
||||
# Minimum value: 0, maximum value: 1500, default value: 250.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
TREEVIEW_WIDTH = 300
|
||||
TREEVIEW_WIDTH = 250
|
||||
|
||||
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
|
||||
# external symbols imported via tag files in a separate window.
|
||||
@ -1976,9 +2011,16 @@ PDF_HYPERLINKS = YES
|
||||
|
||||
USE_PDFLATEX = YES
|
||||
|
||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
|
||||
# command to the generated LaTeX files. This will instruct LaTeX to keep running
|
||||
# if errors occur, instead of asking the user for help.
|
||||
# The LATEX_BATCHMODE tag ignals the behavior of LaTeX in case of an error.
|
||||
# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch
|
||||
# mode nothing is printed on the terminal, errors are scrolled as if <return> is
|
||||
# hit at every error; missing files that TeX tries to input or request from
|
||||
# keyboard input (\read on a not open input stream) cause the job to abort,
|
||||
# NON_STOP In nonstop mode the diagnostic message will appear on the terminal,
|
||||
# but there is no possibility of user interaction just like in batch mode,
|
||||
# SCROLL In scroll mode, TeX will stop only for missing files to input or if
|
||||
# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at
|
||||
# each error, asking for user intervention.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@ -1999,14 +2041,6 @@ LATEX_HIDE_INDICES = NO
|
||||
|
||||
LATEX_BIB_STYLE = plain
|
||||
|
||||
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to NO can help when comparing the output of multiple runs.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_TIMESTAMP = NO
|
||||
|
||||
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# path from which the emoji images will be read. If a relative path is entered,
|
||||
# it will be relative to the LATEX_OUTPUT directory. If left blank the
|
||||
@ -2172,7 +2206,7 @@ DOCBOOK_OUTPUT = docbook
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
|
||||
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
|
||||
# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures
|
||||
# the structure of the code including all documentation. Note that this feature
|
||||
# is still experimental and incomplete at the moment.
|
||||
# The default value is: NO.
|
||||
@ -2353,16 +2387,9 @@ EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
# Configuration options related to diagram generator tools
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
DIA_PATH =
|
||||
|
||||
# If set to YES the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
# The default value is: YES.
|
||||
@ -2371,7 +2398,7 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||
# available from the path. This tool is part of Graphviz (see:
|
||||
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# Bell Labs. The other options in this section have no effect if this option is
|
||||
# set to NO
|
||||
# The default value is: NO.
|
||||
@ -2424,13 +2451,15 @@ DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
|
||||
|
||||
DOT_FONTPATH =
|
||||
|
||||
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect inheritance
|
||||
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
|
||||
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
|
||||
# to TEXT the direct and indirect inheritance relations will be shown as texts /
|
||||
# links.
|
||||
# Possible values are: NO, YES, TEXT and GRAPH.
|
||||
# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will
|
||||
# generate a graph for each documented class showing the direct and indirect
|
||||
# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and
|
||||
# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case
|
||||
# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the
|
||||
# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used.
|
||||
# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance
|
||||
# relations will be shown as texts / links.
|
||||
# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN.
|
||||
# The default value is: YES.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
@ -2571,7 +2600,7 @@ DIR_GRAPH_MAX_DEPTH = 1
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. For an explanation of the image formats see the section
|
||||
# output formats in the documentation of the dot tool (Graphviz (see:
|
||||
# http://www.graphviz.org/)).
|
||||
# https://www.graphviz.org/)).
|
||||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
||||
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
||||
# requirement).
|
||||
@ -2608,11 +2637,12 @@ DOT_PATH =
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
MSCFILE_DIRS =
|
||||
DIA_PATH =
|
||||
|
||||
# The DIAFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dia files that are included in the documentation (see the \diafile
|
||||
@ -2689,3 +2719,19 @@ GENERATE_LEGEND = YES
|
||||
# The default value is: YES.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will
|
||||
# use a built-in version of mscgen tool to produce the charts. Alternatively,
|
||||
# the MSCGEN_TOOL tag can also specify the name an external tool. For instance,
|
||||
# specifying prog as the value, doxygen will call the tool as prog -T
|
||||
# <outfile_format> -o <outputfile> <inputfile>. The external tool should support
|
||||
# output file formats "png", "eps", "svg", and "ismap".
|
||||
|
||||
MSCGEN_TOOL =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
|
||||
MSCFILE_DIRS =
|
||||
|
@ -5,7 +5,7 @@
|
||||
<tab type="mainpage" visible="yes" title="Introduction"/>
|
||||
<tab type="user" url="quick_guide.html" title="Tutorial"/>
|
||||
<tab type="pages" visible="yes" title="Guides" intro=""/>
|
||||
<tab type="modules" visible="yes" title="Reference" intro=""/>
|
||||
<tab type="topics" visible="yes" title="Reference" intro=""/>
|
||||
<tab type="filelist" visible="yes" title="Files"/>
|
||||
</navindex>
|
||||
|
||||
|
@ -4,8 +4,7 @@ See the [latest documentation](https://www.glfw.org/docs/latest/) for tutorials,
|
||||
guides and the API reference.
|
||||
|
||||
If you have questions about using GLFW, we have a
|
||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||
[Libera.Chat](https://libera.chat/).
|
||||
[forum](https://discourse.glfw.org/).
|
||||
|
||||
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
||||
Please check the [contribution
|
||||
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Building applications {#build_guide}
|
||||
|
||||
@page build_guide Building applications
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This is about compiling and linking applications that use GLFW. For information on
|
||||
how to write such applications, start with the
|
||||
@ -16,14 +14,14 @@ and linking process should be explained in your C programming material and in
|
||||
the documentation for your development environment.
|
||||
|
||||
|
||||
@section build_include Including the GLFW header file
|
||||
## Including the GLFW header file {#build_include}
|
||||
|
||||
You should include the GLFW header in the source files where you use OpenGL or
|
||||
GLFW.
|
||||
|
||||
@code
|
||||
```c
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
This header defines all the constants and declares all the types and function
|
||||
prototypes of the GLFW API. By default, it also includes the OpenGL header from
|
||||
@ -43,17 +41,18 @@ In other words:
|
||||
- Do not include window system headers unless you will use those APIs directly
|
||||
- If you do need such headers, include them before the GLFW header
|
||||
|
||||
If you are using an OpenGL extension loading library such as
|
||||
[glad](https://github.com/Dav1dde/glad), the extension loader header should
|
||||
be included before the GLFW one. GLFW attempts to detect any OpenGL or OpenGL
|
||||
ES header or extension loader header included before it and will then disable
|
||||
the inclusion of the default OpenGL header. Most extension loaders also define
|
||||
macros that disable similar headers below it.
|
||||
If you are using an OpenGL extension loading library such as [glad][], the
|
||||
extension loader header should be included before the GLFW one. GLFW attempts
|
||||
to detect any OpenGL or OpenGL ES header or extension loader header included
|
||||
before it and will then disable the inclusion of the default OpenGL header.
|
||||
Most extension loaders also define macros that disable similar headers below it.
|
||||
|
||||
@code
|
||||
[glad]: https://github.com/Dav1dde/glad
|
||||
|
||||
```c
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
Both of these mechanisms depend on the extension loader header defining a known
|
||||
macro. If yours doesn't or you don't know which one your users will pick, the
|
||||
@ -61,14 +60,14 @@ macro. If yours doesn't or you don't know which one your users will pick, the
|
||||
including the OpenGL header. This will also allow you to include the two
|
||||
headers in any order.
|
||||
|
||||
@code
|
||||
```c
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glad/gl.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection build_macros GLFW header option macros
|
||||
### GLFW header option macros {#build_macros}
|
||||
|
||||
These macros may be defined before the inclusion of the GLFW header and affect
|
||||
its behavior.
|
||||
@ -82,8 +81,9 @@ Only one of these may be defined at a time.
|
||||
|
||||
@note GLFW does not provide any of the API headers mentioned below. They are
|
||||
provided by your development environment or your OpenGL, OpenGL ES or Vulkan
|
||||
SDK, and most of them can be downloaded from the
|
||||
[Khronos Registry](https://www.khronos.org/registry/).
|
||||
SDK, and most of them can be downloaded from the [Khronos Registry][registry].
|
||||
|
||||
[registry]: https://www.khronos.org/registry/
|
||||
|
||||
@anchor GLFW_INCLUDE_GLCOREARB
|
||||
__GLFW_INCLUDE_GLCOREARB__ makes the GLFW header include the modern
|
||||
@ -142,7 +142,7 @@ If your build includes GLFW and you define any these in your build files, make
|
||||
sure they are not applied to the GLFW sources.
|
||||
|
||||
|
||||
@section build_link Link with the right libraries
|
||||
## Link with the right libraries {#build_link}
|
||||
|
||||
GLFW is essentially a wrapper of various platform-specific APIs and therefore
|
||||
needs to link against many different system libraries. If you are using GLFW as
|
||||
@ -155,12 +155,13 @@ hard-coded into your build environment. See the section for your development
|
||||
environment below. On Linux and other Unix-like operating systems, the list
|
||||
varies but can be retrieved in various ways as described below.
|
||||
|
||||
A good general introduction to linking is
|
||||
[Beginner's Guide to Linkers](https://www.lurklurk.org/linkers/linkers.html) by
|
||||
David Drysdale.
|
||||
A good general introduction to linking is [Beginner's Guide to
|
||||
Linkers][linker_guide] by David Drysdale.
|
||||
|
||||
[linker_guide]: https://www.lurklurk.org/linkers/linkers.html
|
||||
|
||||
|
||||
@subsection build_link_win32 With MinGW or Visual C++ on Windows
|
||||
### With MinGW or Visual C++ on Windows {#build_link_win32}
|
||||
|
||||
The static version of the GLFW library is named `glfw3`. When using this
|
||||
version, it is also necessary to link with some libraries that GLFW uses.
|
||||
@ -176,7 +177,7 @@ GLFW_DLL macro _before_ any inclusion of the GLFW header. This can be done
|
||||
either with a compiler switch or by defining it in your source code.
|
||||
|
||||
|
||||
@subsection build_link_cmake_source With CMake and GLFW source
|
||||
### With CMake and GLFW source {#build_link_cmake_source}
|
||||
|
||||
This section is about using CMake to compile and link GLFW along with your
|
||||
application. If you want to use an installed binary instead, see @ref
|
||||
@ -188,18 +189,18 @@ built along with your application.
|
||||
Add the root directory of the GLFW source tree to your project. This will add
|
||||
the `glfw` target to your project.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
add_subdirectory(path/to/glfw)
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once GLFW has been added, link your application against the `glfw` target.
|
||||
This adds the GLFW library and its link-time dependencies as it is currently
|
||||
configured, the include directory for the GLFW header and, when applicable, the
|
||||
@ref GLFW_DLL macro.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
target_link_libraries(myapp glfw)
|
||||
@endcode
|
||||
```
|
||||
|
||||
Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL,
|
||||
OpenGL ES or Vulkan libraries it needs at runtime. If your application calls
|
||||
@ -207,22 +208,24 @@ OpenGL directly, instead of using a modern
|
||||
[extension loader library](@ref context_glext_auto), use the OpenGL CMake
|
||||
package.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
find_package(OpenGL REQUIRED)
|
||||
@endcode
|
||||
```
|
||||
|
||||
If OpenGL is found, the `OpenGL::GL` target is added to your project, containing
|
||||
library and include directory paths. Link against this like any other library.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
target_link_libraries(myapp OpenGL::GL)
|
||||
@endcode
|
||||
```
|
||||
|
||||
For a minimal example of a program and GLFW sources built with CMake, see the
|
||||
[GLFW CMake Starter](https://github.com/juliettef/GLFW-CMake-starter) on GitHub.
|
||||
[GLFW CMake Starter][cmake_starter] on GitHub.
|
||||
|
||||
[cmake_starter]: https://github.com/juliettef/GLFW-CMake-starter
|
||||
|
||||
|
||||
@subsection build_link_cmake_package With CMake and installed GLFW binaries
|
||||
### With CMake and installed GLFW binaries {#build_link_cmake_package}
|
||||
|
||||
This section is about using CMake to link GLFW after it has been built and
|
||||
installed. If you want to build it along with your application instead, see
|
||||
@ -231,17 +234,17 @@ installed. If you want to build it along with your application instead, see
|
||||
With a few changes to your `CMakeLists.txt` you can locate the package and
|
||||
target files generated when GLFW is installed.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
find_package(glfw3 3.4 REQUIRED)
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once GLFW has been added to the project, link against it with the `glfw` target.
|
||||
This adds the GLFW library and its link-time dependencies, the include directory
|
||||
for the GLFW header and, when applicable, the @ref GLFW_DLL macro.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
target_link_libraries(myapp glfw)
|
||||
@endcode
|
||||
```
|
||||
|
||||
Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL,
|
||||
OpenGL ES or Vulkan libraries it needs at runtime. If your application calls
|
||||
@ -249,47 +252,48 @@ OpenGL directly, instead of using a modern
|
||||
[extension loader library](@ref context_glext_auto), use the OpenGL CMake
|
||||
package.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
find_package(OpenGL REQUIRED)
|
||||
@endcode
|
||||
```
|
||||
|
||||
If OpenGL is found, the `OpenGL::GL` target is added to your project, containing
|
||||
library and include directory paths. Link against this like any other library.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
target_link_libraries(myapp OpenGL::GL)
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection build_link_pkgconfig With makefiles and pkg-config on Unix
|
||||
### With makefiles and pkg-config on Unix {#build_link_pkgconfig}
|
||||
|
||||
GLFW supports [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/),
|
||||
and the `glfw3.pc` pkg-config file is generated when the GLFW library is built
|
||||
and is installed along with it. A pkg-config file describes all necessary
|
||||
compile-time and link-time flags and dependencies needed to use a library. When
|
||||
they are updated or if they differ between systems, you will get the correct
|
||||
ones automatically.
|
||||
GLFW supports [pkg-config][], and the `glfw3.pc` pkg-config file is generated
|
||||
when the GLFW library is built and is installed along with it. A pkg-config
|
||||
file describes all necessary compile-time and link-time flags and dependencies
|
||||
needed to use a library. When they are updated or if they differ between
|
||||
systems, you will get the correct ones automatically.
|
||||
|
||||
[pkg-config]: https://www.freedesktop.org/wiki/Software/pkg-config/
|
||||
|
||||
A typical compile and link command-line when using the static version of the
|
||||
GLFW library may look like this:
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --static --libs glfw3)
|
||||
@endcode
|
||||
```
|
||||
|
||||
If you are using the shared version of the GLFW library, omit the `--static`
|
||||
flag.
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3)
|
||||
@endcode
|
||||
```
|
||||
|
||||
You can also use the `glfw3.pc` file without installing it first, by using the
|
||||
`PKG_CONFIG_PATH` environment variable.
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
env PKG_CONFIG_PATH=path/to/glfw/src cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3)
|
||||
@endcode
|
||||
```
|
||||
|
||||
The dependencies do not include OpenGL, as GLFW loads any OpenGL, OpenGL ES or
|
||||
Vulkan libraries it needs at runtime. If your application calls OpenGL
|
||||
@ -297,12 +301,12 @@ directly, instead of using a modern
|
||||
[extension loader library](@ref context_glext_auto), you should add the `gl`
|
||||
pkg-config package.
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
cc $(pkg-config --cflags glfw3 gl) -o myprog myprog.c $(pkg-config --libs glfw3 gl)
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection build_link_xcode With Xcode on macOS
|
||||
### With Xcode on macOS {#build_link_xcode}
|
||||
|
||||
If you are using the dynamic library version of GLFW, add it to the project
|
||||
dependencies.
|
||||
@ -312,7 +316,7 @@ OpenGL and IOKit frameworks to the project as dependencies. They can all be
|
||||
found in `/System/Library/Frameworks`.
|
||||
|
||||
|
||||
@subsection build_link_osx With command-line on macOS
|
||||
### With command-line on macOS {#build_link_osx}
|
||||
|
||||
It is recommended that you use [pkg-config](@ref build_link_pkgconfig) when
|
||||
building from the command line on macOS. That way you will get any new
|
||||
@ -322,9 +326,9 @@ the `-l` and `-framework` switches.
|
||||
|
||||
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
|
||||
@endcode
|
||||
```
|
||||
|
||||
If you are using the static library, named `libglfw3.a`, substitute `-lglfw3`
|
||||
for `-lglfw`.
|
||||
@ -335,4 +339,3 @@ against it from the command-line.
|
||||
@note Your machine may have `libGL.*.dylib` style OpenGL library, but that is
|
||||
for the X Window System and will not work with the macOS native version of GLFW.
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Standards conformance {#compat_guide}
|
||||
|
||||
@page compat_guide Standards conformance
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide describes the various API extensions used by this version of GLFW.
|
||||
It lists what are essentially implementation details, but which are nonetheless
|
||||
@ -15,18 +13,18 @@ part of this information may change in future versions of GLFW and that will not
|
||||
be considered a breaking API change.
|
||||
|
||||
|
||||
@section compat_x11 X11 extensions, protocols and IPC standards
|
||||
## X11 extensions, protocols and IPC standards {#compat_x11}
|
||||
|
||||
As GLFW uses Xlib directly, without any intervening toolkit
|
||||
library, it has sole responsibility for interacting well with the many and
|
||||
varied window managers in use on Unix-like systems. In order for applications
|
||||
and window managers to work well together, a number of standards and
|
||||
conventions have been developed that regulate behavior outside the scope of the
|
||||
X11 API; most importantly the
|
||||
[Inter-Client Communication Conventions Manual](https://www.tronche.com/gui/x/icccm/)
|
||||
(ICCCM) and
|
||||
[Extended Window Manager Hints](https://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
|
||||
(EWMH) standards.
|
||||
As GLFW uses Xlib directly, without any intervening toolkit library, it has sole
|
||||
responsibility for interacting well with the many and varied window managers in
|
||||
use on Unix-like systems. In order for applications and window managers to work
|
||||
well together, a number of standards and conventions have been developed that
|
||||
regulate behavior outside the scope of the X11 API; most importantly the
|
||||
[Inter-Client Communication Conventions Manual][ICCCM] (ICCCM) and [Extended
|
||||
Window Manager Hints][EWMH] (EWMH) standards.
|
||||
|
||||
[ICCCM]: https://www.tronche.com/gui/x/icccm/
|
||||
[EWMH]: https://standards.freedesktop.org/wm-spec/wm-spec-latest.html
|
||||
|
||||
GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows.
|
||||
If the running window manager does not support this property, the
|
||||
@ -52,16 +50,18 @@ compositing window manager to un-redirect full screen GLFW windows. If the
|
||||
running window manager uses compositing but does not support this property then
|
||||
additional copying may be performed for each buffer swap of full screen windows.
|
||||
|
||||
GLFW uses the
|
||||
[clipboard manager protocol](https://www.freedesktop.org/wiki/ClipboardManager/)
|
||||
to push a clipboard string (i.e. selection) owned by a GLFW window about to be
|
||||
destroyed to the clipboard manager. If there is no running clipboard manager,
|
||||
the clipboard string will be unavailable once the window has been destroyed.
|
||||
GLFW uses the [clipboard manager protocol][ClipboardManager] to push a clipboard
|
||||
string (i.e. selection) owned by a GLFW window about to be destroyed to the
|
||||
clipboard manager. If there is no running clipboard manager, the clipboard
|
||||
string will be unavailable once the window has been destroyed.
|
||||
|
||||
GLFW uses the
|
||||
[X drag-and-drop protocol](https://www.freedesktop.org/wiki/Specifications/XDND/)
|
||||
to provide file drop events. If the application originating the drag does not
|
||||
support this protocol, drag and drop will not work.
|
||||
[clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/
|
||||
|
||||
GLFW uses the [X drag-and-drop protocol][XDND] to provide file drop events. If
|
||||
the application originating the drag does not support this protocol, drag and
|
||||
drop will not work.
|
||||
|
||||
[XDND]: https://www.freedesktop.org/wiki/Specifications/XDND/
|
||||
|
||||
GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the
|
||||
running X server does not support this version of this extension, multi-monitor
|
||||
@ -93,64 +93,73 @@ conventions, the `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR` and
|
||||
legacy images.
|
||||
|
||||
|
||||
@section compat_wayland Wayland protocols and IPC standards
|
||||
## Wayland protocols and IPC standards {#compat_wayland}
|
||||
|
||||
As GLFW uses libwayland directly, without any intervening toolkit library, it
|
||||
has sole responsibility for interacting well with every compositor in use on
|
||||
Unix-like systems. Most of the features are provided by the core protocol,
|
||||
while cursor support is provided by the libwayland-cursor helper library, EGL
|
||||
integration by libwayland-egl, and keyboard handling by
|
||||
[libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some protocols
|
||||
from wayland-protocols to provide additional features if the compositor
|
||||
supports them.
|
||||
[libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some additional
|
||||
Wayland protocols to implement certain features if the compositor supports them.
|
||||
|
||||
GLFW uses xkbcommon 0.5.0 to provide key and text input support. Earlier
|
||||
versions are not supported.
|
||||
|
||||
GLFW uses the [xdg-shell
|
||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
|
||||
to provide better window management. This protocol is part of
|
||||
wayland-protocols 1.12, and is mandatory for GLFW to display a window.
|
||||
GLFW uses the [xdg-shell][] protocol to provide better window management. This
|
||||
protocol is mandatory for GLFW to display a window.
|
||||
|
||||
GLFW uses the [relative pointer
|
||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
|
||||
alongside the [pointer constraints
|
||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml)
|
||||
to implement disabled cursor. These two protocols are part of
|
||||
wayland-protocols 1.1, and mandatory at build time. If the running compositor
|
||||
does not support both of these protocols, disabling the cursor will have no
|
||||
effect.
|
||||
[xdg-shell]: https://wayland.app/protocols/xdg-shell
|
||||
|
||||
GLFW uses the [idle inhibit
|
||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml)
|
||||
to prohibit the screensaver from starting. This protocol is part of
|
||||
wayland-protocols 1.6, and mandatory at build time. If the running compositor
|
||||
does not support this protocol, the screensaver may start even for full screen
|
||||
windows.
|
||||
GLFW uses the [relative-pointer-unstable-v1][] protocol alongside the
|
||||
[pointer-constraints-unstable-v1][] protocol to implement disabled cursor. If
|
||||
the running compositor does not support both of these protocols, disabling the
|
||||
cursor will have no effect.
|
||||
|
||||
GLFW uses the [libdecor library](https://gitlab.freedesktop.org/libdecor/libdecor)
|
||||
for window decorations, where available. This in turn provides good quality
|
||||
client-side decorations (drawn by the application) on desktop systems that do
|
||||
not support server-side decorations (drawn by the window manager). On systems
|
||||
that do not provide either libdecor or xdg-decoration, very basic window
|
||||
decorations are provided. These do not include the window title or any caption
|
||||
buttons.
|
||||
[relative-pointer-unstable-v1]: https://wayland.app/protocols/relative-pointer-unstable-v1
|
||||
[pointer-constraints-unstable-v1]: https://wayland.app/protocols/pointer-constraints-unstable-v1
|
||||
|
||||
GLFW uses the [xdg-decoration
|
||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
|
||||
to request decorations to be drawn around its windows. This protocol is part
|
||||
of wayland-protocols 1.15, and mandatory at build time. If the running
|
||||
compositor does not support this protocol, a very simple frame will be drawn by
|
||||
GLFW itself, using the [viewporter
|
||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml)
|
||||
alongside
|
||||
[subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598).
|
||||
This protocol is part of wayland-protocols 1.4, and mandatory at build time.
|
||||
If the running compositor does not support this protocol either, no decorations
|
||||
will be drawn around windows.
|
||||
GLFW uses the [idle-inhibit-unstable-v1][] protocol to prohibit the screensaver
|
||||
from starting. If the running compositor does not support this protocol, the
|
||||
screensaver may start even for full screen windows.
|
||||
|
||||
[idle-inhibit-unstable-v1]: https://wayland.app/protocols/idle-inhibit-unstable-v1
|
||||
|
||||
GLFW uses the [libdecor][] library for window decorations, where available.
|
||||
This in turn provides good quality client-side decorations (drawn by the
|
||||
application) on desktop systems that do not support server-side decorations
|
||||
(drawn by the window manager). On systems that do not provide either libdecor
|
||||
or xdg-decoration, very basic window decorations are provided. These do not
|
||||
include the window title or any caption buttons.
|
||||
|
||||
[libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
|
||||
|
||||
GLFW uses the [xdg-decoration-unstable-v1][] protocol to request decorations to
|
||||
be drawn around its windows. This protocol is part of wayland-protocols 1.15,
|
||||
and mandatory at build time. If the running compositor does not support this
|
||||
protocol, a very simple frame will be drawn by GLFW itself, using the
|
||||
[viewporter][] protocol alongside subsurfaces. If the running compositor does
|
||||
not support these protocols either, no decorations will be drawn around windows.
|
||||
|
||||
[xdg-decoration-unstable-v1]: https://wayland.app/protocols/xdg-decoration-unstable-v1
|
||||
[viewporter]: https://wayland.app/protocols/viewporter
|
||||
|
||||
GLFW uses the [xdg-activation-v1][] protocol to implement window focus and
|
||||
attention requests. If the running compositor does not support this protocol,
|
||||
window focus and attention requests do nothing.
|
||||
|
||||
[xdg-activation-v1]: https://wayland.app/protocols/xdg-activation-v1
|
||||
|
||||
GLFW uses the [fractional-scale-v1][] protocol to implement fine-grained
|
||||
framebuffer scaling. If the running compositor does not support this protocol,
|
||||
the @ref GLFW_SCALE_FRAMEBUFFER window hint will only be able to scale the
|
||||
framebuffer by integer scales. This will typically be the smallest integer not
|
||||
less than the actual scale.
|
||||
|
||||
[fractional-scale-v1]: https://wayland.app/protocols/fractional-scale-v1
|
||||
|
||||
|
||||
@section compat_glx GLX extensions
|
||||
## GLX extensions {#compat_glx}
|
||||
|
||||
The GLX API is the default API used to create OpenGL contexts on Unix-like
|
||||
systems using the X Window System.
|
||||
@ -190,7 +199,7 @@ extensions to provide support for sRGB framebuffers. Where both of these
|
||||
extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
|
||||
|
||||
|
||||
@section compat_wgl WGL extensions
|
||||
## WGL extensions {#compat_wgl}
|
||||
|
||||
The WGL API is used to create OpenGL contexts on Microsoft Windows and other
|
||||
implementations of the Win32 API, such as Wine.
|
||||
@ -231,7 +240,7 @@ extensions to provide support for sRGB framebuffers. When both of these
|
||||
extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
|
||||
|
||||
|
||||
@section compat_osx OpenGL on macOS
|
||||
## OpenGL on macOS {#compat_osx}
|
||||
|
||||
Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then
|
||||
only forward-compatible, core profile contexts are supported. Support for
|
||||
@ -253,7 +262,7 @@ a non-default value will cause @ref glfwCreateWindow to fail and the
|
||||
`GLFW_CONTEXT_DEBUG` hint is ignored.
|
||||
|
||||
|
||||
@section compat_vulkan Vulkan loader and API
|
||||
## Vulkan loader and API {#compat_vulkan}
|
||||
|
||||
By default, GLFW uses the standard system-wide Vulkan loader to access the
|
||||
Vulkan API on all platforms except macOS. This is installed by both graphics
|
||||
@ -263,7 +272,7 @@ all other Vulkan-related functions will fail with an @ref GLFW_API_UNAVAILABLE
|
||||
error.
|
||||
|
||||
|
||||
@section compat_wsi Vulkan WSI extensions
|
||||
## Vulkan WSI extensions {#compat_wsi}
|
||||
|
||||
The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on
|
||||
all supported platforms.
|
||||
@ -289,4 +298,3 @@ surfaces on Wayland. If any of these extensions are not available, @ref
|
||||
glfwGetRequiredInstanceExtensions will return an empty list and window surface
|
||||
creation will fail.
|
||||
|
||||
*/
|
@ -1,14 +1,14 @@
|
||||
/*!
|
||||
# Compiling GLFW {#compile_guide}
|
||||
|
||||
@page compile_guide Compiling GLFW
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This is about compiling the GLFW library itself. For information on how to
|
||||
build applications that use GLFW, see @ref build_guide.
|
||||
|
||||
GLFW uses some C99 features and does not support Visual Studio 2012 and earlier.
|
||||
|
||||
@section compile_cmake Using CMake
|
||||
|
||||
## Using CMake {#compile_cmake}
|
||||
|
||||
GLFW behaves like most other libraries that use CMake so this guide mostly
|
||||
describes the standard configure, generate and compile sequence. If you are already
|
||||
@ -19,8 +19,8 @@ GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles
|
||||
for your chosen development environment. To compile GLFW, first generate these
|
||||
files with CMake and then use them to compile the GLFW library.
|
||||
|
||||
If you are on Windows and macOS you can
|
||||
[download CMake](https://cmake.org/download/) from their site.
|
||||
If you are on Windows and macOS you can [download
|
||||
CMake](https://cmake.org/download/) from their site.
|
||||
|
||||
If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have
|
||||
a package system like Fink, MacPorts or Homebrew, you can install its CMake
|
||||
@ -28,90 +28,65 @@ 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.
|
||||
[CMake user guide][cmake-guide] that includes everything in this guide not
|
||||
specific to GLFW. It may be a useful companion to this one.
|
||||
|
||||
[cmake-guide]: https://cmake.org/cmake/help/latest/guide/user-interaction/
|
||||
|
||||
|
||||
@subsection compile_deps Installing dependencies
|
||||
### Installing dependencies {#compile_deps}
|
||||
|
||||
The C/C++ development environments in Visual Studio, Xcode and MinGW come with
|
||||
all necessary dependencies for compiling GLFW, but on Unix-like systems like
|
||||
Linux and FreeBSD you will need a few extra packages.
|
||||
|
||||
|
||||
@subsubsection compile_deps_x11 Dependencies for X11
|
||||
#### Dependencies for Wayland and X11 {#compile_deps_wayland}
|
||||
|
||||
To compile GLFW for X11, you need to have the X11 development packages
|
||||
installed. They are not needed to build or run programs that use GLFW.
|
||||
|
||||
On Debian and derivatives like Ubuntu and Linux Mint the `xorg-dev` meta-package
|
||||
pulls in the development packages for all of X11.
|
||||
|
||||
@code{.sh}
|
||||
sudo apt install xorg-dev
|
||||
@endcode
|
||||
|
||||
On Fedora and derivatives like Red Hat the X11 extension packages
|
||||
`libXcursor-devel`, `libXi-devel`, `libXinerama-devel` and `libXrandr-devel`
|
||||
required by GLFW pull in all its other dependencies.
|
||||
|
||||
@code{.sh}
|
||||
sudo dnf install libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
||||
@endcode
|
||||
|
||||
On FreeBSD the X11 headers are installed along the end-user X11 packages, so if
|
||||
you have an X server running you should have the headers as well. If not,
|
||||
install the `xorgproto` package.
|
||||
|
||||
@code{.sh}
|
||||
pkg install xorgproto
|
||||
@endcode
|
||||
|
||||
On Cygwin the `libXcursor-devel`, `libXi-devel`, `libXinerama-devel`,
|
||||
`libXrandr-devel` and `libXrender-devel` packages in the Libs section of the GUI
|
||||
installer will install all the headers and other development related files GLFW
|
||||
requires for X11.
|
||||
|
||||
Once you have the required dependencies, move on to @ref compile_generate.
|
||||
|
||||
|
||||
@subsubsection compile_deps_wayland Dependencies for Wayland and X11
|
||||
By default, both the Wayland and X11 backends are enabled on Linux and other Unix-like
|
||||
systems (except macOS). To disable one or both of these, set the @ref GLFW_BUILD_WAYLAND
|
||||
or @ref GLFW_BUILD_X11 CMake options in the next step when generating build files.
|
||||
|
||||
To compile GLFW for both Wayland and X11, you need to have the X11, Wayland and xkbcommon
|
||||
development packages installed. They are not needed to build or run programs that use
|
||||
GLFW. You will also need to set the @ref GLFW_BUILD_WAYLAND CMake option in the next
|
||||
step when generating build files.
|
||||
development packages installed. On some systems a few other packages are also required.
|
||||
None of the development packages above are needed to build or run programs that use an
|
||||
already compiled GLFW library.
|
||||
|
||||
On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`,
|
||||
`libxkbcommon-dev` and `wayland-protocols` packages and the `xorg-dev` meta-package.
|
||||
On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`
|
||||
and `libxkbcommon-dev` packages to compile for Wayland and the `xorg-dev` meta-package to
|
||||
compile for X11. These will pull in all other dependencies.
|
||||
|
||||
```sh
|
||||
sudo apt install libwayland-dev libxkbcommon-dev xorg-dev
|
||||
```
|
||||
|
||||
On Fedora and derivatives like Red Hat you will need the `wayland-devel` and
|
||||
`libxkbcommon-devel` packages to compile for Wayland and the `libXcursor-devel`,
|
||||
`libXi-devel`, `libXinerama-devel` and `libXrandr-devel` packages to compile for X11.
|
||||
These will pull in all other dependencies.
|
||||
|
||||
@code{.sh}
|
||||
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols xorg-dev
|
||||
@endcode
|
||||
```sh
|
||||
sudo dnf install wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
||||
```
|
||||
|
||||
On Fedora and derivatives like Red Hat you will need the `wayland-devel`,
|
||||
`libxkbcommon-devel`, `wayland-protocols-devel`, `libXcursor-devel`, `libXi-devel`,
|
||||
`libXinerama-devel` and `libXrandr-devel` packages. These will pull in all other
|
||||
dependencies.
|
||||
On FreeBSD you will need the `wayland`, `libxkbcommon` and `evdev-proto` packages to
|
||||
compile for Wayland. The X11 headers are installed along the end-user X11 packages, so if
|
||||
you have an X server running you should have the headers as well. If not, install the
|
||||
`xorgproto` package to compile for X11.
|
||||
|
||||
@code{.sh}
|
||||
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
||||
@endcode
|
||||
```sh
|
||||
pkg install wayland libxkbcommon evdev-proto xorgproto
|
||||
```
|
||||
|
||||
On FreeBSD you will need the `wayland`, `libxkbcommon` and `wayland-protocols` packages.
|
||||
The X11 headers are installed along the end-user X11 packages, so if you have an X server
|
||||
running you should have the headers as well. If not, install the `xorgproto` package.
|
||||
|
||||
@code{.sh}
|
||||
pkg install wayland libxkbcommon wayland-protocols xorgproto
|
||||
@endcode
|
||||
On Cygwin Wayland is not supported but you will need the `libXcursor-devel`,
|
||||
`libXi-devel`, `libXinerama-devel`, `libXrandr-devel` and `libXrender-devel` packages to
|
||||
compile for X11. These can be found in the Libs section of the GUI installer and will
|
||||
pull in all other dependencies.
|
||||
|
||||
Once you have the required dependencies, move on to @ref compile_generate.
|
||||
|
||||
|
||||
@subsection compile_generate Generating build files with CMake
|
||||
### Generating build files with CMake {#compile_generate}
|
||||
|
||||
Once you have all necessary dependencies it is time to generate the project
|
||||
files or makefiles for your development environment. CMake needs two paths for
|
||||
@ -133,7 +108,7 @@ A common pattern when building a single configuration is to have a build
|
||||
directory named `build` in the root of the source tree.
|
||||
|
||||
|
||||
@subsubsection compile_generate_gui Generating with the CMake GUI
|
||||
#### Generating with the CMake GUI {#compile_generate_gui}
|
||||
|
||||
Start the CMake GUI and set the paths to the source and build directories
|
||||
described above. Then press _Configure_ and _Generate_.
|
||||
@ -142,53 +117,54 @@ If you wish change any CMake variables in the list, press _Configure_ and then
|
||||
_Generate_ to have the new values take effect. The variable list will be
|
||||
populated after the first configure step.
|
||||
|
||||
By default, GLFW will use X11 on Linux and other Unix-like systems other than macOS. To
|
||||
include support for Wayland as well, set the @ref GLFW_BUILD_WAYLAND option in the GLFW
|
||||
section of the variable list, then apply the new value as described above.
|
||||
By default, GLFW will use Wayland and X11 on Linux and other Unix-like systems other than
|
||||
macOS. To disable support for one or both of these, set the @ref GLFW_BUILD_WAYLAND
|
||||
and/or @ref GLFW_BUILD_X11 option in the GLFW section of the variable list, then apply the
|
||||
new value as described above.
|
||||
|
||||
Once you have generated the project files or makefiles for your chosen
|
||||
development environment, move on to @ref compile_compile.
|
||||
|
||||
|
||||
@subsubsection compile_generate_cli Generating with command-line CMake
|
||||
#### Generating with command-line CMake {#compile_generate_cli}
|
||||
|
||||
To make a build directory, pass the source and build directories to the `cmake`
|
||||
command. These can be relative or absolute paths. The build directory is
|
||||
created if it doesn't already exist.
|
||||
|
||||
@code{.sh}
|
||||
```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}
|
||||
```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}
|
||||
```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 also include support for Wayland, set the @ref GLFW_BUILD_WAYLAND CMake
|
||||
option.
|
||||
By default, GLFW will use Wayland and X11 on Linux and other Unix-like systems other than
|
||||
macOS. To disable support for one or both of these, set the @ref GLFW_BUILD_WAYLAND
|
||||
and/or @ref GLFW_BUILD_X11 CMake option.
|
||||
|
||||
@code{.sh}
|
||||
cmake -S path/to/glfw -B path/to/build -D GLFW_BUILD_WAYLAND=1
|
||||
@endcode
|
||||
```sh
|
||||
cmake -S path/to/glfw -B path/to/build -D GLFW_BUILD_X11=0
|
||||
```
|
||||
|
||||
Once you have generated the project files or makefiles for your chosen
|
||||
development environment, move on to @ref compile_compile.
|
||||
|
||||
|
||||
@subsection compile_compile Compiling the library
|
||||
### Compiling the library {#compile_compile}
|
||||
|
||||
You should now have all required dependencies and the project files or makefiles
|
||||
necessary to compile GLFW. Go ahead and compile the actual GLFW library with
|
||||
@ -199,24 +175,24 @@ With Visual Studio open `GLFW.sln` and use the Build menu. With Xcode open
|
||||
|
||||
With Linux, macOS and other forms of Unix, run `make`.
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
cd path/to/build
|
||||
make
|
||||
@endcode
|
||||
```
|
||||
|
||||
With MinGW, it is `mingw32-make`.
|
||||
|
||||
@code{.sh}
|
||||
```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}
|
||||
```sh
|
||||
cmake --build path/to/build
|
||||
@endcode
|
||||
```
|
||||
|
||||
This will run the platform specific build tool the directory was generated for.
|
||||
|
||||
@ -224,7 +200,7 @@ Once the GLFW library is compiled you are ready to build your application,
|
||||
linking it to the GLFW library. See @ref build_guide for more information.
|
||||
|
||||
|
||||
@section compile_options CMake options
|
||||
## CMake options {#compile_options}
|
||||
|
||||
The CMake files for GLFW provide a number of options, although not all are
|
||||
available on all supported platforms. Some of these are de facto standards
|
||||
@ -239,12 +215,12 @@ distributions based on Debian GNU/Linux have this tool in a separate
|
||||
Finally, if you don't want to use any GUI, you can set options from the `cmake`
|
||||
command-line with the `-D` flag.
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
cmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ON
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection compile_options_shared Shared CMake options
|
||||
### Shared CMake options {#compile_options_shared}
|
||||
|
||||
@anchor BUILD_SHARED_LIBS
|
||||
__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static library or as
|
||||
@ -276,7 +252,7 @@ with the library. This is enabled by default if
|
||||
[Doxygen](https://www.doxygen.nl/) is found by CMake during configuration.
|
||||
|
||||
|
||||
@subsection compile_options_win32 Win32 specific CMake options
|
||||
### Win32 specific CMake options {#compile_options_win32}
|
||||
|
||||
@anchor GLFW_BUILD_WIN32
|
||||
__GLFW_BUILD_WIN32__ determines whether to include support for Win32 when compiling the
|
||||
@ -288,10 +264,11 @@ __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or th
|
||||
static library version of the Visual C++ runtime library. When enabled, the
|
||||
DLL version of the Visual C++ library is used. This is enabled by default.
|
||||
|
||||
On CMake 3.15 and later you can set the standard CMake
|
||||
[CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)
|
||||
On CMake 3.15 and later you can set the standard CMake [CMAKE_MSVC_RUNTIME_LIBRARY][]
|
||||
variable instead of this GLFW-specific option.
|
||||
|
||||
[CMAKE_MSVC_RUNTIME_LIBRARY]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
|
||||
|
||||
@anchor GLFW_USE_HYBRID_HPG
|
||||
__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
|
||||
`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
|
||||
@ -301,7 +278,7 @@ 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_macos macOS specific CMake options
|
||||
### macOS specific CMake options {#compile_options_macos}
|
||||
|
||||
@anchor GLFW_BUILD_COCOA
|
||||
__GLFW_BUILD_COCOA__ determines whether to include support for Cocoa when compiling the
|
||||
@ -309,12 +286,12 @@ library. This option is only available when compiling for macOS. This is enabl
|
||||
default.
|
||||
|
||||
|
||||
@subsection compile_options_unix Unix-like system specific CMake options
|
||||
### Unix-like system specific CMake options {#compile_options_unix}
|
||||
|
||||
@anchor GLFW_BUILD_WAYLAND
|
||||
__GLFW_BUILD_WAYLAND__ determines whether to include support for Wayland when compiling
|
||||
the library. This option is only available when compiling for Linux and other Unix-like
|
||||
systems other than macOS. This is disabled by default.
|
||||
systems other than macOS. This is enabled by default.
|
||||
|
||||
@anchor GLFW_BUILD_X11
|
||||
__GLFW_BUILD_X11__ determines whether to include support for X11 when compiling the
|
||||
@ -322,7 +299,7 @@ library. This option is only available when compiling for Linux and other Unix-
|
||||
systems other than macOS. This is enabled by default.
|
||||
|
||||
|
||||
@section compile_mingw_cross Cross-compilation with CMake and MinGW
|
||||
## Cross-compilation with CMake and MinGW {#compile_mingw_cross}
|
||||
|
||||
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
|
||||
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
|
||||
@ -334,9 +311,9 @@ 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}
|
||||
```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
|
||||
@ -344,18 +321,19 @@ 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}
|
||||
```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).
|
||||
For more details see the [CMake toolchain guide][cmake-toolchains].
|
||||
|
||||
[cmake-toolchains]: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
|
||||
|
||||
|
||||
@section compile_manual Compiling GLFW manually
|
||||
## Compiling GLFW manually {#compile_manual}
|
||||
|
||||
If you wish to compile GLFW without its CMake build environment then you will have to do
|
||||
at least some platform-detection yourself. There are preprocessor macros for
|
||||
@ -391,4 +369,3 @@ _GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names.
|
||||
GLFW. If you define any of these in your build files, make sure they are not
|
||||
applied to the GLFW sources.
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Context guide {#context_guide}
|
||||
|
||||
@page context_guide Context guide
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide introduces the OpenGL and OpenGL ES context related functions of
|
||||
GLFW. For details on a specific function in this category, see the @ref
|
||||
@ -15,7 +13,7 @@ context. There are also guides for the other areas of the GLFW API.
|
||||
- @ref input_guide
|
||||
|
||||
|
||||
@section context_object Context objects
|
||||
## Context objects {#context_object}
|
||||
|
||||
A window object encapsulates both a top-level window and an OpenGL or OpenGL ES
|
||||
context. It is created with @ref glfwCreateWindow and destroyed with @ref
|
||||
@ -34,22 +32,22 @@ context creation by setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint)
|
||||
hint to `GLFW_NO_API`. For more information, see the @ref vulkan_guide.
|
||||
|
||||
|
||||
@subsection context_hints Context creation hints
|
||||
### Context creation hints {#context_hints}
|
||||
|
||||
There are a number of hints, specified using @ref glfwWindowHint, related to
|
||||
what kind of context is created. See
|
||||
[context related hints](@ref window_hints_ctx) in the window guide.
|
||||
|
||||
|
||||
@subsection context_sharing Context object sharing
|
||||
### Context object sharing {#context_sharing}
|
||||
|
||||
When creating a window and its OpenGL or OpenGL ES context with @ref
|
||||
glfwCreateWindow, you can specify another window whose context the new one
|
||||
should share its objects (textures, vertex and element buffers, etc.) with.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWwindow* second_window = glfwCreateWindow(640, 480, "Second Window", NULL, first_window);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Object sharing is implemented by the operating system and graphics driver. On
|
||||
platforms where it is possible to choose which types of objects are shared, GLFW
|
||||
@ -64,17 +62,17 @@ Contexts_.
|
||||
GLFW comes with a bare-bones object sharing example program called `sharing`.
|
||||
|
||||
|
||||
@subsection context_offscreen Offscreen contexts
|
||||
### Offscreen contexts {#context_offscreen}
|
||||
|
||||
GLFW doesn't support creating contexts without an associated window. However,
|
||||
contexts with hidden windows can be created with the
|
||||
[GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
|
||||
GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The window never needs to be shown and its context can be used as a plain
|
||||
offscreen context. Depending on the window manager, the size of a hidden
|
||||
@ -85,15 +83,16 @@ You should still [process events](@ref events) as long as you have at least one
|
||||
window, even if none of them are visible.
|
||||
|
||||
|
||||
@subsection context_less Windows without contexts
|
||||
### Windows without contexts {#context_less}
|
||||
|
||||
You can disable context creation by setting the
|
||||
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. Windows
|
||||
without contexts must not be passed to @ref glfwMakeContextCurrent or @ref
|
||||
glfwSwapBuffers.
|
||||
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
|
||||
|
||||
Windows without contexts should not be passed to @ref glfwMakeContextCurrent or
|
||||
@ref glfwSwapBuffers. Doing this generates a @ref GLFW_NO_WINDOW_CONTEXT error.
|
||||
|
||||
|
||||
@section context_current Current context
|
||||
## Current context {#context_current}
|
||||
|
||||
Before you can make OpenGL or OpenGL ES calls, you need to have a current
|
||||
context of the correct type. A context can only be current for a single thread
|
||||
@ -104,15 +103,15 @@ thread before making it current on the new one.
|
||||
|
||||
The context of a window is made current with @ref glfwMakeContextCurrent.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwMakeContextCurrent(window);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The window of the current context is returned by @ref glfwGetCurrentContext.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWwindow* window = glfwGetCurrentContext();
|
||||
@endcode
|
||||
```
|
||||
|
||||
The following GLFW functions require a context to be current. Calling any these
|
||||
functions without a current context will generate a @ref GLFW_NO_CURRENT_CONTEXT
|
||||
@ -123,12 +122,12 @@ error.
|
||||
- @ref glfwGetProcAddress
|
||||
|
||||
|
||||
@section context_swap Buffer swapping
|
||||
## Buffer swapping {#context_swap}
|
||||
|
||||
See @ref buffer_swap in the window guide.
|
||||
|
||||
|
||||
@section context_glext OpenGL and OpenGL ES extensions
|
||||
## OpenGL and OpenGL ES extensions {#context_glext}
|
||||
|
||||
One of the benefits of OpenGL and OpenGL ES is their extensibility.
|
||||
Hardware vendors may include extensions in their implementations that extend the
|
||||
@ -151,7 +150,7 @@ their specifications, can be found at the
|
||||
[OpenGL ES Registry](https://www.khronos.org/registry/gles/).
|
||||
|
||||
|
||||
@subsection context_glext_auto Loading extension with a loader library
|
||||
### Loading extension with a loader library {#context_glext_auto}
|
||||
|
||||
An extension loader library is the easiest and best way to access both OpenGL and
|
||||
OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs.
|
||||
@ -168,9 +167,9 @@ both GLFW and glad, but loaders for OpenGL ES, as well as loaders for specific
|
||||
API versions and extension sets can be generated. The generated files are
|
||||
written to the `output` directory.
|
||||
|
||||
@code{.sh}
|
||||
```sh
|
||||
python main.py --generator c --no-loader --out-path output
|
||||
@endcode
|
||||
```
|
||||
|
||||
The `--no-loader` option is added because GLFW already provides a function for
|
||||
loading OpenGL and OpenGL ES function pointers, one that automatically uses the
|
||||
@ -184,14 +183,14 @@ include the glad header file, which will replace the OpenGL header of your
|
||||
development environment. By including the glad header before the GLFW header,
|
||||
it suppresses the development environment's OpenGL or OpenGL ES header.
|
||||
|
||||
@code
|
||||
```c
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
Finally, you need to initialize glad once you have a suitable current context.
|
||||
|
||||
@code
|
||||
```c
|
||||
window = glfwCreateWindow(640, 480, "My Window", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
@ -201,7 +200,7 @@ if (!window)
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once glad has been loaded, you have access to all OpenGL core and extension
|
||||
functions supported by both the context you created and the glad loader you
|
||||
@ -214,25 +213,25 @@ check the actual OpenGL or OpenGL ES version with
|
||||
a specific version is supported by the current context with the
|
||||
`GLAD_GL_VERSION_x_x` booleans.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (GLAD_GL_VERSION_3_2)
|
||||
{
|
||||
// Call OpenGL 3.2+ specific code
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
To check whether a specific extension is supported, use the `GLAD_GL_xxx`
|
||||
booleans.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (GLAD_GL_ARB_gl_spirv)
|
||||
{
|
||||
// Use GL_ARB_gl_spirv
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection context_glext_manual Loading extensions manually
|
||||
### Loading extensions manually {#context_glext_manual}
|
||||
|
||||
__Do not use this technique__ unless it is absolutely necessary. An
|
||||
[extension loader library](@ref context_glext_auto) will save you a ton of
|
||||
@ -247,7 +246,7 @@ This section will demonstrate manual loading of OpenGL extensions. The loading
|
||||
of OpenGL ES extensions is identical except for the name of the extension header.
|
||||
|
||||
|
||||
@subsubsection context_glext_header The glext.h header
|
||||
#### The glext.h header {#context_glext_header}
|
||||
|
||||
The `glext.h` extension header is a continually updated file that defines the
|
||||
interfaces for all OpenGL extensions. The latest version of this can always be
|
||||
@ -266,41 +265,41 @@ to function) and `PROC` (procedure) are added to the ends.
|
||||
To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including
|
||||
the GLFW header.
|
||||
|
||||
@code
|
||||
```c
|
||||
#define GLFW_INCLUDE_GLEXT
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsubsection context_glext_string Checking for extensions
|
||||
#### Checking for extensions {#context_glext_string}
|
||||
|
||||
A given machine may not actually support the extension (it may have older
|
||||
drivers or a graphics card that lacks the necessary hardware features), so it
|
||||
is necessary to check at run-time whether the context supports the extension.
|
||||
This is done with @ref glfwExtensionSupported.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
||||
{
|
||||
// The extension is supported by the current context
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The argument is a null terminated ASCII string with the extension name. If the
|
||||
extension is supported, @ref glfwExtensionSupported returns `GLFW_TRUE`,
|
||||
otherwise it returns `GLFW_FALSE`.
|
||||
|
||||
|
||||
@subsubsection context_glext_proc Fetching function pointers
|
||||
#### Fetching function pointers {#context_glext_proc}
|
||||
|
||||
Many extensions, though not all, require the use of new OpenGL functions.
|
||||
These functions often do not have entry points in the client API libraries of
|
||||
your operating system, making it necessary to fetch them at run time. You can
|
||||
retrieve pointers to these functions with @ref glfwGetProcAddress.
|
||||
|
||||
@code
|
||||
```c
|
||||
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB");
|
||||
@endcode
|
||||
```
|
||||
|
||||
In general, you should avoid giving the function pointer variables the (exact)
|
||||
same name as the function, as this may confuse your linker. Instead, you can
|
||||
@ -309,7 +308,7 @@ use a different prefix, like above, or some other naming scheme.
|
||||
Now that all the pieces have been introduced, here is what they might look like
|
||||
when used together.
|
||||
|
||||
@code
|
||||
```c
|
||||
#define GLFW_INCLUDE_GLEXT
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
@ -337,6 +336,5 @@ void some_function(void)
|
||||
glSpecializeShaderARB(...);
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Input guide {#input_guide}
|
||||
|
||||
@page input_guide Input guide
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide introduces the input related functions of GLFW. For details on
|
||||
a specific function in this category, see the @ref input. There are also guides
|
||||
@ -29,7 +27,7 @@ out all arguments provided for every event, along with time and sequence
|
||||
information.
|
||||
|
||||
|
||||
@section events Event processing
|
||||
## Event processing {#events}
|
||||
|
||||
GLFW needs to poll the window system for events both to provide input to the
|
||||
application and to prove to the window system that the application hasn't locked
|
||||
@ -42,18 +40,18 @@ There are three functions for processing pending events. @ref glfwPollEvents,
|
||||
processes only those events that have already been received and then returns
|
||||
immediately.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwPollEvents();
|
||||
@endcode
|
||||
```
|
||||
|
||||
This is the best choice when rendering continuously, like most games do.
|
||||
|
||||
If you only need to update the contents of the window when you receive new
|
||||
input, @ref glfwWaitEvents is a better choice.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwWaitEvents();
|
||||
@endcode
|
||||
```
|
||||
|
||||
It puts the thread to sleep until at least one event has been received and then
|
||||
processes all received events. This saves a great deal of CPU cycles and is
|
||||
@ -62,9 +60,9 @@ useful for, for example, editing tools.
|
||||
If you want to wait for events but have UI elements or other tasks that need
|
||||
periodic updates, @ref glfwWaitEventsTimeout lets you specify a timeout.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwWaitEventsTimeout(0.7);
|
||||
@endcode
|
||||
```
|
||||
|
||||
It puts the thread to sleep until at least one event has been received, or until
|
||||
the specified number of seconds have elapsed. It then processes any received
|
||||
@ -74,9 +72,9 @@ If the main thread is sleeping in @ref glfwWaitEvents, you can wake it from
|
||||
another thread by posting an empty event to the event queue with @ref
|
||||
glfwPostEmptyEvent.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwPostEmptyEvent();
|
||||
@endcode
|
||||
```
|
||||
|
||||
Do not assume that callbacks will _only_ be called in response to the above
|
||||
functions. While it is necessary to process events in one or more of the ways
|
||||
@ -91,11 +89,11 @@ a [window size callback](@ref window_size) GLFW will call it in turn with the
|
||||
new size before everything returns back out of the @ref glfwSetWindowSize call.
|
||||
|
||||
|
||||
@section input_keyboard Keyboard input
|
||||
## Keyboard input {#input_keyboard}
|
||||
|
||||
GLFW divides keyboard input into two categories; key events and character
|
||||
events. Key events relate to actual physical keyboard keys, whereas character
|
||||
events relate to the Unicode code points generated by pressing some of them.
|
||||
events relate to the text that is generated by pressing some of them.
|
||||
|
||||
Keys and characters do not map 1:1. A single key press may produce several
|
||||
characters, and a single character may require several keys to produce. This
|
||||
@ -103,30 +101,34 @@ may not be the case on your machine, but your users are likely not all using the
|
||||
same keyboard layout, input method or even operating system as you.
|
||||
|
||||
|
||||
@subsection input_key Key input
|
||||
### Key input {#input_key}
|
||||
|
||||
If you wish to be notified when a physical key is pressed or released or when it
|
||||
repeats, set a key callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives the [keyboard key](@ref keys), platform-specific
|
||||
scancode, key action and [modifier bits](@ref mods).
|
||||
|
||||
@code
|
||||
```c
|
||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
if (key == GLFW_KEY_E && action == GLFW_PRESS)
|
||||
activate_airship();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. Events with
|
||||
`GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most
|
||||
keys will also emit events with `GLFW_REPEAT` actions while a key is held down.
|
||||
|
||||
Note that many keyboards have a limit on how many keys being simultaneous held
|
||||
down that they can detect. This limit is called
|
||||
[key rollover](https://en.wikipedia.org/wiki/Key_rollover).
|
||||
|
||||
Key events with `GLFW_REPEAT` actions are intended for text input. They are
|
||||
emitted at the rate set in the user's keyboard settings. At most one key is
|
||||
repeated even if several keys are held down. `GLFW_REPEAT` actions should not
|
||||
@ -142,29 +144,30 @@ keys.
|
||||
The scancode is unique for every key, regardless of whether it has a key token.
|
||||
Scancodes are platform-specific but consistent over time, so keys will have
|
||||
different scancodes depending on the platform but they are safe to save to disk.
|
||||
You can query the scancode for any [named key](@ref keys) on the current
|
||||
platform with @ref glfwGetKeyScancode.
|
||||
You can query the scancode for any [key token](@ref keys) supported on the
|
||||
current platform with @ref glfwGetKeyScancode.
|
||||
|
||||
@code
|
||||
```c
|
||||
const int scancode = glfwGetKeyScancode(GLFW_KEY_X);
|
||||
set_key_mapping(scancode, swap_weapons);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The last reported state for every [named key](@ref keys) is also saved in
|
||||
per-window state arrays that can be polled with @ref glfwGetKey.
|
||||
The last reported state for every physical key with a [key token](@ref keys) is
|
||||
also saved in per-window state arrays that can be polled with @ref glfwGetKey.
|
||||
|
||||
@code
|
||||
```c
|
||||
int state = glfwGetKey(window, GLFW_KEY_E);
|
||||
if (state == GLFW_PRESS)
|
||||
{
|
||||
activate_airship();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||
|
||||
This function only returns cached key event state. It does not poll the
|
||||
system for the current physical state of the key.
|
||||
system for the current state of the physical key. It also does not provide any
|
||||
key repeat information.
|
||||
|
||||
@anchor GLFW_STICKY_KEYS
|
||||
Whenever you poll state, you risk missing the state change you are looking for.
|
||||
@ -172,9 +175,9 @@ If a pressed key is released again before you poll its state, you will have
|
||||
missed the key press. The recommended solution for this is to use a
|
||||
key callback, but there is also the `GLFW_STICKY_KEYS` input mode.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_STICKY_KEYS, GLFW_TRUE);
|
||||
@endcode
|
||||
```
|
||||
|
||||
When sticky keys mode is enabled, the pollable state of a key will remain
|
||||
`GLFW_PRESS` until the state of that key is polled with @ref glfwGetKey. Once
|
||||
@ -185,9 +188,9 @@ the state will reset to `GLFW_RELEASE`, otherwise it will remain `GLFW_PRESS`.
|
||||
If you wish to know what the state of the Caps Lock and Num Lock keys was when
|
||||
input events were generated, set the `GLFW_LOCK_KEY_MODS` input mode.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, GLFW_TRUE);
|
||||
@endcode
|
||||
```
|
||||
|
||||
When this input mode is enabled, any callback that receives
|
||||
[modifier bits](@ref mods) will have the @ref GLFW_MOD_CAPS_LOCK bit set if Caps
|
||||
@ -195,15 +198,15 @@ Lock was on when the event occurred and the @ref GLFW_MOD_NUM_LOCK bit set if
|
||||
Num Lock was on.
|
||||
|
||||
The `GLFW_KEY_LAST` constant holds the highest value of any
|
||||
[named key](@ref keys).
|
||||
[key token](@ref keys).
|
||||
|
||||
|
||||
@subsection input_char Text input
|
||||
### Text input {#input_char}
|
||||
|
||||
GLFW supports text input in the form of a stream of
|
||||
[Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the
|
||||
operating system text input system. Unlike key input, text input obeys keyboard
|
||||
layouts and modifier keys and supports composing characters using
|
||||
operating system text input system. Unlike key input, text input is affected by
|
||||
keyboard layouts and modifier keys and supports composing characters using
|
||||
[dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can
|
||||
encode the code points into UTF-8 or any other encoding you prefer.
|
||||
|
||||
@ -212,30 +215,30 @@ you can treat the code point argument as native endian UTF-32.
|
||||
|
||||
If you wish to offer regular text input, set a character callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetCharCallback(window, character_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives Unicode code points for key events that would
|
||||
have led to regular text input and generally behaves as a standard text field on
|
||||
that platform.
|
||||
|
||||
@code
|
||||
```c
|
||||
void character_callback(GLFWwindow* window, unsigned int codepoint)
|
||||
{
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection input_key_name Key names
|
||||
### Key names {#input_key_name}
|
||||
|
||||
If you wish to refer to keys by name, you can query the keyboard layout
|
||||
dependent name of printable keys with @ref glfwGetKeyName.
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0);
|
||||
show_tutorial_hint("Press %s to move forward", key_name);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This function can handle both [keys and scancodes](@ref input_key). If the
|
||||
specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is
|
||||
@ -243,42 +246,42 @@ ignored. This matches the behavior of the key callback, meaning the callback
|
||||
arguments can always be passed unmodified to this function.
|
||||
|
||||
|
||||
@section input_mouse Mouse input
|
||||
## Mouse input {#input_mouse}
|
||||
|
||||
Mouse input comes in many forms, including mouse motion, button presses and
|
||||
scrolling offsets. The cursor appearance can also be changed, either to
|
||||
a custom image or a standard cursor shape from the system theme.
|
||||
|
||||
|
||||
@subsection cursor_pos Cursor position
|
||||
### Cursor position {#cursor_pos}
|
||||
|
||||
If you wish to be notified when the cursor moves over the window, set a cursor
|
||||
position callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetCursorPosCallback(window, cursor_position_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback functions receives the cursor position, measured in screen
|
||||
coordinates but relative to the top-left corner of the window content area. On
|
||||
platforms that provide it, the full sub-pixel cursor position is passed on.
|
||||
|
||||
@code
|
||||
```c
|
||||
static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
{
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The cursor position is also saved per-window and can be polled with @ref
|
||||
glfwGetCursorPos.
|
||||
|
||||
@code
|
||||
```c
|
||||
double xpos, ypos;
|
||||
glfwGetCursorPos(window, &xpos, &ypos);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection cursor_mode Cursor mode
|
||||
### Cursor mode {#cursor_mode}
|
||||
|
||||
@anchor GLFW_CURSOR
|
||||
The `GLFW_CURSOR` input mode provides several cursor modes for special forms of
|
||||
@ -290,9 +293,9 @@ If you wish to implement mouse motion based camera controls or other input
|
||||
schemes that require unlimited mouse movement, set the cursor mode to
|
||||
`GLFW_CURSOR_DISABLED`.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This will hide the cursor and lock it to the specified window. GLFW will then
|
||||
take care of all the details of cursor re-centering and offset calculation and
|
||||
@ -306,18 +309,18 @@ other features of GLFW. It is not supported and will not work as robustly as
|
||||
If you only wish the cursor to become hidden when it is over a window but still
|
||||
want it to behave normally, set the cursor mode to `GLFW_CURSOR_HIDDEN`.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This mode puts no limit on the motion of the cursor.
|
||||
|
||||
If you wish the cursor to be visible but confined to the content area of the
|
||||
window, set the cursor mode to `GLFW_CURSOR_CAPTURED`.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The cursor will behave normally inside the content area but will not be able to
|
||||
leave unless the window loses focus.
|
||||
@ -325,15 +328,15 @@ leave unless the window loses focus.
|
||||
To exit out of either of these special modes, restore the `GLFW_CURSOR_NORMAL`
|
||||
cursor mode.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
@endcode
|
||||
```
|
||||
|
||||
If the cursor was disabled, this will move it back to its last visible position.
|
||||
|
||||
|
||||
@anchor GLFW_RAW_MOUSE_MOTION
|
||||
@subsection raw_mouse_motion Raw mouse motion
|
||||
### Raw mouse motion {#raw_mouse_motion}
|
||||
|
||||
When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can
|
||||
be enabled if available.
|
||||
@ -348,16 +351,16 @@ Call @ref glfwRawMouseMotionSupported to check if the current machine provides
|
||||
raw motion and set the `GLFW_RAW_MOUSE_MOTION` input mode to enable it. It is
|
||||
disabled by default.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwRawMouseMotionSupported())
|
||||
glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
||||
@endcode
|
||||
```
|
||||
|
||||
If supported, raw mouse motion can be enabled or disabled per-window and at any
|
||||
time but it will only be provided when the cursor is disabled.
|
||||
|
||||
|
||||
@subsection cursor_object Cursor objects
|
||||
### Cursor objects {#cursor_object}
|
||||
|
||||
GLFW supports creating both custom and system theme cursor images, encapsulated
|
||||
as @ref GLFWcursor objects. They are created with @ref glfwCreateCursor or @ref
|
||||
@ -365,13 +368,13 @@ glfwCreateStandardCursor and destroyed with @ref glfwDestroyCursor, or @ref
|
||||
glfwTerminate, if any remain.
|
||||
|
||||
|
||||
@subsubsection cursor_custom Custom cursor creation
|
||||
#### Custom cursor creation {#cursor_custom}
|
||||
|
||||
A custom cursor is created with @ref glfwCreateCursor, which returns a handle to
|
||||
the created cursor object. For example, this creates a 16x16 white square
|
||||
cursor with the hot-spot in the upper-left corner:
|
||||
|
||||
@code
|
||||
```c
|
||||
unsigned char pixels[16 * 16 * 4];
|
||||
memset(pixels, 0xff, sizeof(pixels));
|
||||
|
||||
@ -381,7 +384,7 @@ image.height = 16;
|
||||
image.pixels = pixels;
|
||||
|
||||
GLFWcursor* cursor = glfwCreateCursor(&image, 0, 0);
|
||||
@endcode
|
||||
```
|
||||
|
||||
If cursor creation fails, `NULL` will be returned, so it is necessary to check
|
||||
the return value.
|
||||
@ -391,14 +394,14 @@ per channel with the red channel first. The pixels are arranged canonically as
|
||||
sequential rows, starting from the top-left corner.
|
||||
|
||||
|
||||
@subsubsection cursor_standard Standard cursor creation
|
||||
#### Standard cursor creation {#cursor_standard}
|
||||
|
||||
A cursor with a [standard shape](@ref shapes) from the current system cursor
|
||||
theme can be created with @ref glfwCreateStandardCursor.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWcursor* url_cursor = glfwCreateStandardCursor(GLFW_POINTING_HAND_CURSOR);
|
||||
@endcode
|
||||
```
|
||||
|
||||
These cursor objects behave in the exact same way as those created with @ref
|
||||
glfwCreateCursor except that the system cursor theme provides the actual image.
|
||||
@ -407,26 +410,26 @@ A few of these shapes are not available everywhere. If a shape is unavailable,
|
||||
`NULL` is returned. See @ref glfwCreateStandardCursor for details.
|
||||
|
||||
|
||||
@subsubsection cursor_destruction Cursor destruction
|
||||
#### Cursor destruction {#cursor_destruction}
|
||||
|
||||
When a cursor is no longer needed, destroy it with @ref glfwDestroyCursor.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwDestroyCursor(cursor);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Cursor destruction always succeeds. If the cursor is current for any window,
|
||||
that window will revert to the default cursor. This does not affect the cursor
|
||||
mode. All remaining cursors are destroyed when @ref glfwTerminate is called.
|
||||
|
||||
|
||||
@subsubsection cursor_set Cursor setting
|
||||
#### Cursor setting {#cursor_set}
|
||||
|
||||
A cursor can be set as current for a window with @ref glfwSetCursor.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetCursor(window, cursor);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once set, the cursor image will be used as long as the system cursor is over the
|
||||
content area of the window and the [cursor mode](@ref cursor_mode) is set
|
||||
@ -436,26 +439,26 @@ A single cursor may be set for any number of windows.
|
||||
|
||||
To revert to the default cursor, set the cursor of that window to `NULL`.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetCursor(window, NULL);
|
||||
@endcode
|
||||
```
|
||||
|
||||
When a cursor is destroyed, any window that has it set will revert to the
|
||||
default cursor. This does not affect the cursor mode.
|
||||
|
||||
|
||||
@subsection cursor_enter Cursor enter/leave events
|
||||
### Cursor enter/leave events {#cursor_enter}
|
||||
|
||||
If you wish to be notified when the cursor enters or leaves the content area of
|
||||
a window, set a cursor enter/leave callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetCursorEnterCallback(window, cursor_enter_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives the new classification of the cursor.
|
||||
|
||||
@code
|
||||
```c
|
||||
void cursor_enter_callback(GLFWwindow* window, int entered)
|
||||
{
|
||||
if (entered)
|
||||
@ -467,51 +470,52 @@ void cursor_enter_callback(GLFWwindow* window, int entered)
|
||||
// The cursor left the content area of the window
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
You can query whether the cursor is currently inside the content area of the
|
||||
window with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwGetWindowAttrib(window, GLFW_HOVERED))
|
||||
{
|
||||
highlight_interface();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection input_mouse_button Mouse button input
|
||||
### Mouse button input {#input_mouse_button}
|
||||
|
||||
If you wish to be notified when a mouse button is pressed or released, set
|
||||
a mouse button callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives the [mouse button](@ref buttons), button action
|
||||
and [modifier bits](@ref mods).
|
||||
|
||||
@code
|
||||
```c
|
||||
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS)
|
||||
popup_menu();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||
|
||||
Mouse button states for [named buttons](@ref buttons) are also saved in
|
||||
per-window state arrays that can be polled with @ref glfwGetMouseButton.
|
||||
The last reported state for every [supported mouse button](@ref buttons) is also
|
||||
saved in per-window state arrays that can be polled with @ref
|
||||
glfwGetMouseButton.
|
||||
|
||||
@code
|
||||
```c
|
||||
int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
|
||||
if (state == GLFW_PRESS)
|
||||
{
|
||||
upgrade_cow();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||
|
||||
@ -525,9 +529,9 @@ missed the button press. The recommended solution for this is to use a
|
||||
mouse button callback, but there is also the `GLFW_STICKY_MOUSE_BUTTONS`
|
||||
input mode.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, GLFW_TRUE);
|
||||
@endcode
|
||||
```
|
||||
|
||||
When sticky mouse buttons mode is enabled, the pollable state of a mouse button
|
||||
will remain `GLFW_PRESS` until the state of that button is polled with @ref
|
||||
@ -536,30 +540,30 @@ had been processed in the meantime, the state will reset to `GLFW_RELEASE`,
|
||||
otherwise it will remain `GLFW_PRESS`.
|
||||
|
||||
The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any
|
||||
[named button](@ref buttons).
|
||||
[supported mouse button](@ref buttons).
|
||||
|
||||
|
||||
@subsection scrolling Scroll input
|
||||
### Scroll input {#scrolling}
|
||||
|
||||
If you wish to be notified when the user scrolls, whether with a mouse wheel or
|
||||
touchpad gesture, set a scroll callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetScrollCallback(window, scroll_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives two-dimensional scroll offsets.
|
||||
|
||||
@code
|
||||
```c
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
A normal mouse wheel, being vertical, provides offsets along the Y-axis.
|
||||
|
||||
|
||||
@section joystick Joystick input
|
||||
## Joystick input {#joystick}
|
||||
|
||||
The joystick functions expose connected joysticks and controllers, with both
|
||||
referred to as joysticks. It supports up to sixteen joysticks, ranging from
|
||||
@ -567,9 +571,9 @@ referred to as joysticks. It supports up to sixteen joysticks, ranging from
|
||||
`GLFW_JOYSTICK_LAST`. You can test whether a [joystick](@ref joysticks) is
|
||||
present with @ref glfwJoystickPresent.
|
||||
|
||||
@code
|
||||
```c
|
||||
int present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Each joystick has zero or more axes, zero or more buttons, zero or more hats,
|
||||
a human-readable name, a user pointer and an SDL compatible GUID.
|
||||
@ -589,30 +593,30 @@ To see all the properties of all connected joysticks in real-time, run the
|
||||
`joysticks` test program.
|
||||
|
||||
|
||||
@subsection joystick_axis Joystick axis states
|
||||
### Joystick axis states {#joystick_axis}
|
||||
|
||||
The positions of all axes of a joystick are returned by @ref
|
||||
glfwGetJoystickAxes. See the reference documentation for the lifetime of the
|
||||
returned array.
|
||||
|
||||
@code
|
||||
```c
|
||||
int count;
|
||||
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_5, &count);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Each element in the returned array is a value between -1.0 and 1.0.
|
||||
|
||||
|
||||
@subsection joystick_button Joystick button states
|
||||
### Joystick button states {#joystick_button}
|
||||
|
||||
The states of all buttons of a joystick are returned by @ref
|
||||
glfwGetJoystickButtons. See the reference documentation for the lifetime of the
|
||||
returned array.
|
||||
|
||||
@code
|
||||
```c
|
||||
int count;
|
||||
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_3, &count);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Each element in the returned array is either `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||
|
||||
@ -621,15 +625,15 @@ glfwGetJoystickHats, the button array by default also includes all hats. See
|
||||
the reference documentation for @ref glfwGetJoystickButtons for details.
|
||||
|
||||
|
||||
@subsection joystick_hat Joystick hat states
|
||||
### Joystick hat states {#joystick_hat}
|
||||
|
||||
The states of all hats are returned by @ref glfwGetJoystickHats. See the
|
||||
reference documentation for the lifetime of the returned array.
|
||||
|
||||
@code
|
||||
```c
|
||||
int count;
|
||||
const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Each element in the returned array is one of the following:
|
||||
|
||||
@ -649,34 +653,34 @@ The diagonal directions are bitwise combinations of the primary (up, right, down
|
||||
and left) directions and you can test for these individually by ANDing it with
|
||||
the corresponding direction.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (hats[2] & GLFW_HAT_RIGHT)
|
||||
{
|
||||
// State of hat 2 could be right-up, right or right-down
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
For backward compatibility with earlier versions that did not have @ref
|
||||
glfwGetJoystickHats, all hats are by default also included in the button array.
|
||||
See the reference documentation for @ref glfwGetJoystickButtons for details.
|
||||
|
||||
|
||||
@subsection joystick_name Joystick name
|
||||
### Joystick name {#joystick_name}
|
||||
|
||||
The human-readable, UTF-8 encoded name of a joystick is returned by @ref
|
||||
glfwGetJoystickName. See the reference documentation for the lifetime of the
|
||||
returned string.
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Joystick names are not guaranteed to be unique. Two joysticks of the same model
|
||||
and make may have the same name. Only the [joystick ID](@ref joysticks) is
|
||||
guaranteed to be unique, and only until that joystick is disconnected.
|
||||
|
||||
|
||||
@subsection joystick_userptr Joystick user pointer
|
||||
### Joystick user pointer {#joystick_userptr}
|
||||
|
||||
Each joystick has a user pointer that can be set with @ref
|
||||
glfwSetJoystickUserPointer and queried with @ref glfwGetJoystickUserPointer.
|
||||
@ -687,19 +691,19 @@ terminated.
|
||||
The initial value of the pointer is `NULL`.
|
||||
|
||||
|
||||
@subsection joystick_event Joystick configuration changes
|
||||
### Joystick configuration changes {#joystick_event}
|
||||
|
||||
If you wish to be notified when a joystick is connected or disconnected, set
|
||||
a joystick callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetJoystickCallback(joystick_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives the ID of the joystick that has been connected
|
||||
and disconnected and the event that occurred.
|
||||
|
||||
@code
|
||||
```c
|
||||
void joystick_callback(int jid, int event)
|
||||
{
|
||||
if (event == GLFW_CONNECTED)
|
||||
@ -711,7 +715,7 @@ void joystick_callback(int jid, int event)
|
||||
// The joystick was disconnected
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
For joystick connection and disconnection events to be delivered on all
|
||||
platforms, you need to call one of the [event processing](@ref events)
|
||||
@ -724,15 +728,17 @@ useful values for a disconnected joystick and only before the monitor callback
|
||||
returns.
|
||||
|
||||
|
||||
@subsection gamepad Gamepad input
|
||||
### Gamepad input {#gamepad}
|
||||
|
||||
The joystick functions provide unlabeled axes, buttons and hats, with no
|
||||
indication of where they are located on the device. Their order may also vary
|
||||
between platforms even with the same device.
|
||||
|
||||
To solve this problem the SDL community crowdsourced the
|
||||
[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) project,
|
||||
a database of mappings from many different devices to an Xbox-like gamepad.
|
||||
[SDL_GameControllerDB][] project, a database of mappings from many different
|
||||
devices to an Xbox-like gamepad.
|
||||
|
||||
[SDL_GameControllerDB]: https://github.com/gabomdq/SDL_GameControllerDB
|
||||
|
||||
GLFW supports this mapping format and contains a copy of the mappings
|
||||
available at the time of release. See @ref gamepad_mapping for how to update
|
||||
@ -742,12 +748,12 @@ a joystick is connected or the mappings are updated.
|
||||
You can check whether a joystick is both present and has a gamepad mapping with
|
||||
@ref glfwJoystickIsGamepad.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwJoystickIsGamepad(GLFW_JOYSTICK_2))
|
||||
{
|
||||
// Use as gamepad
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
If you are only interested in gamepad input you can use this function instead of
|
||||
@ref glfwJoystickPresent.
|
||||
@ -756,13 +762,13 @@ You can query the human-readable name provided by the gamepad mapping with @ref
|
||||
glfwGetGamepadName. This may or may not be the same as the
|
||||
[joystick name](@ref joystick_name).
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* name = glfwGetGamepadName(GLFW_JOYSTICK_7);
|
||||
@endcode
|
||||
```
|
||||
|
||||
To retrieve the gamepad state of a joystick, call @ref glfwGetGamepadState.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWgamepadstate state;
|
||||
|
||||
if (glfwGetGamepadState(GLFW_JOYSTICK_3, &state))
|
||||
@ -774,7 +780,7 @@ if (glfwGetGamepadState(GLFW_JOYSTICK_3, &state))
|
||||
|
||||
input_speed(state.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER]);
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The @ref GLFWgamepadstate struct has two arrays; one for button states and one
|
||||
for axis states. The values for each button and axis are the same as for the
|
||||
@ -805,18 +811,17 @@ The `GLFW_GAMEPAD_BUTTON_LAST` and `GLFW_GAMEPAD_AXIS_LAST` constants equal
|
||||
the largest available index for each array.
|
||||
|
||||
|
||||
@subsection gamepad_mapping Gamepad mappings
|
||||
### Gamepad mappings {#gamepad_mapping}
|
||||
|
||||
GLFW contains a copy of the mappings available in
|
||||
[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) at the
|
||||
time of release. Newer ones can be added at runtime with @ref
|
||||
GLFW contains a copy of the mappings available in [SDL_GameControllerDB][] at
|
||||
the time of release. Newer ones can be added at runtime with @ref
|
||||
glfwUpdateGamepadMappings.
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* mappings = load_file_contents("game/data/gamecontrollerdb.txt");
|
||||
|
||||
glfwUpdateGamepadMappings(mappings);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This function supports everything from single lines up to and including the
|
||||
unmodified contents of the whole `gamecontrollerdb.txt` file.
|
||||
@ -876,25 +881,25 @@ one built into GLFW for Xbox controllers accessed via the XInput API on Windows.
|
||||
This example has been broken into several lines to fit on the page, but real
|
||||
gamepad mappings must be a single line.
|
||||
|
||||
@code{.unparsed}
|
||||
```
|
||||
78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,
|
||||
b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,
|
||||
rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,
|
||||
righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||
@endcode
|
||||
```
|
||||
|
||||
@note GLFW does not yet support the output range and modifiers `+` and `-` that
|
||||
were recently added to SDL. The input modifiers `+`, `-` and `~` are supported
|
||||
and described above.
|
||||
|
||||
|
||||
@section time Time input
|
||||
## Time input {#time}
|
||||
|
||||
GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
|
||||
|
||||
@code
|
||||
```c
|
||||
double seconds = glfwGetTime();
|
||||
@endcode
|
||||
```
|
||||
|
||||
It returns the number of seconds since the library was initialized with @ref
|
||||
glfwInit. The platform-specific time sources used typically have micro- or
|
||||
@ -902,9 +907,9 @@ nanosecond resolution.
|
||||
|
||||
You can modify the base time with @ref glfwSetTime.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetTime(4.0);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This sets the time to the specified time, in seconds, and it continues to count
|
||||
from there.
|
||||
@ -912,32 +917,32 @@ from there.
|
||||
You can also access the raw timer used to implement the functions above,
|
||||
with @ref glfwGetTimerValue.
|
||||
|
||||
@code
|
||||
```c
|
||||
uint64_t value = glfwGetTimerValue();
|
||||
@endcode
|
||||
```
|
||||
|
||||
This value is in 1 / frequency seconds. The frequency of the raw
|
||||
timer varies depending on the operating system and hardware. You can query the
|
||||
frequency, in Hz, with @ref glfwGetTimerFrequency.
|
||||
|
||||
@code
|
||||
```c
|
||||
uint64_t frequency = glfwGetTimerFrequency();
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@section clipboard Clipboard input and output
|
||||
## Clipboard input and output {#clipboard}
|
||||
|
||||
If the system clipboard contains a UTF-8 encoded string or if it can be
|
||||
converted to one, you can retrieve it with @ref glfwGetClipboardString. See the
|
||||
reference documentation for the lifetime of the returned string.
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* text = glfwGetClipboardString(NULL);
|
||||
if (text)
|
||||
{
|
||||
insert_text(text);
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
If the clipboard is empty or if its contents could not be converted, `NULL` is
|
||||
returned.
|
||||
@ -945,33 +950,32 @@ returned.
|
||||
The contents of the system clipboard can be set to a UTF-8 encoded string with
|
||||
@ref glfwSetClipboardString.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetClipboardString(NULL, "A string with words in it");
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@section path_drop Path drop input
|
||||
## Path drop input {#path_drop}
|
||||
|
||||
If you wish to receive the paths of files and/or directories dropped on
|
||||
a window, set a file drop callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetDropCallback(window, drop_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives an array of paths encoded as UTF-8.
|
||||
|
||||
@code
|
||||
```c
|
||||
void drop_callback(GLFWwindow* window, int count, const char** paths)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
handle_dropped_file(paths[i]);
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The path array and its strings are only valid until the file drop callback
|
||||
returns, as they may have been generated specifically for that event. You need
|
||||
to make a deep copy of the array if you want to keep the paths.
|
||||
|
||||
*/
|
@ -1,14 +1,12 @@
|
||||
/*!
|
||||
# Internal structure {#internals_guide}
|
||||
|
||||
@page internals_guide Internal structure
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
There are several interfaces inside GLFW. Each interface has its own area of
|
||||
responsibility and its own naming conventions.
|
||||
|
||||
|
||||
@section internals_public Public interface
|
||||
## Public interface {#internals_public}
|
||||
|
||||
The most well-known is the public interface, described in the glfw3.h header
|
||||
file. This is implemented in source files shared by all platforms and these
|
||||
@ -22,7 +20,7 @@ it use headless camel case.
|
||||
Examples: `glfwCreateWindow`, `GLFWwindow`, `GLFW_RED_BITS`
|
||||
|
||||
|
||||
@section internals_native Native interface
|
||||
## Native interface {#internals_native}
|
||||
|
||||
The [native interface](@ref native) is a small set of publicly available
|
||||
but platform-specific functions, described in the glfw3native.h header file and
|
||||
@ -36,7 +34,7 @@ from.
|
||||
Examples: `glfwGetX11Window`, `glfwGetWGLContext`
|
||||
|
||||
|
||||
@section internals_internal Internal interface
|
||||
## Internal interface {#internals_internal}
|
||||
|
||||
The internal interface consists of utility functions used by all other
|
||||
interfaces. It is shared code implemented in the same shared source files as
|
||||
@ -52,7 +50,7 @@ global names have a leading underscore.
|
||||
Examples: `_glfwIsValidContextConfig`, `_GLFWwindow`, `_glfw.monitorCount`
|
||||
|
||||
|
||||
@section internals_platform Platform interface
|
||||
## Platform interface {#internals_platform}
|
||||
|
||||
The platform interface implements all platform-specific operations as a service
|
||||
to the public interface. This includes event processing. The platform
|
||||
@ -90,7 +88,7 @@ prevents shared code from accidentally using these members.
|
||||
Examples: `window->win32.handle`, `_glfw.x11.display`
|
||||
|
||||
|
||||
@section internals_event Event interface
|
||||
## Event interface {#internals_event}
|
||||
|
||||
The event interface is implemented in the same shared source files as the public
|
||||
interface and is responsible for delivering the events it receives to the
|
||||
@ -102,7 +100,7 @@ ObjectEvent pattern.
|
||||
Examples: `_glfwInputWindowFocus`, `_glfwInputCursorPos`
|
||||
|
||||
|
||||
@section internals_static Static functions
|
||||
## Static functions {#internals_static}
|
||||
|
||||
Static functions may be used by any interface and have no prefixes or suffixes.
|
||||
These use headless camel case.
|
||||
@ -110,7 +108,7 @@ These use headless camel case.
|
||||
Examples: `isValidElementForJoystick`
|
||||
|
||||
|
||||
@section internals_config Configuration macros
|
||||
## Configuration macros {#internals_config}
|
||||
|
||||
GLFW uses a number of configuration macros to select at compile time which
|
||||
interfaces and code paths to use. They are defined in the GLFW CMake target.
|
||||
@ -120,4 +118,3 @@ with a leading underscore.
|
||||
|
||||
Examples: `_GLFW_WIN32`, `_GLFW_BUILD_DLL`
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Introduction to the API {#intro_guide}
|
||||
|
||||
@page intro_guide Introduction to the API
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide introduces the basic concepts of GLFW and describes initialization,
|
||||
error handling and API guarantees and limitations. For a broad but shallow
|
||||
@ -18,7 +16,7 @@ There are also guides for the other areas of GLFW.
|
||||
- @ref input_guide
|
||||
|
||||
|
||||
@section intro_init Initialization and termination
|
||||
## Initialization and termination {#intro_init}
|
||||
|
||||
Before most GLFW functions may be called, the library must be initialized.
|
||||
This initialization checks what features are available on the machine,
|
||||
@ -43,17 +41,17 @@ Calling any other function before successful initialization will cause a @ref
|
||||
GLFW_NOT_INITIALIZED error.
|
||||
|
||||
|
||||
@subsection intro_init_init Initializing GLFW
|
||||
### Initializing GLFW {#intro_init_init}
|
||||
|
||||
The library is initialized with @ref glfwInit, which returns `GLFW_FALSE` if an
|
||||
error occurred.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (!glfwInit())
|
||||
{
|
||||
// Handle initialization failure
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
If any part of initialization fails, any parts that succeeded are terminated as
|
||||
if @ref glfwTerminate had been called. The library only needs to be initialized
|
||||
@ -71,14 +69,14 @@ main menu and dock icon can be disabled with the @ref GLFW_COCOA_MENUBAR init
|
||||
hint.
|
||||
|
||||
|
||||
@subsection init_hints Initialization hints
|
||||
### Initialization hints {#init_hints}
|
||||
|
||||
Initialization hints are set before @ref glfwInit and affect how the library
|
||||
behaves until termination. Hints are set with @ref glfwInitHint.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The values you set hints to are never reset by GLFW, but they only take effect
|
||||
during initialization. Once GLFW has been initialized, any values you set will
|
||||
@ -89,7 +87,7 @@ will only affect their specific platform. Other platforms will ignore them.
|
||||
Setting these hints requires no platform specific headers or functions.
|
||||
|
||||
|
||||
@subsubsection init_hints_shared Shared init hints
|
||||
#### Shared init hints {#init_hints_shared}
|
||||
|
||||
@anchor GLFW_PLATFORM
|
||||
__GLFW_PLATFORM__ specifies the platform to use for windowing and input.
|
||||
@ -107,20 +105,21 @@ glfwGetJoystickHats. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||
|
||||
@anchor GLFW_ANGLE_PLATFORM_TYPE_hint
|
||||
__GLFW_ANGLE_PLATFORM_TYPE__ specifies the platform type (rendering backend) to
|
||||
request when using OpenGL ES and EGL via
|
||||
[ANGLE](https://chromium.googlesource.com/angle/angle/). If the requested
|
||||
platform type is unavailable, ANGLE will use its default. Possible values are
|
||||
one of `GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`,
|
||||
request when using OpenGL ES and EGL via [ANGLE][]. If the requested platform
|
||||
type is unavailable, ANGLE will use its default. Possible values are one of
|
||||
`GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`,
|
||||
`GLFW_ANGLE_PLATFORM_TYPE_OPENGLES`, `GLFW_ANGLE_PLATFORM_TYPE_D3D9`,
|
||||
`GLFW_ANGLE_PLATFORM_TYPE_D3D11`, `GLFW_ANGLE_PLATFORM_TYPE_VULKAN` and
|
||||
`GLFW_ANGLE_PLATFORM_TYPE_METAL`.
|
||||
|
||||
[ANGLE]: https://chromium.googlesource.com/angle/angle/
|
||||
|
||||
The ANGLE platform type is specified via the `EGL_ANGLE_platform_angle`
|
||||
extension. This extension is not used if this hint is
|
||||
`GLFW_ANGLE_PLATFORM_TYPE_NONE`, which is the default value.
|
||||
|
||||
|
||||
@subsubsection init_hints_osx macOS specific init hints
|
||||
#### macOS specific init hints {#init_hints_osx}
|
||||
|
||||
@anchor GLFW_COCOA_CHDIR_RESOURCES_hint
|
||||
__GLFW_COCOA_CHDIR_RESOURCES__ specifies whether to set the current directory to
|
||||
@ -135,7 +134,7 @@ a nib or manually by GLFW. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||
This is ignored on other platforms.
|
||||
|
||||
|
||||
@subsubsection init_hints_x11 X11 specific init hints
|
||||
#### X11 specific init hints {#init_hints_x11}
|
||||
|
||||
@anchor GLFW_X11_XCB_VULKAN_SURFACE_hint
|
||||
__GLFW_X11_XCB_VULKAN_SURFACE__ specifies whether to prefer the
|
||||
@ -144,16 +143,17 @@ the `VK_KHR_xlib_surface` extension. Possible values are `GLFW_TRUE` and
|
||||
`GLFW_FALSE`. This is ignored on other platforms.
|
||||
|
||||
|
||||
@subsubsection init_hints_wayland Wayland specific init hints
|
||||
#### Wayland specific init hints {#init_hints_wayland}
|
||||
|
||||
@anchor GLFW_WAYLAND_LIBDECOR_hint
|
||||
__GLFW_WAYLAND_LIBDECOR__ specifies whether to use
|
||||
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) for window
|
||||
__GLFW_WAYLAND_LIBDECOR__ specifies whether to use [libdecor][] for window
|
||||
decorations where available. Possible values are `GLFW_WAYLAND_PREFER_LIBDECOR`
|
||||
and `GLFW_WAYLAND_DISABLE_LIBDECOR`. This is ignored on other platforms.
|
||||
|
||||
[libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
|
||||
|
||||
@subsubsection init_hints_values Supported and default values
|
||||
|
||||
#### Supported and default values {#init_hints_values}
|
||||
|
||||
Initialization hint | Default value | Supported values
|
||||
-------------------------------- | ------------------------------- | ----------------
|
||||
@ -166,7 +166,7 @@ Initialization hint | Default value | Supported v
|
||||
@ref GLFW_WAYLAND_LIBDECOR | `GLFW_WAYLAND_PREFER_LIBDECOR` | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
|
||||
|
||||
|
||||
@subsection platform Runtime platform selection
|
||||
### Runtime platform selection {#platform}
|
||||
|
||||
GLFW can be compiled for more than one platform (window system) at once. This lets
|
||||
a single library binary support both X11 and Wayland on Linux and other Unix-like systems.
|
||||
@ -176,44 +176,44 @@ default, this is set to @ref GLFW_ANY_PLATFORM, which will look for supported wi
|
||||
systems in order of priority and select the first one it finds. It can also be set to any
|
||||
specific platform to have GLFW only look for that one.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This mechanism also provides the Null platform, which is always supported but needs to be
|
||||
explicitly requested. This platform is effectively a stub, emulating a window system on
|
||||
a single 1080p monitor, but will not interact with any actual window system.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_NULL);
|
||||
@endcode
|
||||
```
|
||||
|
||||
You can test whether a library binary was compiled with support for a specific platform
|
||||
with @ref glfwPlatformSupported.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwPlatformSupported(GLFW_PLATFORM_WAYLAND))
|
||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once GLFW has been initialized, you can query which platform was selected with @ref
|
||||
glfwGetPlatform.
|
||||
|
||||
@code
|
||||
```c
|
||||
int platform = glfwGetPlatform();
|
||||
@endcode
|
||||
```
|
||||
|
||||
If you are using any [native access functions](@ref native), especially on Linux and other
|
||||
Unix-like systems, then you may need to check that you are calling the ones matching the
|
||||
selected platform.
|
||||
|
||||
|
||||
@subsection init_allocator Custom heap memory allocator
|
||||
### Custom heap memory allocator {#init_allocator}
|
||||
|
||||
The heap memory allocator can be customized before initialization with @ref
|
||||
glfwInitAllocator.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWallocator allocator;
|
||||
allocator.allocate = my_malloc;
|
||||
allocator.reallocate = my_realloc;
|
||||
@ -221,11 +221,11 @@ allocator.deallocate = my_free;
|
||||
allocator.user = NULL;
|
||||
|
||||
glfwInitAllocator(&allocator);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The allocator will be picked up at the beginning of initialization and will be
|
||||
used until GLFW has been fully terminated. Any allocator set after
|
||||
initialization will be picked up only at the next initialization.
|
||||
The allocator will be made active at the beginning of initialization and will be used by
|
||||
GLFW until the library has been fully terminated. Any allocator set after initialization
|
||||
will be picked up only at the next initialization.
|
||||
|
||||
The allocator will only be used for allocations that would have been made with
|
||||
the C standard library. Memory allocations that must be made with platform
|
||||
@ -235,45 +235,54 @@ The allocation function must have a signature matching @ref GLFWallocatefun. It
|
||||
the desired size, in bytes, and the user pointer passed to @ref glfwInitAllocator and
|
||||
returns the address to the allocated memory block.
|
||||
|
||||
@code
|
||||
```c
|
||||
void* my_malloc(size_t size, void* user)
|
||||
{
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The documentation for @ref GLFWallocatefun also lists the requirements and limitations for
|
||||
an allocation function. If the active one does not meet all of these, GLFW may fail.
|
||||
|
||||
The reallocation function must have a function signature matching @ref GLFWreallocatefun.
|
||||
It receives the memory block to be reallocated, the new desired size, in bytes, and the user
|
||||
pointer passed to @ref glfwInitAllocator and returns the address to the resized memory
|
||||
block.
|
||||
|
||||
@code
|
||||
```c
|
||||
void* my_realloc(void* block, size_t size, void* user)
|
||||
{
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The documentation for @ref GLFWreallocatefun also lists the requirements and limitations
|
||||
for a reallocation function. If the active one does not meet all of these, GLFW may fail.
|
||||
|
||||
The deallocation function must have a function signature matching @ref GLFWdeallocatefun.
|
||||
It receives the memory block to be deallocated and the user pointer passed to @ref
|
||||
glfwInitAllocator.
|
||||
|
||||
@code
|
||||
```c
|
||||
void my_free(void* block, void* user)
|
||||
{
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The documentation for @ref GLFWdeallocatefun also lists the requirements and limitations
|
||||
for a deallocation function. If the active one does not meet all of these, GLFW may fail.
|
||||
|
||||
|
||||
@subsection intro_init_terminate Terminating GLFW
|
||||
### Terminating GLFW {#intro_init_terminate}
|
||||
|
||||
Before your application exits, you should terminate the GLFW library if it has
|
||||
been initialized. This is done with @ref glfwTerminate.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwTerminate();
|
||||
@endcode
|
||||
```
|
||||
|
||||
This will destroy any remaining window, monitor and cursor objects, restore any
|
||||
modified gamma ramps, re-enable the screensaver if it had been disabled and free
|
||||
@ -285,7 +294,7 @@ library was not initialized or had already been terminated, it returns
|
||||
immediately.
|
||||
|
||||
|
||||
@section error_handling Error handling
|
||||
## Error handling {#error_handling}
|
||||
|
||||
Some GLFW functions have return values that indicate an error, but this is often
|
||||
not very helpful when trying to figure out what happened or why it occurred.
|
||||
@ -296,12 +305,12 @@ values.
|
||||
The last [error code](@ref errors) for the calling thread can be queried at any
|
||||
time with @ref glfwGetError.
|
||||
|
||||
@code
|
||||
```c
|
||||
int code = glfwGetError(NULL);
|
||||
|
||||
if (code != GLFW_NO_ERROR)
|
||||
handle_error(code);
|
||||
@endcode
|
||||
```
|
||||
|
||||
If no error has occurred since the last call, @ref GLFW_NO_ERROR (zero) is
|
||||
returned. The error is cleared before the function returns.
|
||||
@ -315,13 +324,13 @@ can retrieve a UTF-8 encoded human-readable description along with the error
|
||||
code. If no error has occurred since the last call, the description is set to
|
||||
`NULL`.
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* description;
|
||||
int code = glfwGetError(&description);
|
||||
|
||||
if (description)
|
||||
display_error_message(code, description);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The retrieved description string is only valid until the next error occurs.
|
||||
This means you must make a copy of it if you want to keep it.
|
||||
@ -329,19 +338,19 @@ This means you must make a copy of it if you want to keep it.
|
||||
You can also set an error callback, which will be called each time an error
|
||||
occurs. It is set with @ref glfwSetErrorCallback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetErrorCallback(error_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The error callback receives the same error code and human-readable description
|
||||
returned by @ref glfwGetError.
|
||||
|
||||
@code
|
||||
```c
|
||||
void error_callback(int code, const char* description)
|
||||
{
|
||||
display_error_message(code, description);
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The error callback is called after the error is stored, so calling @ref
|
||||
glfwGetError from within the error callback returns the same values as the
|
||||
@ -360,7 +369,7 @@ Do not rely on a currently invalid call to generate a specific error, as in the
|
||||
future that same call may generate a different error or become valid.
|
||||
|
||||
|
||||
@section coordinate_systems Coordinate systems
|
||||
## Coordinate systems {#coordinate_systems}
|
||||
|
||||
GLFW has two primary coordinate systems: the _virtual screen_ and the window
|
||||
_content area_ or _content area_. Both use the same unit: _virtual screen
|
||||
@ -397,7 +406,7 @@ between screen coordinates and pixels may also change at run-time depending on
|
||||
which monitor the window is currently considered to be on.
|
||||
|
||||
|
||||
@section guarantees_limitations Guarantees and limitations
|
||||
## Guarantees and limitations {#guarantees_limitations}
|
||||
|
||||
This section describes the conditions under which GLFW can be expected to
|
||||
function, barring bugs in the operating system or drivers. Use of GLFW outside
|
||||
@ -406,7 +415,7 @@ time, or on some versions of GLFW, but it may break at any time and this will
|
||||
not be considered a bug.
|
||||
|
||||
|
||||
@subsection lifetime Pointer lifetimes
|
||||
### Pointer lifetimes {#lifetime}
|
||||
|
||||
GLFW will never free any pointer you provide to it, and you must never free any
|
||||
pointer it provides to you.
|
||||
@ -426,7 +435,7 @@ Pointer lifetimes are guaranteed not to be shortened in future minor or patch
|
||||
releases.
|
||||
|
||||
|
||||
@subsection reentrancy Reentrancy
|
||||
### Reentrancy {#reentrancy}
|
||||
|
||||
GLFW event processing and object destruction are not reentrant. This means that
|
||||
the following functions must not be called from any callback function:
|
||||
@ -442,7 +451,7 @@ These functions may be made reentrant in future minor or patch releases, but
|
||||
functions not on this list will not be made non-reentrant.
|
||||
|
||||
|
||||
@subsection thread_safety Thread safety
|
||||
### Thread safety {#thread_safety}
|
||||
|
||||
Most GLFW functions must only be called from the main thread (the thread that
|
||||
calls main), but some may be called from any thread once the library has been
|
||||
@ -523,7 +532,7 @@ but functions that are currently limited to the main thread may be updated to
|
||||
allow calls from any thread in future releases.
|
||||
|
||||
|
||||
@subsection compatibility Version compatibility
|
||||
### Version compatibility {#compatibility}
|
||||
|
||||
GLFW uses [Semantic Versioning](https://semver.org/). This guarantees source
|
||||
and binary backward compatibility with earlier minor versions of the API. This
|
||||
@ -543,14 +552,14 @@ fixed in the next release. The reference documentation will also take
|
||||
precedence over anything stated in a guide.
|
||||
|
||||
|
||||
@subsection event_order Event order
|
||||
### Event order {#event_order}
|
||||
|
||||
The order of arrival of related events is not guaranteed to be consistent
|
||||
across platforms. The exception is synthetic key and mouse button release
|
||||
events, which are always delivered after the window defocus event.
|
||||
|
||||
|
||||
@section intro_version Version management
|
||||
## Version management {#intro_version}
|
||||
|
||||
GLFW provides mechanisms for identifying what version of GLFW your application
|
||||
was compiled against as well as what version it is currently running against.
|
||||
@ -558,33 +567,33 @@ If you are loading GLFW dynamically (not just linking dynamically), you can use
|
||||
this to verify that the library binary is compatible with your application.
|
||||
|
||||
|
||||
@subsection intro_version_compile Compile-time version
|
||||
### Compile-time version {#intro_version_compile}
|
||||
|
||||
The compile-time version of GLFW is provided by the GLFW header with the
|
||||
`GLFW_VERSION_MAJOR`, `GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` macros.
|
||||
|
||||
@code
|
||||
```c
|
||||
printf("Compiled against GLFW %i.%i.%i\n",
|
||||
GLFW_VERSION_MAJOR,
|
||||
GLFW_VERSION_MINOR,
|
||||
GLFW_VERSION_REVISION);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection intro_version_runtime Run-time version
|
||||
### Run-time version {#intro_version_runtime}
|
||||
|
||||
The run-time version can be retrieved with @ref glfwGetVersion, a function that
|
||||
may be called regardless of whether GLFW is initialized.
|
||||
|
||||
@code
|
||||
```c
|
||||
int major, minor, revision;
|
||||
glfwGetVersion(&major, &minor, &revision);
|
||||
|
||||
printf("Running against GLFW %i.%i.%i\n", major, minor, revision);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection intro_version_string Version string
|
||||
### Version string {#intro_version_string}
|
||||
|
||||
GLFW 3 also provides a compile-time generated version string that describes the
|
||||
version, platform, compiler and any platform-specific compile-time options.
|
||||
@ -615,15 +624,14 @@ The format of the string is as follows:
|
||||
For example, compiling GLFW 3.4 with MinGW as a DLL for Windows, may result in a version string
|
||||
like this:
|
||||
|
||||
@code
|
||||
```c
|
||||
3.4.0 Win32 WGL Null EGL OSMesa MinGW DLL
|
||||
@endcode
|
||||
```
|
||||
|
||||
Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may
|
||||
result in a version string like this:
|
||||
|
||||
@code
|
||||
```c
|
||||
3.4.0 Wayland X11 GLX Null EGL OSMesa monotonic
|
||||
@endcode
|
||||
```
|
||||
|
||||
*/
|
@ -1,8 +1,4 @@
|
||||
/*!
|
||||
|
||||
@mainpage notitle
|
||||
|
||||
@section main_intro Introduction
|
||||
# Introduction {#mainpage}
|
||||
|
||||
GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and
|
||||
Vulkan application development. It provides a simple, platform-independent API
|
||||
@ -43,4 +39,3 @@ This documentation was generated with Doxygen. The sources for it are available
|
||||
in both the [source distribution](https://www.glfw.org/download.html) and
|
||||
[GitHub repository](https://github.com/glfw/glfw).
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Monitor guide {#monitor_guide}
|
||||
|
||||
@page monitor_guide Monitor guide
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide introduces the monitor related functions of GLFW. For details on
|
||||
a specific function in this category, see the @ref monitor. There are also
|
||||
@ -15,7 +13,7 @@ guides for the other areas of GLFW.
|
||||
- @ref input_guide
|
||||
|
||||
|
||||
@section monitor_object Monitor objects
|
||||
## Monitor objects {#monitor_object}
|
||||
|
||||
A monitor object represents a currently connected monitor and is represented as
|
||||
a pointer to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type
|
||||
@ -36,42 +34,42 @@ To see how GLFW views your monitor setup and its available video modes, run the
|
||||
`monitors` test program.
|
||||
|
||||
|
||||
@subsection monitor_monitors Retrieving monitors
|
||||
### Retrieving monitors {#monitor_monitors}
|
||||
|
||||
The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is the user's
|
||||
preferred monitor and is usually the one with global UI elements like task bar
|
||||
or menu bar.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWmonitor* primary = glfwGetPrimaryMonitor();
|
||||
@endcode
|
||||
```
|
||||
|
||||
You can retrieve all currently connected monitors with @ref glfwGetMonitors.
|
||||
See the reference documentation for the lifetime of the returned array.
|
||||
|
||||
@code
|
||||
```c
|
||||
int count;
|
||||
GLFWmonitor** monitors = glfwGetMonitors(&count);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The primary monitor is always the first monitor in the returned array, but other
|
||||
monitors may be moved to a different index when a monitor is connected or
|
||||
disconnected.
|
||||
|
||||
|
||||
@subsection monitor_event Monitor configuration changes
|
||||
### Monitor configuration changes {#monitor_event}
|
||||
|
||||
If you wish to be notified when a monitor is connected or disconnected, set
|
||||
a monitor callback.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetMonitorCallback(monitor_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The callback function receives the handle for the monitor that has been
|
||||
connected or disconnected and the event that occurred.
|
||||
|
||||
@code
|
||||
```c
|
||||
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
{
|
||||
if (event == GLFW_CONNECTED)
|
||||
@ -83,7 +81,7 @@ void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
// The monitor was disconnected
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
If a monitor is disconnected, all windows that are full screen on it will be
|
||||
switched to windowed mode before the callback is called. Only @ref
|
||||
@ -91,14 +89,14 @@ glfwGetMonitorName and @ref glfwGetMonitorUserPointer will return useful values
|
||||
for a disconnected monitor and only before the monitor callback returns.
|
||||
|
||||
|
||||
@section monitor_properties Monitor properties
|
||||
## Monitor properties {#monitor_properties}
|
||||
|
||||
Each monitor has a current video mode, a list of supported video modes,
|
||||
a virtual position, a content scale, a human-readable name, a user pointer, an
|
||||
estimated physical size and a gamma ramp.
|
||||
|
||||
|
||||
@subsection monitor_modes Video modes
|
||||
### Video modes {#monitor_modes}
|
||||
|
||||
GLFW generally does a good job selecting a suitable video mode when you create
|
||||
a full screen window, change its video mode or make a windowed one full
|
||||
@ -109,101 +107,93 @@ Video modes are represented as @ref GLFWvidmode structures. You can get an
|
||||
array of the video modes supported by a monitor with @ref glfwGetVideoModes.
|
||||
See the reference documentation for the lifetime of the returned array.
|
||||
|
||||
@code
|
||||
```c
|
||||
int count;
|
||||
GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
||||
@endcode
|
||||
```
|
||||
|
||||
To get the current video mode of a monitor call @ref glfwGetVideoMode. See the
|
||||
reference documentation for the lifetime of the returned pointer.
|
||||
|
||||
@code
|
||||
```c
|
||||
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The resolution of a video mode is specified in
|
||||
[screen coordinates](@ref coordinate_systems), not pixels.
|
||||
|
||||
|
||||
@subsection monitor_size Physical size
|
||||
### Physical size {#monitor_size}
|
||||
|
||||
The physical size of a monitor in millimetres, or an estimation of it, can be
|
||||
retrieved with @ref glfwGetMonitorPhysicalSize. This has no relation to its
|
||||
current _resolution_, i.e. the width and height of its current
|
||||
[video mode](@ref monitor_modes).
|
||||
|
||||
@code
|
||||
```c
|
||||
int width_mm, height_mm;
|
||||
glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm);
|
||||
@endcode
|
||||
```
|
||||
|
||||
While this can be used to calculate the raw DPI of a monitor, this is often not
|
||||
useful. Instead, use the [monitor content scale](@ref monitor_scale) and
|
||||
[window content scale](@ref window_scale) to scale your content.
|
||||
|
||||
|
||||
@subsection monitor_scale Content scale
|
||||
### Content scale {#monitor_scale}
|
||||
|
||||
The content scale for a monitor can be retrieved with @ref
|
||||
glfwGetMonitorContentScale.
|
||||
|
||||
@code
|
||||
```c
|
||||
float xscale, yscale;
|
||||
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The content scale is the ratio between the current DPI and the platform's
|
||||
default DPI. This is especially important for text and any UI elements. If the
|
||||
pixel dimensions of your UI scaled by this look appropriate on your machine then
|
||||
it should appear at a reasonable size on other machines regardless of their DPI
|
||||
and scaling settings. This relies on the system DPI and scaling settings being
|
||||
somewhat correct.
|
||||
|
||||
The content scale may depend on both the monitor resolution and pixel density
|
||||
and on user settings. It may be very different from the raw DPI calculated from
|
||||
the physical size and current resolution.
|
||||
For more information on what the content scale is and how to use it, see
|
||||
[window content scale](@ref window_scale).
|
||||
|
||||
|
||||
@subsection monitor_pos Virtual position
|
||||
### Virtual position {#monitor_pos}
|
||||
|
||||
The position of the monitor on the virtual desktop, in
|
||||
[screen coordinates](@ref coordinate_systems), can be retrieved with @ref
|
||||
glfwGetMonitorPos.
|
||||
|
||||
@code
|
||||
```c
|
||||
int xpos, ypos;
|
||||
glfwGetMonitorPos(monitor, &xpos, &ypos);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection monitor_workarea Work area
|
||||
### Work area {#monitor_workarea}
|
||||
|
||||
The area of a monitor not occupied by global task bars or menu bars is the work
|
||||
area. This is specified in [screen coordinates](@ref coordinate_systems) and
|
||||
can be retrieved with @ref glfwGetMonitorWorkarea.
|
||||
|
||||
@code
|
||||
```c
|
||||
int xpos, ypos, width, height;
|
||||
glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection monitor_name Human-readable name
|
||||
### Human-readable name {#monitor_name}
|
||||
|
||||
The human-readable, UTF-8 encoded name of a monitor is returned by @ref
|
||||
glfwGetMonitorName. See the reference documentation for the lifetime of the
|
||||
returned string.
|
||||
|
||||
@code
|
||||
```c
|
||||
const char* name = glfwGetMonitorName(monitor);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Monitor names are not guaranteed to be unique. Two monitors of the same model
|
||||
and make may have the same name. Only the monitor handle is guaranteed to be
|
||||
unique, and only until that monitor is disconnected.
|
||||
|
||||
|
||||
@subsection monitor_userptr User pointer
|
||||
### User pointer {#monitor_userptr}
|
||||
|
||||
Each monitor has a user pointer that can be set with @ref
|
||||
glfwSetMonitorUserPointer and queried with @ref glfwGetMonitorUserPointer. This
|
||||
@ -214,12 +204,12 @@ terminated.
|
||||
The initial value of the pointer is `NULL`.
|
||||
|
||||
|
||||
@subsection monitor_gamma Gamma ramp
|
||||
### Gamma ramp {#monitor_gamma}
|
||||
|
||||
The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts
|
||||
a monitor handle and a pointer to a @ref GLFWgammaramp structure.
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWgammaramp ramp;
|
||||
unsigned short red[256], green[256], blue[256];
|
||||
|
||||
@ -234,7 +224,7 @@ for (i = 0; i < ramp.size; i++)
|
||||
}
|
||||
|
||||
glfwSetGammaRamp(monitor, &ramp);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The gamma ramp data is copied before the function returns, so there is no need
|
||||
to keep it around once the ramp has been set.
|
||||
@ -245,17 +235,17 @@ ramp for that monitor.
|
||||
The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp. See
|
||||
the reference documentation for the lifetime of the returned structure.
|
||||
|
||||
@code
|
||||
```c
|
||||
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
|
||||
@endcode
|
||||
```
|
||||
|
||||
If you wish to set a regular gamma ramp, you can have GLFW calculate it for you
|
||||
from the desired exponent with @ref glfwSetGamma, which in turn calls @ref
|
||||
glfwSetGammaRamp with the resulting ramp.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetGamma(monitor, 1.0);
|
||||
@endcode
|
||||
```
|
||||
|
||||
To experiment with gamma correction via the @ref glfwSetGamma function, run the
|
||||
`gamma` test program.
|
||||
@ -265,4 +255,3 @@ hardware gamma correction, which today is typically an approximation of sRGB
|
||||
gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will
|
||||
produce the default (usually sRGB-like) behavior.
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Moving from GLFW 2 to 3 {#moving_guide}
|
||||
|
||||
@page moving_guide Moving from GLFW 2 to 3
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This is a transition guide for moving from GLFW 2 to 3. It describes what has
|
||||
changed or been removed, but does _not_ include
|
||||
@ -11,61 +9,64 @@ base onto the new API. For example, the new multi-monitor functions are
|
||||
required to create full screen windows with GLFW 3.
|
||||
|
||||
|
||||
@section moving_removed Changed and removed features
|
||||
## Changed and removed features {#moving_removed}
|
||||
|
||||
@subsection moving_renamed_files Renamed library and header file
|
||||
### Renamed library and header file {#moving_renamed_files}
|
||||
|
||||
The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to
|
||||
avoid collisions with the headers of other major versions. Similarly, the GLFW
|
||||
3 library is named `glfw3,` except when it's installed as a shared library on
|
||||
Unix-like systems, where it uses the
|
||||
[soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`.
|
||||
Unix-like systems, where it uses the [soname][] `libglfw.so.3`.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
[soname]: https://en.wikipedia.org/wiki/soname
|
||||
|
||||
__Old syntax__
|
||||
```c
|
||||
#include <GL/glfw.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection moving_threads Removal of threading functions
|
||||
### Removal of threading functions {#moving_threads}
|
||||
|
||||
The threading functions have been removed, including the per-thread sleep
|
||||
function. They were fairly primitive, under-used, poorly integrated and took
|
||||
time away from the focus of GLFW (i.e. context, input and window). There are
|
||||
better threading libraries available and native threading support is available
|
||||
in both [C++11](https://en.cppreference.com/w/cpp/thread) and
|
||||
[C11](https://en.cppreference.com/w/c/thread), both of which are gaining
|
||||
traction.
|
||||
in both [C++11][] and [C11][], both of which are gaining traction.
|
||||
|
||||
[C++11]: https://en.cppreference.com/w/cpp/thread
|
||||
[C11]: https://en.cppreference.com/w/c/thread
|
||||
|
||||
If you wish to use the C++11 or C11 facilities but your compiler doesn't yet
|
||||
support them, see the
|
||||
[TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and
|
||||
[TinyCThread](https://github.com/tinycthread/tinycthread) projects created by
|
||||
support them, see the [TinyThread++][] and [TinyCThread][] projects created by
|
||||
the original author of GLFW. These libraries implement a usable subset of the
|
||||
threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use
|
||||
TinyCThread.
|
||||
|
||||
[TinyThread++]: https://gitorious.org/tinythread/tinythreadpp
|
||||
[TinyCThread]: https://github.com/tinycthread/tinycthread
|
||||
|
||||
However, GLFW 3 has better support for _use from multiple threads_ than GLFW
|
||||
2 had. Contexts can be made current on any thread, although only a single
|
||||
thread at a time, and the documentation explicitly states which functions may be
|
||||
used from any thread and which must only be used from the main thread.
|
||||
|
||||
@par Removed functions
|
||||
`glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`,
|
||||
`glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`,
|
||||
`glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`,
|
||||
`glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`.
|
||||
__Removed functions__
|
||||
> `glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`,
|
||||
> `glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`,
|
||||
> `glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`,
|
||||
> `glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`.
|
||||
|
||||
@par Removed types
|
||||
`GLFWthreadfun`
|
||||
__Removed types__
|
||||
> `GLFWthreadfun`
|
||||
|
||||
|
||||
@subsection moving_image Removal of image and texture loading
|
||||
### Removal of image and texture loading {#moving_image}
|
||||
|
||||
The image and texture loading functions have been removed. They only supported
|
||||
the Targa image format, making them mostly useful for beginner level examples.
|
||||
@ -79,94 +80,97 @@ As there already are libraries doing this, it is unnecessary both to duplicate
|
||||
the work and to tie the duplicate to GLFW. The resulting library would also be
|
||||
platform-independent, as both OpenGL and stdio are available wherever GLFW is.
|
||||
|
||||
@par Removed functions
|
||||
`glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`,
|
||||
`glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`.
|
||||
__Removed functions__
|
||||
> `glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`,
|
||||
> `glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`.
|
||||
|
||||
|
||||
@subsection moving_stdcall Removal of GLFWCALL macro
|
||||
### Removal of GLFWCALL macro {#moving_stdcall}
|
||||
|
||||
The `GLFWCALL` macro, which made callback functions use
|
||||
[__stdcall](https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows,
|
||||
has been removed. GLFW is written in C, not Pascal. Removing this macro means
|
||||
there's one less thing for application programmers to remember, i.e. the
|
||||
requirement to mark all callback functions with `GLFWCALL`. It also simplifies
|
||||
the creation of DLLs and DLL link libraries, as there's no need to explicitly
|
||||
disable `@n` entry point suffixes.
|
||||
The `GLFWCALL` macro, which made callback functions use [\_\_stdcall][stdcall]
|
||||
on Windows, has been removed. GLFW is written in C, not Pascal. Removing this
|
||||
macro means there's one less thing for application programmers to remember, i.e.
|
||||
the requirement to mark all callback functions with `GLFWCALL`. It also
|
||||
simplifies the creation of DLLs and DLL link libraries, as there's no need to
|
||||
explicitly disable `@n` entry point suffixes.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
[stdcall]: https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx
|
||||
|
||||
__Old syntax__
|
||||
```c
|
||||
void GLFWCALL callback_function(...);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
void callback_function(...);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection moving_window_handles Window handle parameters
|
||||
### Window handle parameters {#moving_window_handles}
|
||||
|
||||
Because GLFW 3 supports multiple windows, window handle parameters have been
|
||||
added to all window-related GLFW functions and callbacks. The handle of
|
||||
a newly created window is returned by @ref glfwCreateWindow (formerly
|
||||
`glfwOpenWindow`). Window handles are pointers to the
|
||||
[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWwindow.
|
||||
[opaque][opaque-type] type @ref GLFWwindow.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
[opaque-type]: https://en.wikipedia.org/wiki/Opaque_data_type
|
||||
|
||||
__Old syntax__
|
||||
```c
|
||||
glfwSetWindowTitle("New Window Title");
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
glfwSetWindowTitle(window, "New Window Title");
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection moving_monitor Explicit monitor selection
|
||||
### Explicit monitor selection {#moving_monitor}
|
||||
|
||||
GLFW 3 provides support for multiple monitors. To request a full screen mode window,
|
||||
instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the
|
||||
window to use. The @ref glfwGetPrimaryMonitor function returns the monitor that
|
||||
GLFW 2 would have selected, but there are many other
|
||||
[monitor functions](@ref monitor_guide). Monitor handles are pointers to the
|
||||
[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWmonitor.
|
||||
[opaque][opaque-type] type @ref GLFWmonitor.
|
||||
|
||||
@par Old basic full screen
|
||||
@code
|
||||
__Old basic full screen__
|
||||
```c
|
||||
glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_FULLSCREEN);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New basic full screen
|
||||
@code
|
||||
__New basic full screen__
|
||||
```c
|
||||
window = glfwCreateWindow(640, 480, "My Window", glfwGetPrimaryMonitor(), NULL);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@note The framebuffer bit depth parameters of `glfwOpenWindow` have been turned
|
||||
into [window hints](@ref window_hints), but as they have been given
|
||||
[sane defaults](@ref window_hints_values) you rarely need to set these hints.
|
||||
|
||||
|
||||
@subsection moving_autopoll Removal of automatic event polling
|
||||
### Removal of automatic event polling {#moving_autopoll}
|
||||
|
||||
GLFW 3 does not automatically poll for events in @ref glfwSwapBuffers, meaning
|
||||
you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself. Unlike
|
||||
buffer swap, which acts on a single window, the event processing functions act
|
||||
on all windows at once.
|
||||
|
||||
@par Old basic main loop
|
||||
@code
|
||||
__Old basic main loop__
|
||||
```c
|
||||
while (...)
|
||||
{
|
||||
// Process input
|
||||
// Render output
|
||||
glfwSwapBuffers();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New basic main loop
|
||||
@code
|
||||
__New basic main loop__
|
||||
```c
|
||||
while (...)
|
||||
{
|
||||
// Process input
|
||||
@ -174,10 +178,10 @@ while (...)
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection moving_context Explicit context management
|
||||
### Explicit context management {#moving_context}
|
||||
|
||||
Each GLFW 3 window has its own OpenGL context and only you, the application
|
||||
programmer, can know which context should be current on which thread at any
|
||||
@ -187,7 +191,7 @@ This means that you need to call @ref glfwMakeContextCurrent after creating
|
||||
a window before you can call any OpenGL functions.
|
||||
|
||||
|
||||
@subsection moving_hidpi Separation of window and framebuffer sizes
|
||||
### Separation of window and framebuffer sizes {#moving_hidpi}
|
||||
|
||||
Window positions and sizes now use screen coordinates, which may not be the same
|
||||
as pixels on machines with high-DPI monitors. This is important as OpenGL uses
|
||||
@ -197,20 +201,20 @@ been added. You can retrieve the size of the framebuffer of a window with @ref
|
||||
glfwGetFramebufferSize function. A framebuffer size callback has also been
|
||||
added, which can be set with @ref glfwSetFramebufferSizeCallback.
|
||||
|
||||
@par Old basic viewport setup
|
||||
@code
|
||||
__Old basic viewport setup__
|
||||
```c
|
||||
glfwGetWindowSize(&width, &height);
|
||||
glViewport(0, 0, width, height);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New basic viewport setup
|
||||
@code
|
||||
__New basic viewport setup__
|
||||
```c
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
glViewport(0, 0, width, height);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection moving_window_close Window closing changes
|
||||
### Window closing changes {#moving_window_close}
|
||||
|
||||
The `GLFW_OPENED` window parameter has been removed. As long as the window has
|
||||
not been destroyed, whether through @ref glfwDestroyWindow or @ref
|
||||
@ -226,43 +230,43 @@ the window, take some other action or ignore the request.
|
||||
You can query the close flag at any time with @ref glfwWindowShouldClose and set
|
||||
it at any time with @ref glfwSetWindowShouldClose.
|
||||
|
||||
@par Old basic main loop
|
||||
@code
|
||||
__Old basic main loop__
|
||||
```c
|
||||
while (glfwGetWindowParam(GLFW_OPENED))
|
||||
{
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New basic main loop
|
||||
@code
|
||||
__New basic main loop__
|
||||
```c
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The close callback no longer returns a value. Instead, it is called after the
|
||||
close flag has been set, so it can optionally override its value, before
|
||||
event processing completes. You may however not call @ref glfwDestroyWindow
|
||||
from the close callback (or any other window related callback).
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
__Old syntax__
|
||||
```c
|
||||
int GLFWCALL window_close_callback(void);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
void window_close_callback(GLFWwindow* window);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@note GLFW never clears the close flag to `GLFW_FALSE`, meaning you can use it
|
||||
for other reasons to close the window as well, for example the user choosing
|
||||
Quit from an in-game menu.
|
||||
|
||||
|
||||
@subsection moving_hints Persistent window hints
|
||||
### Persistent window hints {#moving_hints}
|
||||
|
||||
The `glfwOpenWindowHint` function has been renamed to @ref glfwWindowHint.
|
||||
|
||||
@ -271,7 +275,7 @@ instead retain their values until modified by @ref glfwWindowHint or @ref
|
||||
glfwDefaultWindowHints, or until the library is terminated and re-initialized.
|
||||
|
||||
|
||||
@subsection moving_video_modes Video mode enumeration
|
||||
### Video mode enumeration {#moving_video_modes}
|
||||
|
||||
Video mode enumeration is now per-monitor. The @ref glfwGetVideoModes function
|
||||
now returns all available modes for a specific monitor instead of requiring you
|
||||
@ -280,7 +284,7 @@ had poorly defined behavior, has been replaced by @ref glfwGetVideoMode, which
|
||||
returns the current mode of a monitor.
|
||||
|
||||
|
||||
@subsection moving_char_up Removal of character actions
|
||||
### Removal of character actions {#moving_char_up}
|
||||
|
||||
The action parameter of the [character callback](@ref GLFWcharfun) has been
|
||||
removed. This was an artefact of the origin of GLFW, i.e. being developed in
|
||||
@ -288,18 +292,18 @@ English by a Swede. However, many keyboard layouts require more than one key to
|
||||
produce characters with diacritical marks. Even the Swedish keyboard layout
|
||||
requires this for uncommon cases like ü.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
__Old syntax__
|
||||
```c
|
||||
void GLFWCALL character_callback(int character, int action);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
void character_callback(GLFWwindow* window, int character);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection moving_cursorpos Cursor position changes
|
||||
### Cursor position changes {#moving_cursorpos}
|
||||
|
||||
The `glfwGetMousePos` function has been renamed to @ref glfwGetCursorPos,
|
||||
`glfwSetMousePos` to @ref glfwSetCursorPos and `glfwSetMousePosCallback` to @ref
|
||||
@ -315,7 +319,7 @@ glfwSetCursorPos (formerly `glfwSetMousePos`) when that window is active.
|
||||
Unless the window is active, the function fails silently.
|
||||
|
||||
|
||||
@subsection moving_wheel Wheel position replaced by scroll offsets
|
||||
### Wheel position replaced by scroll offsets {#moving_wheel}
|
||||
|
||||
The `glfwGetMouseWheel` function has been removed. Scrolling is the input of
|
||||
offsets and has no absolute position. The mouse wheel callback has been
|
||||
@ -323,21 +327,21 @@ replaced by a [scroll callback](@ref GLFWscrollfun) that receives
|
||||
two-dimensional floating point scroll offsets. This allows you to receive
|
||||
precise scroll data from for example modern touchpads.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
__Old syntax__
|
||||
```c
|
||||
void GLFWCALL mouse_wheel_callback(int position);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par Removed functions
|
||||
`glfwGetMouseWheel`
|
||||
__Removed functions__
|
||||
> `glfwGetMouseWheel`
|
||||
|
||||
|
||||
@subsection moving_repeat Key repeat action
|
||||
### Key repeat action {#moving_repeat}
|
||||
|
||||
The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled
|
||||
for both keys and characters. A new key action, `GLFW_REPEAT`, has been added
|
||||
@ -346,7 +350,7 @@ from a repeat. Note that @ref glfwGetKey still returns only `GLFW_PRESS` or
|
||||
`GLFW_RELEASE`.
|
||||
|
||||
|
||||
@subsection moving_keys Physical key input
|
||||
### Physical key input {#moving_keys}
|
||||
|
||||
GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to
|
||||
the values generated by the current keyboard layout. The tokens are named
|
||||
@ -366,7 +370,7 @@ having to remember whether to check for `a` or `A`, you now check for
|
||||
@ref GLFW_KEY_A.
|
||||
|
||||
|
||||
@subsection moving_joystick Joystick function changes
|
||||
### Joystick function changes {#moving_joystick}
|
||||
|
||||
The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes.
|
||||
|
||||
@ -376,18 +380,19 @@ function as well as axis and button counts returned by the @ref
|
||||
glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions.
|
||||
|
||||
|
||||
@subsection moving_mbcs Win32 MBCS support
|
||||
### Win32 MBCS support {#moving_mbcs}
|
||||
|
||||
The Win32 port of GLFW 3 will not compile in
|
||||
[MBCS mode](https://msdn.microsoft.com/en-us/library/5z097dxa.aspx).
|
||||
However, because the use of the Unicode version of the Win32 API doesn't affect
|
||||
the process as a whole, but only those windows created using it, it's perfectly
|
||||
The Win32 port of GLFW 3 will not compile in [MBCS mode][MBCS]. However,
|
||||
because the use of the Unicode version of the Win32 API doesn't affect the
|
||||
process as a whole, but only those windows created using it, it's perfectly
|
||||
possible to call MBCS functions from other parts of the same application.
|
||||
Therefore, even if an application using GLFW has MBCS mode code, there's no need
|
||||
for GLFW itself to support it.
|
||||
|
||||
[MBCS]: https://msdn.microsoft.com/en-us/library/5z097dxa.aspx
|
||||
|
||||
@subsection moving_windows Support for versions of Windows older than XP
|
||||
|
||||
### Support for versions of Windows older than XP {#moving_windows}
|
||||
|
||||
All explicit support for version of Windows older than XP has been removed.
|
||||
There is no code that actively prevents GLFW 3 from running on these earlier
|
||||
@ -407,7 +412,7 @@ runtime checking for a number of functions that are present only on modern
|
||||
version of Windows.
|
||||
|
||||
|
||||
@subsection moving_syskeys Capture of system-wide hotkeys
|
||||
### Capture of system-wide hotkeys {#moving_syskeys}
|
||||
|
||||
The ability to disable and capture system-wide hotkeys like Alt+Tab has been
|
||||
removed. Modern applications, whether they're games, scientific visualisations
|
||||
@ -415,7 +420,7 @@ or something else, are nowadays expected to be good desktop citizens and allow
|
||||
these hotkeys to function even when running in full screen mode.
|
||||
|
||||
|
||||
@subsection moving_terminate Automatic termination
|
||||
### Automatic termination {#moving_terminate}
|
||||
|
||||
GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization,
|
||||
because `exit` calls registered functions from the calling thread and while it
|
||||
@ -428,37 +433,41 @@ destroys all windows not already destroyed with @ref glfwDestroyWindow,
|
||||
invalidating any window handles you may still have.
|
||||
|
||||
|
||||
@subsection moving_glu GLU header inclusion
|
||||
### GLU header inclusion {#moving_glu}
|
||||
|
||||
GLFW 3 does not by default include the GLU header and GLU itself has been
|
||||
deprecated by [Khronos](https://en.wikipedia.org/wiki/Khronos_Group). __New
|
||||
projects should not use GLU__, but if you need it for legacy code that
|
||||
has been moved to GLFW 3, you can request that the GLFW header includes it by
|
||||
defining @ref GLFW_INCLUDE_GLU before the inclusion of the GLFW header.
|
||||
deprecated by [Khronos][]. __New projects should not use GLU__, but if you need
|
||||
it for legacy code that has been moved to GLFW 3, you can request that the GLFW
|
||||
header includes it by defining @ref GLFW_INCLUDE_GLU before the inclusion of the
|
||||
GLFW header.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
[Khronos]: https://en.wikipedia.org/wiki/Khronos_Group
|
||||
|
||||
__Old syntax__
|
||||
```c
|
||||
#include <GL/glfw.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
@par New syntax
|
||||
@code
|
||||
__New syntax__
|
||||
```c
|
||||
#define GLFW_INCLUDE_GLU
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
There are many libraries that offer replacements for the functionality offered
|
||||
by GLU. For the matrix helper functions, see math libraries like
|
||||
[GLM](https://github.com/g-truc/glm) (for C++),
|
||||
[linmath.h](https://github.com/datenwolf/linmath.h) (for C) and others. For the
|
||||
tessellation functions, see for example
|
||||
[libtess2](https://github.com/memononen/libtess2).
|
||||
by GLU. For the matrix helper functions, see math libraries like [GLM][] (for
|
||||
C++), [linmath.h][] (for C) and others. For the tessellation functions, see for
|
||||
example [libtess2][].
|
||||
|
||||
[GLM]: https://github.com/g-truc/glm
|
||||
[linmath.h]: https://github.com/datenwolf/linmath.h
|
||||
[libtess2]: https://github.com/memononen/libtess2
|
||||
|
||||
|
||||
@section moving_tables Name change tables
|
||||
## Name change tables {#moving_tables}
|
||||
|
||||
|
||||
@subsection moving_renamed_functions Renamed functions
|
||||
### Renamed functions {#moving_renamed_functions}
|
||||
|
||||
| GLFW 2 | GLFW 3 | Notes |
|
||||
| --------------------------- | ----------------------------- | ----- |
|
||||
@ -478,7 +487,7 @@ tessellation functions, see for example
|
||||
| `glfwGetJoystickParam` | @ref glfwJoystickPresent | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons |
|
||||
|
||||
|
||||
@subsection moving_renamed_types Renamed types
|
||||
### Renamed types {#moving_renamed_types}
|
||||
|
||||
| GLFW 2 | GLFW 3 | Notes |
|
||||
| ------------------- | --------------------- | |
|
||||
@ -486,7 +495,7 @@ tessellation functions, see for example
|
||||
| `GLFWmouseposfun` | @ref GLFWcursorposfun | |
|
||||
|
||||
|
||||
@subsection moving_renamed_tokens Renamed tokens
|
||||
### Renamed tokens {#moving_renamed_tokens}
|
||||
|
||||
| GLFW 2 | GLFW 3 | Notes |
|
||||
| --------------------------- | ---------------------------- | ----- |
|
||||
@ -510,4 +519,3 @@ tessellation functions, see for example
|
||||
| `GLFW_KEY_RALT` | `GLFW_KEY_RIGHT_ALT` | |
|
||||
| `GLFW_KEY_RSUPER` | `GLFW_KEY_RIGHT_SUPER` | |
|
||||
|
||||
*/
|
@ -1,15 +1,13 @@
|
||||
/*!
|
||||
# Release notes {#news}
|
||||
|
||||
@page news Release notes
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
|
||||
@section news_34 Release notes for version 3.4
|
||||
## Release notes for version 3.4 {#news_34}
|
||||
|
||||
@subsection features_34 New features in version 3.4
|
||||
### New features in version 3.4 {#features_34}
|
||||
|
||||
@subsubsection runtime_platform_34 Runtime platform selection
|
||||
#### Runtime platform selection {#runtime_platform_34}
|
||||
|
||||
GLFW now supports being compiled for multiple backends and selecting between
|
||||
them at runtime with the @ref GLFW_PLATFORM init hint. After initialization the
|
||||
@ -17,7 +15,7 @@ selected platform can be queried with @ref glfwGetPlatform. You can check if
|
||||
support for a given platform is compiled in with @ref glfwPlatformSupported.
|
||||
|
||||
|
||||
@subsubsection standard_cursors_34 More standard cursors
|
||||
#### More standard cursors {#standard_cursors_34}
|
||||
|
||||
GLFW now provides the standard cursor shapes @ref GLFW_RESIZE_NWSE_CURSOR and
|
||||
@ref GLFW_RESIZE_NESW_CURSOR for diagonal resizing, @ref GLFW_RESIZE_ALL_CURSOR
|
||||
@ -35,7 +33,7 @@ are still available.
|
||||
For more information see @ref cursor_standard.
|
||||
|
||||
|
||||
@subsubsection mouse_passthrough_34 Mouse event passthrough
|
||||
#### Mouse event passthrough {#mouse_passthrough_34}
|
||||
|
||||
GLFW now provides the [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_hint)
|
||||
window hint for making a window transparent to mouse input, lettings events pass
|
||||
@ -43,7 +41,7 @@ to whatever window is behind it. This can also be changed after window
|
||||
creation with the matching [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
|
||||
|
||||
|
||||
@subsubsection wayland_libdecor_34 Wayland libdecor decorations
|
||||
#### Wayland libdecor decorations {#wayland_libdecor_34}
|
||||
|
||||
GLFW now supports improved fallback window decorations via
|
||||
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor).
|
||||
@ -53,22 +51,23 @@ Support for libdecor can be toggled before GLFW is initialized with the
|
||||
enabled by default.
|
||||
|
||||
|
||||
@subsubsection wayland_app_id_34 Wayland app_id specification
|
||||
#### Wayland app_id specification {#wayland_app_id_34}
|
||||
|
||||
GLFW now supports specifying the app_id for a Wayland window using the
|
||||
[GLFW_WAYLAND_APP_ID](@ref GLFW_WAYLAND_APP_ID_hint) window hint string.
|
||||
|
||||
|
||||
@subsubsection features_34_angle_backend Support for ANGLE rendering backend selection
|
||||
#### Support for ANGLE rendering backend selection {#features_34_angle_backend}
|
||||
|
||||
GLFW now provides the
|
||||
[GLFW_ANGLE_PLATFORM_TYPE](@ref GLFW_ANGLE_PLATFORM_TYPE_hint) init hint for
|
||||
requesting a specific rendering backend when using
|
||||
[ANGLE](https://chromium.googlesource.com/angle/angle/) to create OpenGL ES
|
||||
requesting a specific rendering backend when using [ANGLE][] to create OpenGL ES
|
||||
contexts.
|
||||
|
||||
[ANGLE]: https://chromium.googlesource.com/angle/angle/
|
||||
|
||||
@subsubsection captured_cursor_34 Captured cursor mode
|
||||
|
||||
#### Captured cursor mode {#captured_cursor_34}
|
||||
|
||||
GLFW now supports confining the cursor to the window content area with the @ref
|
||||
GLFW_CURSOR_CAPTURED cursor mode.
|
||||
@ -76,7 +75,7 @@ GLFW_CURSOR_CAPTURED cursor mode.
|
||||
For more information see @ref cursor_mode.
|
||||
|
||||
|
||||
@subsubsection features_34_init_allocator Support for custom memory allocator
|
||||
#### Support for custom memory allocator {#features_34_init_allocator}
|
||||
|
||||
GLFW now supports plugging a custom memory allocator at initialization with @ref
|
||||
glfwInitAllocator. The allocator is a struct of type @ref GLFWallocator with
|
||||
@ -86,7 +85,23 @@ function pointers corresponding to the standard library functions `malloc`,
|
||||
For more information see @ref init_allocator.
|
||||
|
||||
|
||||
@subsubsection features_34_position_hint Window hints for initial position
|
||||
#### Window hint for framebuffer scaling {#scale_framebuffer_34}
|
||||
|
||||
GLFW now allows provides the
|
||||
[GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
|
||||
controlling framebuffer scaling on platforms that handle scaling by keeping the
|
||||
window size the same while resizing the framebuffer. The default value is to
|
||||
allow framebuffer scaling.
|
||||
|
||||
This was already possible on macOS via the
|
||||
[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) window
|
||||
hint. This hint is now another name for
|
||||
[GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint).
|
||||
|
||||
For more information, see @ref window_scale.
|
||||
|
||||
|
||||
#### Window hints for initial position {#features_34_position_hint}
|
||||
|
||||
GLFW now provides the @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints for
|
||||
specifying the initial position of the window. This removes the need to create a hidden
|
||||
@ -94,7 +109,7 @@ window, move it and then show it. The default value of these hints is
|
||||
`GLFW_ANY_POSITION`, which selects the previous behavior.
|
||||
|
||||
|
||||
@subsubsection features_34_win32_keymenu Support for keyboard access to Windows window menu
|
||||
#### Support for keyboard access to Windows window menu {#features_34_win32_keymenu}
|
||||
|
||||
GLFW now provides the
|
||||
[GLFW_WIN32_KEYBOARD_MENU](@ref GLFW_WIN32_KEYBOARD_MENU_hint) window hint for
|
||||
@ -103,9 +118,16 @@ Alt-and-then-Space shortcuts. This may be useful for more GUI-oriented
|
||||
applications.
|
||||
|
||||
|
||||
@subsection caveats Caveats for version 3.4
|
||||
#### Support for applying STARTUPINFO show command {#features_34_win32_showdefault}
|
||||
|
||||
@subsubsection native_34 Multiple sets of native access functions
|
||||
GLFW now provides the [GLFW_WIN32_SHOWDEFAULT](@ref GLFW_WIN32_SHOWDEFAULT_hint) window
|
||||
hint for applying the show command in the program's `STARTUPINFO` when showing the window
|
||||
for the first time. This may be useful for the main window of a windowed-mode tool.
|
||||
|
||||
|
||||
### Caveats for version 3.4 {#caveats}
|
||||
|
||||
#### Multiple sets of native access functions {#native_34}
|
||||
|
||||
Because GLFW now supports runtime selection of platform (window system), a library binary
|
||||
may export native access functions for multiple platforms. Starting with version 3.4 you
|
||||
@ -114,14 +136,14 @@ functions for it. After initialization, you can query the selected platform wit
|
||||
glfwGetPlatform.
|
||||
|
||||
|
||||
@subsubsection version_string_34 Version string format has been changed
|
||||
#### Version string format has been changed {#version_string_34}
|
||||
|
||||
Because GLFW now supports runtime selection of platform (window system), the version
|
||||
string returned by @ref glfwGetVersionString has been expanded. It now contains the names
|
||||
of all APIs for all the platforms that the library binary supports.
|
||||
|
||||
|
||||
@subsubsection joysticks_34 Joystick support is initialized on demand
|
||||
#### Joystick support is initialized on demand {#joysticks_34}
|
||||
|
||||
The joystick part of GLFW is now initialized when first used, primarily to work
|
||||
around faulty Windows drivers that cause DirectInput to take up to several
|
||||
@ -136,7 +158,7 @@ To work around this, call any joystick function before waiting for events, for
|
||||
example by setting a [joystick callback](@ref joystick_event).
|
||||
|
||||
|
||||
@subsubsection wayland_alpha_34 Frambuffer may lack alpha channel on older Wayland systems
|
||||
#### Framebuffer may lack alpha channel on older Wayland systems {#wayland_alpha_34}
|
||||
|
||||
On Wayland, when creating an EGL context on a machine lacking the new
|
||||
`EGL_EXT_present_opaque` extension, the @ref GLFW_ALPHA_BITS window hint will be
|
||||
@ -149,51 +171,51 @@ If you want a per-pixel transparent window, see the
|
||||
hint.
|
||||
|
||||
|
||||
@subsubsection standalone_34 Tests and examples are disabled when built as a subproject
|
||||
#### Tests and examples are disabled when built as a subproject {#standalone_34}
|
||||
|
||||
GLFW now does not build the tests and examples when it is added as
|
||||
a subdirectory of another CMake project. To enable these, set the @ref
|
||||
GLFW_BUILD_TESTS and @ref GLFW_BUILD_EXAMPLES cache variables before adding the
|
||||
GLFW subdirectory.
|
||||
|
||||
@code{.cmake}
|
||||
```cmake
|
||||
set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(path/to/glfw)
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsubsection initmenu_34 macOS main menu now created at initialization
|
||||
#### macOS main menu now created at initialization {#initmenu_34}
|
||||
|
||||
GLFW now creates the main menu and completes the initialization of NSApplication
|
||||
during initialization. Programs that do not want a main menu can disable it
|
||||
with the [GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) init hint.
|
||||
|
||||
|
||||
@subsubsection corevideo_34 CoreVideo dependency has been removed
|
||||
#### CoreVideo dependency has been removed {#corevideo_34}
|
||||
|
||||
GLFW no longer depends on the CoreVideo framework on macOS and it no longer
|
||||
needs to be specified during compilation or linking.
|
||||
|
||||
|
||||
@subsubsection caveat_fbtransparency_34 Framebuffer transparency requires DWM transparency
|
||||
#### Framebuffer transparency requires DWM transparency {#caveat_fbtransparency_34}
|
||||
|
||||
GLFW no longer supports framebuffer transparency enabled via @ref
|
||||
GLFW_TRANSPARENT_FRAMEBUFFER on Windows 7 if DWM transparency is off
|
||||
(the Transparency setting under Personalization > Window Color).
|
||||
|
||||
|
||||
@subsubsection emptyevents_34 Empty events on X11 no longer round-trip to server
|
||||
#### Empty events on X11 no longer round-trip to server {#emptyevents_34}
|
||||
|
||||
Events posted with @ref glfwPostEmptyEvent now use a separate unnamed pipe
|
||||
instead of sending an X11 client event to the helper window.
|
||||
|
||||
|
||||
@subsection deprecations_34 Deprecations in version 3.4
|
||||
### Deprecations in version 3.4 {#deprecations_34}
|
||||
|
||||
@subsection removals_34 Removals in 3.4
|
||||
### Removals in 3.4 {#removals_34}
|
||||
|
||||
@subsubsection vulkan_static_34 GLFW_VULKAN_STATIC CMake option has been removed
|
||||
#### GLFW_VULKAN_STATIC CMake option has been removed {#vulkan_static_34}
|
||||
|
||||
This option was used to compile GLFW directly linked with the Vulkan loader, instead of
|
||||
using dynamic loading to get hold of `vkGetInstanceProcAddr` at initialization. This is
|
||||
@ -204,7 +226,7 @@ have no effect. The call to @ref glfwInitVulkanLoader can be conditionally enab
|
||||
your code by checking the @ref GLFW_VERSION_MAJOR and @ref GLFW_VERSION_MINOR macros.
|
||||
|
||||
|
||||
@subsubsection osmesa_option_34 GLFW_USE_OSMESA CMake option has been removed
|
||||
#### GLFW_USE_OSMESA CMake option has been removed {#osmesa_option_34}
|
||||
|
||||
This option was used to compile GLFW for the Null platform. The Null platform is now
|
||||
always supported. To produce a library binary that only supports this platform, the way
|
||||
@ -216,16 +238,16 @@ You can set all of them to false and the ones that don't apply for the target OS
|
||||
ignored.
|
||||
|
||||
|
||||
@subsubsection wl_shell_34 Support for the wl_shell protocol has been removed
|
||||
#### Support for the wl_shell protocol has been removed {#wl_shell_34}
|
||||
|
||||
Support for the wl_shell protocol has been removed and GLFW now only supports
|
||||
the XDG-Shell protocol. If your Wayland compositor does not support XDG-Shell
|
||||
then GLFW will fail to initialize.
|
||||
|
||||
|
||||
@subsection symbols_34 New symbols in version 3.4
|
||||
### New symbols in version 3.4 {#symbols_34}
|
||||
|
||||
@subsubsection functions_34 New functions in version 3.4
|
||||
#### New functions in version 3.4 {#functions_34}
|
||||
|
||||
- @ref glfwInitAllocator
|
||||
- @ref glfwGetPlatform
|
||||
@ -233,7 +255,7 @@ then GLFW will fail to initialize.
|
||||
- @ref glfwInitVulkanLoader
|
||||
|
||||
|
||||
@subsubsection types_34 New types in version 3.4
|
||||
#### New types in version 3.4 {#types_34}
|
||||
|
||||
- @ref GLFWallocator
|
||||
- @ref GLFWallocatefun
|
||||
@ -241,7 +263,7 @@ then GLFW will fail to initialize.
|
||||
- @ref GLFWdeallocatefun
|
||||
|
||||
|
||||
@subsubsection constants_34 New constants in version 3.4
|
||||
#### New constants in version 3.4 {#constants_34}
|
||||
|
||||
- @ref GLFW_PLATFORM
|
||||
- @ref GLFW_ANY_PLATFORM
|
||||
@ -261,6 +283,7 @@ then GLFW will fail to initialize.
|
||||
- @ref GLFW_NOT_ALLOWED_CURSOR
|
||||
- @ref GLFW_CURSOR_UNAVAILABLE
|
||||
- @ref GLFW_WIN32_KEYBOARD_MENU
|
||||
- @ref GLFW_WIN32_SHOWDEFAULT
|
||||
- @ref GLFW_CONTEXT_DEBUG
|
||||
- @ref GLFW_FEATURE_UNAVAILABLE
|
||||
- @ref GLFW_FEATURE_UNIMPLEMENTED
|
||||
@ -277,16 +300,17 @@ then GLFW will fail to initialize.
|
||||
- @ref GLFW_POSITION_X
|
||||
- @ref GLFW_POSITION_Y
|
||||
- @ref GLFW_ANY_POSITION
|
||||
- @ref GLFW_WAYLAND_APP_ID
|
||||
- @ref GLFW_WAYLAND_LIBDECOR
|
||||
- @ref GLFW_WAYLAND_PREFER_LIBDECOR
|
||||
- @ref GLFW_WAYLAND_DISABLE_LIBDECOR
|
||||
- @ref GLFW_SCALE_FRAMEBUFFER
|
||||
|
||||
|
||||
@section news_archive Release notes for earlier versions
|
||||
## Release notes for earlier versions {#news_archive}
|
||||
|
||||
- [Release notes for 3.3](https://www.glfw.org/docs/3.3/news.html)
|
||||
- [Release notes for 3.2](https://www.glfw.org/docs/3.2/news.html)
|
||||
- [Release notes for 3.1](https://www.glfw.org/docs/3.1/news.html)
|
||||
- [Release notes for 3.0](https://www.glfw.org/docs/3.0/news.html)
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Getting started {#quick_guide}
|
||||
|
||||
@page quick_guide Getting started
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide takes you through writing a small application using GLFW 3. The
|
||||
application will create a window and OpenGL context, render a rotating triangle
|
||||
@ -14,16 +12,16 @@ have used GLFW 2 in the past, read @ref moving_guide, as some functions
|
||||
behave differently in GLFW 3.
|
||||
|
||||
|
||||
@section quick_steps Step by step
|
||||
## Step by step {#quick_steps}
|
||||
|
||||
@subsection quick_include Including the GLFW header
|
||||
### Including the GLFW header {#quick_include}
|
||||
|
||||
In the source files of your application where you use GLFW, you need to include
|
||||
its header file.
|
||||
|
||||
@code
|
||||
```c
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
This header provides all the constants, types and function prototypes of the
|
||||
GLFW API.
|
||||
@ -38,51 +36,51 @@ This example uses files generated by [glad](https://gen.glad.sh/). The GLFW
|
||||
header can detect most such headers if they are included first and will then not
|
||||
include the one from your development environment.
|
||||
|
||||
@code
|
||||
```c
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
To make sure there will be no header conflicts, you can define @ref
|
||||
GLFW_INCLUDE_NONE before the GLFW header to explicitly disable inclusion of the
|
||||
development environment header. This also allows the two headers to be included
|
||||
in any order.
|
||||
|
||||
@code
|
||||
```c
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glad/gl.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection quick_init_term Initializing and terminating GLFW
|
||||
### Initializing and terminating GLFW {#quick_init_term}
|
||||
|
||||
Before you can use most GLFW functions, the library must be initialized. On
|
||||
successful initialization, `GLFW_TRUE` is returned. If an error occurred,
|
||||
`GLFW_FALSE` is returned.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (!glfwInit())
|
||||
{
|
||||
// Initialization failed
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
Note that `GLFW_TRUE` and `GLFW_FALSE` are and will always be one and zero.
|
||||
|
||||
When you are done using GLFW, typically just before the application exits, you
|
||||
need to terminate GLFW.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwTerminate();
|
||||
@endcode
|
||||
```
|
||||
|
||||
This destroys any remaining windows and releases any other resources allocated by
|
||||
GLFW. After this call, you must initialize GLFW again before using any GLFW
|
||||
functions that require it.
|
||||
|
||||
|
||||
@subsection quick_capture_error Setting an error callback
|
||||
### Setting an error callback {#quick_capture_error}
|
||||
|
||||
Most events are reported through callbacks, whether it's a key being pressed,
|
||||
a GLFW window being moved, or an error occurring. Callbacks are C functions (or
|
||||
@ -92,36 +90,36 @@ In case a GLFW function fails, an error is reported to the GLFW error callback.
|
||||
You can receive these reports with an error callback. This function must have
|
||||
the signature below but may do anything permitted in other callbacks.
|
||||
|
||||
@code
|
||||
```c
|
||||
void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
Callback functions must be set, so GLFW knows to call them. The function to set
|
||||
the error callback is one of the few GLFW functions that may be called before
|
||||
initialization, which lets you be notified of errors both during and after
|
||||
initialization.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetErrorCallback(error_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection quick_create_window Creating a window and context
|
||||
### Creating a window and context {#quick_create_window}
|
||||
|
||||
The window and its OpenGL context are created with a single call to @ref
|
||||
glfwCreateWindow, which returns a handle to the created combined window and
|
||||
context object
|
||||
|
||||
@code
|
||||
```c
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
// Window or OpenGL context creation failed
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
This creates a 640 by 480 windowed mode window with an OpenGL context. If
|
||||
window or OpenGL context creation fails, `NULL` will be returned. You should
|
||||
@ -138,7 +136,7 @@ You can select the OpenGL profile by setting the `GLFW_OPENGL_PROFILE` hint.
|
||||
This program uses the core profile as that is the only profile macOS supports
|
||||
for OpenGL 3.x and 4.x.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
@ -147,25 +145,25 @@ if (!window)
|
||||
{
|
||||
// Window or context creation failed
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
When a window and context is no longer needed, destroy it.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwDestroyWindow(window);
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once this function is called, no more events will be delivered for that window
|
||||
and its handle becomes invalid.
|
||||
|
||||
|
||||
@subsection quick_context_current Making the OpenGL context current
|
||||
### Making the OpenGL context current {#quick_context_current}
|
||||
|
||||
Before you can use the OpenGL API, you must have a current OpenGL context.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwMakeContextCurrent(window);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The context will remain current until you make another context current or until
|
||||
the window owning the current context is destroyed.
|
||||
@ -176,12 +174,12 @@ a current context to load from. This example uses
|
||||
[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such
|
||||
libraries.
|
||||
|
||||
@code
|
||||
```c
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection quick_window_close Checking the window close flag
|
||||
### Checking the window close flag {#quick_window_close}
|
||||
|
||||
Each window has a flag indicating whether the window should be closed.
|
||||
|
||||
@ -191,12 +189,12 @@ Note that __the window isn't actually closed__, so you are expected to monitor
|
||||
this flag and either destroy the window or give some kind of feedback to the
|
||||
user.
|
||||
|
||||
@code
|
||||
```c
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
// Keep running
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
You can be notified when the user is attempting to close the window by setting
|
||||
a close callback with @ref glfwSetWindowCloseCallback. The callback will be
|
||||
@ -207,41 +205,41 @@ useful if you want to interpret other kinds of input as closing the window, like
|
||||
for example pressing the _Escape_ key.
|
||||
|
||||
|
||||
@subsection quick_key_input Receiving input events
|
||||
### Receiving input events {#quick_key_input}
|
||||
|
||||
Each window has a large number of callbacks that can be set to receive all the
|
||||
various kinds of events. To receive key press and release events, create a key
|
||||
callback function.
|
||||
|
||||
@code
|
||||
```c
|
||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The key callback, like other window related callbacks, are set per-window.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
@endcode
|
||||
```
|
||||
|
||||
In order for event callbacks to be called when events occur, you need to process
|
||||
events as described below.
|
||||
|
||||
|
||||
@subsection quick_render Rendering with OpenGL
|
||||
### Rendering with OpenGL {#quick_render}
|
||||
|
||||
Once you have a current OpenGL context, you can use OpenGL normally. In this
|
||||
tutorial, a multicolored rotating triangle will be rendered. The framebuffer
|
||||
size needs to be retrieved for `glViewport`.
|
||||
|
||||
@code
|
||||
```c
|
||||
int width, height;
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
glViewport(0, 0, width, height);
|
||||
@endcode
|
||||
```
|
||||
|
||||
You can also set a framebuffer size callback using @ref
|
||||
glfwSetFramebufferSizeCallback and be notified when the size changes.
|
||||
@ -258,19 +256,19 @@ These all happen to use GLFW, but OpenGL itself works the same whatever API you
|
||||
use to create the window and context.
|
||||
|
||||
|
||||
@subsection quick_timer Reading the timer
|
||||
### Reading the timer {#quick_timer}
|
||||
|
||||
To create smooth animation, a time source is needed. GLFW provides a timer that
|
||||
returns the number of seconds since initialization. The time source used is the
|
||||
most accurate on each platform and generally has micro- or nanosecond
|
||||
resolution.
|
||||
|
||||
@code
|
||||
```c
|
||||
double time = glfwGetTime();
|
||||
@endcode
|
||||
```
|
||||
|
||||
|
||||
@subsection quick_swap_buffers Swapping buffers
|
||||
### Swapping buffers {#quick_swap_buffers}
|
||||
|
||||
GLFW windows by default use double buffering. That means that each window has
|
||||
two rendering buffers; a front buffer and a back buffer. The front buffer is
|
||||
@ -279,9 +277,9 @@ the one being displayed and the back buffer the one you render to.
|
||||
When the entire frame has been rendered, the buffers need to be swapped with one
|
||||
another, so the back buffer becomes the front buffer and vice versa.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSwapBuffers(window);
|
||||
@endcode
|
||||
```
|
||||
|
||||
The swap interval indicates how many frames to wait until swapping the buffers,
|
||||
commonly known as _vsync_. By default, the swap interval is zero, meaning
|
||||
@ -296,15 +294,15 @@ For these reasons, applications will typically want to set the swap interval to
|
||||
one. It can be set to higher values, but this is usually not recommended,
|
||||
because of the input latency it leads to.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwSwapInterval(1);
|
||||
@endcode
|
||||
```
|
||||
|
||||
This function acts on the current context and will fail unless a context is
|
||||
current.
|
||||
|
||||
|
||||
@subsection quick_process_events Processing events
|
||||
### Processing events {#quick_process_events}
|
||||
|
||||
GLFW needs to communicate regularly with the window system both in order to
|
||||
receive events and to show that the application hasn't locked up. Event
|
||||
@ -315,9 +313,9 @@ There are two methods for processing pending events; polling and waiting. This
|
||||
example will use event polling, which processes only those events that have
|
||||
already been received and then returns immediately.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwPollEvents();
|
||||
@endcode
|
||||
```
|
||||
|
||||
This is the best choice when rendering continually, like most games do. If
|
||||
instead you only need to update your rendering once you have received new input,
|
||||
@ -327,7 +325,7 @@ all received events. This saves a great deal of CPU cycles and is useful for,
|
||||
for example, many kinds of editing tools.
|
||||
|
||||
|
||||
@section quick_example Putting it together
|
||||
## Putting it together {#quick_example}
|
||||
|
||||
Now that you know how to initialize GLFW, create a window and poll for
|
||||
keyboard input, it's possible to create a small program.
|
||||
@ -338,13 +336,14 @@ presses _Escape_ or closes the window.
|
||||
|
||||
@snippet triangle-opengl.c code
|
||||
|
||||
The program above can be found in the
|
||||
[source package](https://www.glfw.org/download.html) as
|
||||
The program above can be found in the [source package][download] as
|
||||
`examples/triangle-opengl.c` and is compiled along with all other examples when
|
||||
you build GLFW. If you built GLFW from the source package then you already have
|
||||
this as `triangle-opengl.exe` on Windows, `triangle-opengl` on Linux or
|
||||
`triangle-opengl.app` on macOS.
|
||||
|
||||
[download]: https://www.glfw.org/download.html
|
||||
|
||||
This tutorial used only a few of the many functions GLFW provides. There are
|
||||
guides for each of the areas covered by GLFW. Each guide will introduce all the
|
||||
functions for that category.
|
||||
@ -364,4 +363,3 @@ environment you are using and is best explained by the documentation for that
|
||||
environment. To learn about the details that are specific to GLFW, see
|
||||
@ref build_guide.
|
||||
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
/*!
|
||||
# Vulkan guide {#vulkan_guide}
|
||||
|
||||
@page vulkan_guide Vulkan guide
|
||||
|
||||
@tableofcontents
|
||||
[TOC]
|
||||
|
||||
This guide is intended to fill the gaps between the official [Vulkan
|
||||
resources](https://www.khronos.org/vulkan/) and the rest of the GLFW
|
||||
@ -29,7 +27,7 @@ are also guides for the other areas of the GLFW API.
|
||||
- @ref input_guide
|
||||
|
||||
|
||||
@section vulkan_loader Finding the Vulkan loader
|
||||
## Finding the Vulkan loader {#vulkan_loader}
|
||||
|
||||
GLFW itself does not ever need to be linked against the Vulkan loader.
|
||||
|
||||
@ -45,32 +43,32 @@ you will need to direct GLFW to it. Pass your version of `vkGetInstanceProcAddr
|
||||
glfwInitVulkanLoader before initializing GLFW and it will use that function for all Vulkan
|
||||
entry point retrieval. This prevents GLFW from dynamically loading the Vulkan loader.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwInitVulkanLoader(vkGetInstanceProcAddr);
|
||||
@endcode
|
||||
```
|
||||
|
||||
@macos To make your application be redistributable you will need to set up the application
|
||||
bundle according to the LunarG SDK documentation. This is explained in more detail in the
|
||||
[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
|
||||
|
||||
|
||||
@section vulkan_include Including the Vulkan header file
|
||||
## Including the Vulkan header file {#vulkan_include}
|
||||
|
||||
To have GLFW include the Vulkan header, define @ref GLFW_INCLUDE_VULKAN before including
|
||||
the GLFW header.
|
||||
|
||||
@code
|
||||
```c
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
If you instead want to include the Vulkan header from a custom location or use
|
||||
your own custom Vulkan header then do this before the GLFW header.
|
||||
|
||||
@code
|
||||
```c
|
||||
#include <path/to/vulkan.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
```
|
||||
|
||||
Unless a Vulkan header is included, either by the GLFW header or above it, the following
|
||||
GLFW functions will not be declared, as depend on Vulkan types.
|
||||
@ -84,7 +82,7 @@ The `VK_USE_PLATFORM_*_KHR` macros do not need to be defined for the Vulkan part
|
||||
of GLFW to work. Define them only if you are using these extensions directly.
|
||||
|
||||
|
||||
@section vulkan_support Querying for Vulkan support
|
||||
## Querying for Vulkan support {#vulkan_support}
|
||||
|
||||
If you are linking directly against the Vulkan loader then you can skip this
|
||||
section. The canonical desktop loader library exports all Vulkan core and
|
||||
@ -94,12 +92,12 @@ If you are loading the Vulkan loader dynamically instead of linking directly
|
||||
against it, you can check for the availability of a loader and ICD with @ref
|
||||
glfwVulkanSupported.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwVulkanSupported())
|
||||
{
|
||||
// Vulkan is available, at least for compute
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
This function returns `GLFW_TRUE` if the Vulkan loader and any minimally
|
||||
functional ICD was found.
|
||||
@ -108,24 +106,24 @@ If one or both were not found, calling any other Vulkan related GLFW function
|
||||
will generate a @ref GLFW_API_UNAVAILABLE error.
|
||||
|
||||
|
||||
@subsection vulkan_proc Querying Vulkan function pointers
|
||||
### Querying Vulkan function pointers {#vulkan_proc}
|
||||
|
||||
To load any Vulkan core or extension function from the found loader, call @ref
|
||||
glfwGetInstanceProcAddress. To load functions needed for instance creation,
|
||||
pass `NULL` as the instance.
|
||||
|
||||
@code
|
||||
```c
|
||||
PFN_vkCreateInstance pfnCreateInstance = (PFN_vkCreateInstance)
|
||||
glfwGetInstanceProcAddress(NULL, "vkCreateInstance");
|
||||
@endcode
|
||||
```
|
||||
|
||||
Once you have created an instance, you can load from it all other Vulkan core
|
||||
functions and functions from any instance extensions you enabled.
|
||||
|
||||
@code
|
||||
```c
|
||||
PFN_vkCreateDevice pfnCreateDevice = (PFN_vkCreateDevice)
|
||||
glfwGetInstanceProcAddress(instance, "vkCreateDevice");
|
||||
@endcode
|
||||
```
|
||||
|
||||
This function in turn calls `vkGetInstanceProcAddr`. If that fails, the
|
||||
function falls back to a platform-specific query of the Vulkan loader (i.e.
|
||||
@ -137,17 +135,17 @@ Vulkan also provides `vkGetDeviceProcAddr` for loading device-specific versions
|
||||
of Vulkan function. This function can be retrieved from an instance with @ref
|
||||
glfwGetInstanceProcAddress.
|
||||
|
||||
@code
|
||||
```c
|
||||
PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)
|
||||
glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr");
|
||||
@endcode
|
||||
```
|
||||
|
||||
Device-specific functions may execute a little faster, due to not having to
|
||||
dispatch internally based on the device passed to them. For more information
|
||||
about `vkGetDeviceProcAddr`, see the Vulkan documentation.
|
||||
|
||||
|
||||
@section vulkan_ext Querying required Vulkan extensions
|
||||
## Querying required Vulkan extensions {#vulkan_ext}
|
||||
|
||||
To do anything useful with Vulkan you need to create an instance. If you want
|
||||
to use Vulkan to render to a window, you must enable the instance extensions
|
||||
@ -156,10 +154,10 @@ GLFW requires to create Vulkan surfaces.
|
||||
To query the instance extensions required, call @ref
|
||||
glfwGetRequiredInstanceExtensions.
|
||||
|
||||
@code
|
||||
```c
|
||||
uint32_t count;
|
||||
const char** extensions = glfwGetRequiredInstanceExtensions(&count);
|
||||
@endcode
|
||||
```
|
||||
|
||||
These extensions must all be enabled when creating instances that are going to
|
||||
be passed to @ref glfwGetPhysicalDevicePresentationSupport and @ref
|
||||
@ -174,14 +172,14 @@ If successful the returned array will always include `VK_KHR_surface`, so if
|
||||
you don't require any additional extensions you can pass this list directly to
|
||||
the `VkInstanceCreateInfo` struct.
|
||||
|
||||
@code
|
||||
```c
|
||||
VkInstanceCreateInfo ici;
|
||||
|
||||
memset(&ici, 0, sizeof(ici));
|
||||
ici.enabledExtensionCount = count;
|
||||
ici.ppEnabledExtensionNames = extensions;
|
||||
...
|
||||
@endcode
|
||||
```
|
||||
|
||||
Additional extensions may be required by future versions of GLFW. You should
|
||||
check whether any extensions you wish to enable are already in the returned
|
||||
@ -196,52 +194,52 @@ info flags for MoltenVK to show up in the list of physical devices. For more
|
||||
information, see the Vulkan and MoltenVK documentation.
|
||||
|
||||
|
||||
@section vulkan_present Querying for Vulkan presentation support
|
||||
## Querying for Vulkan presentation support {#vulkan_present}
|
||||
|
||||
Not every queue family of every Vulkan device can present images to surfaces.
|
||||
To check whether a specific queue family of a physical device supports image
|
||||
presentation without first having to create a window and surface, call @ref
|
||||
glfwGetPhysicalDevicePresentationSupport.
|
||||
|
||||
@code
|
||||
```c
|
||||
if (glfwGetPhysicalDevicePresentationSupport(instance, physical_device, queue_family_index))
|
||||
{
|
||||
// Queue family supports image presentation
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
The `VK_KHR_surface` extension additionally provides the
|
||||
`vkGetPhysicalDeviceSurfaceSupportKHR` function, which performs the same test on
|
||||
an existing Vulkan surface.
|
||||
|
||||
|
||||
@section vulkan_window Creating the window
|
||||
## Creating the window {#vulkan_window}
|
||||
|
||||
Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan,
|
||||
there is no need to create a context. You can disable context creation with the
|
||||
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint.
|
||||
|
||||
@code
|
||||
```c
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "Window Title", NULL, NULL);
|
||||
@endcode
|
||||
```
|
||||
|
||||
See @ref context_less for more information.
|
||||
|
||||
|
||||
@section vulkan_surface Creating a Vulkan window surface
|
||||
## Creating a Vulkan window surface {#vulkan_surface}
|
||||
|
||||
You can create a Vulkan surface (as defined by the `VK_KHR_surface` extension)
|
||||
for a GLFW window with @ref glfwCreateWindowSurface.
|
||||
|
||||
@code
|
||||
```c
|
||||
VkSurfaceKHR surface;
|
||||
VkResult err = glfwCreateWindowSurface(instance, window, NULL, &surface);
|
||||
if (err)
|
||||
{
|
||||
// Window surface creation failed
|
||||
}
|
||||
@endcode
|
||||
```
|
||||
|
||||
If an OpenGL or OpenGL ES context was created on the window, the context has
|
||||
ownership of the presentation on the window and a Vulkan surface cannot be
|
||||
@ -250,4 +248,3 @@ created.
|
||||
It is your responsibility to destroy the surface. GLFW does not destroy it for
|
||||
you. Call `vkDestroySurfaceKHR` function from the same extension to destroy it.
|
||||
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "getopt.h"
|
||||
#include "linmath.h"
|
||||
|
||||
static const char* vertex_shader_text =
|
||||
|
@ -365,10 +365,15 @@ extern "C" {
|
||||
#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
|
||||
#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
|
||||
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
|
||||
|
||||
/*! @ingroup input
|
||||
*/
|
||||
#define GLFW_KEY_UNKNOWN -1
|
||||
|
||||
/*! @} */
|
||||
|
||||
/*! @defgroup keys Keyboard keys
|
||||
* @brief Keyboard key IDs.
|
||||
/*! @defgroup keys Keyboard key tokens
|
||||
* @brief Keyboard key tokens.
|
||||
*
|
||||
* See [key input](@ref input_key) for how these are used.
|
||||
*
|
||||
@ -391,9 +396,6 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* The unknown key */
|
||||
#define GLFW_KEY_UNKNOWN -1
|
||||
|
||||
/* Printable keys */
|
||||
#define GLFW_KEY_SPACE 32
|
||||
#define GLFW_KEY_APOSTROPHE 39 /* ' */
|
||||
@ -829,11 +831,11 @@ extern "C" {
|
||||
#define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D
|
||||
/*! @brief Platform unavailable or no matching platform was found.
|
||||
*
|
||||
* If emitted during initialization, no matching platform was found. If @ref
|
||||
* GLFW_PLATFORM is set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of the
|
||||
* platforms supported by this library binary, except for the Null platform. If set to
|
||||
* a specific platform, it is either not supported by this library binary or GLFW was not
|
||||
* able to detect it.
|
||||
* If emitted during initialization, no matching platform was found. If the @ref
|
||||
* GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of
|
||||
* the platforms supported by this library binary, except for the Null platform. If the
|
||||
* init hint was set to a specific platform, it is either not supported by this library
|
||||
* binary or GLFW was not able to detect it.
|
||||
*
|
||||
* If emitted by a native access function, GLFW was initialized for a different platform
|
||||
* than the function is for.
|
||||
@ -1100,8 +1102,15 @@ extern "C" {
|
||||
* [window hint](@ref GLFW_SCALE_TO_MONITOR).
|
||||
*/
|
||||
#define GLFW_SCALE_TO_MONITOR 0x0002200C
|
||||
/*! @brief macOS specific
|
||||
* [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
|
||||
/*! @brief Window framebuffer scaling
|
||||
* [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
|
||||
*/
|
||||
#define GLFW_SCALE_FRAMEBUFFER 0x0002200D
|
||||
/*! @brief Legacy name for compatibility.
|
||||
*
|
||||
* This is an alias for the
|
||||
* [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
|
||||
* compatibility with earlier versions.
|
||||
*/
|
||||
#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
|
||||
/*! @brief macOS specific
|
||||
@ -1121,6 +1130,9 @@ extern "C" {
|
||||
*/
|
||||
#define GLFW_X11_INSTANCE_NAME 0x00024002
|
||||
#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
|
||||
/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint).
|
||||
*/
|
||||
#define GLFW_WIN32_SHOWDEFAULT 0x00025002
|
||||
/*! @brief Wayland specific
|
||||
* [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
|
||||
*
|
||||
@ -1418,16 +1430,25 @@ typedef struct GLFWcursor GLFWcursor;
|
||||
* or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
|
||||
* failures gracefully yet.
|
||||
*
|
||||
* This function may be called during @ref glfwInit but before the library is
|
||||
* flagged as initialized, as well as during @ref glfwTerminate after the
|
||||
* library is no longer flagged as initialized.
|
||||
* This function must support being called during @ref glfwInit but before the library is
|
||||
* flagged as initialized, as well as during @ref glfwTerminate after the library is no
|
||||
* longer flagged as initialized.
|
||||
*
|
||||
* Any memory allocated by this function will be deallocated during library
|
||||
* termination or earlier.
|
||||
* Any memory allocated via this function will be deallocated via the same allocator
|
||||
* during library termination or earlier.
|
||||
*
|
||||
* Any memory allocated via this function must be suitably aligned for any object type.
|
||||
* If you are using C99 or earlier, this alignment is platform-dependent but will be the
|
||||
* same as what `malloc` provides. If you are using C11 or later, this is the value of
|
||||
* `alignof(max_align_t)`.
|
||||
*
|
||||
* The size will always be greater than zero. Allocations of size zero are filtered out
|
||||
* before reaching the custom allocator.
|
||||
*
|
||||
* If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
|
||||
*
|
||||
* This function must not call any GLFW function.
|
||||
*
|
||||
* @param[in] size The minimum size, in bytes, of the memory block.
|
||||
* @param[in] user The user-defined pointer from the allocator.
|
||||
* @return The address of the newly allocated memory block, or `NULL` if an
|
||||
@ -1438,7 +1459,8 @@ typedef struct GLFWcursor GLFWcursor;
|
||||
*
|
||||
* @reentrancy This function should not call any GLFW function.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread that calls GLFW functions.
|
||||
* @thread_safety This function must support being called from any thread that calls GLFW
|
||||
* functions.
|
||||
*
|
||||
* @sa @ref init_allocator
|
||||
* @sa @ref GLFWallocator
|
||||
@ -1461,16 +1483,26 @@ typedef void* (* GLFWallocatefun)(size_t size, void* user);
|
||||
* `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
|
||||
* failures gracefully yet.
|
||||
*
|
||||
* This function may be called during @ref glfwInit but before the library is
|
||||
* flagged as initialized, as well as during @ref glfwTerminate after the
|
||||
* library is no longer flagged as initialized.
|
||||
* This function must support being called during @ref glfwInit but before the library is
|
||||
* flagged as initialized, as well as during @ref glfwTerminate after the library is no
|
||||
* longer flagged as initialized.
|
||||
*
|
||||
* Any memory allocated by this function will be deallocated during library
|
||||
* termination or earlier.
|
||||
* Any memory allocated via this function will be deallocated via the same allocator
|
||||
* during library termination or earlier.
|
||||
*
|
||||
* Any memory allocated via this function must be suitably aligned for any object type.
|
||||
* If you are using C99 or earlier, this alignment is platform-dependent but will be the
|
||||
* same as what `realloc` provides. If you are using C11 or later, this is the value of
|
||||
* `alignof(max_align_t)`.
|
||||
*
|
||||
* The block address will never be `NULL` and the size will always be greater than zero.
|
||||
* Reallocations of a block to size zero are converted into deallocations. Reallocations
|
||||
* of `NULL` to a non-zero size are converted into regular allocations.
|
||||
* Reallocations of a block to size zero are converted into deallocations before reaching
|
||||
* the custom allocator. Reallocations of `NULL` to a non-zero size are converted into
|
||||
* regular allocations before reaching the custom allocator.
|
||||
*
|
||||
* If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
|
||||
*
|
||||
* This function must not call any GLFW function.
|
||||
*
|
||||
* @param[in] block The address of the memory block to reallocate.
|
||||
* @param[in] size The new minimum size, in bytes, of the memory block.
|
||||
@ -1483,7 +1515,8 @@ typedef void* (* GLFWallocatefun)(size_t size, void* user);
|
||||
*
|
||||
* @reentrancy This function should not call any GLFW function.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread that calls GLFW functions.
|
||||
* @thread_safety This function must support being called from any thread that calls GLFW
|
||||
* functions.
|
||||
*
|
||||
* @sa @ref init_allocator
|
||||
* @sa @ref GLFWallocator
|
||||
@ -1505,13 +1538,17 @@ typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
|
||||
* This function may deallocate the specified memory block. This memory block
|
||||
* will have been allocated with the same allocator.
|
||||
*
|
||||
* This function may be called during @ref glfwInit but before the library is
|
||||
* flagged as initialized, as well as during @ref glfwTerminate after the
|
||||
* library is no longer flagged as initialized.
|
||||
* This function must support being called during @ref glfwInit but before the library is
|
||||
* flagged as initialized, as well as during @ref glfwTerminate after the library is no
|
||||
* longer flagged as initialized.
|
||||
*
|
||||
* The block address will never be `NULL`. Deallocations of `NULL` are filtered out
|
||||
* before reaching the custom allocator.
|
||||
*
|
||||
* If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
|
||||
*
|
||||
* This function must not call any GLFW function.
|
||||
*
|
||||
* @param[in] block The address of the memory block to deallocate.
|
||||
* @param[in] user The user-defined pointer from the allocator.
|
||||
*
|
||||
@ -1520,7 +1557,8 @@ typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
|
||||
*
|
||||
* @reentrancy This function should not call any GLFW function.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread that calls GLFW functions.
|
||||
* @thread_safety This function must support being called from any thread that calls GLFW
|
||||
* functions.
|
||||
*
|
||||
* @sa @ref init_allocator
|
||||
* @sa @ref GLFWallocator
|
||||
@ -2088,7 +2126,10 @@ typedef struct GLFWgamepadstate
|
||||
float axes[6];
|
||||
} GLFWgamepadstate;
|
||||
|
||||
/*! @brief
|
||||
/*! @brief Custom heap memory allocator.
|
||||
*
|
||||
* This describes a custom heap memory allocator for GLFW. To set an allocator, pass it
|
||||
* to @ref glfwInitAllocator before initializing the library.
|
||||
*
|
||||
* @sa @ref init_allocator
|
||||
* @sa @ref glfwInitAllocator
|
||||
@ -2099,9 +2140,21 @@ typedef struct GLFWgamepadstate
|
||||
*/
|
||||
typedef struct GLFWallocator
|
||||
{
|
||||
/*! The memory allocation function. See @ref GLFWallocatefun for details about
|
||||
* allocation function.
|
||||
*/
|
||||
GLFWallocatefun allocate;
|
||||
/*! The memory reallocation function. See @ref GLFWreallocatefun for details about
|
||||
* reallocation function.
|
||||
*/
|
||||
GLFWreallocatefun reallocate;
|
||||
/*! The memory deallocation function. See @ref GLFWdeallocatefun for details about
|
||||
* deallocation function.
|
||||
*/
|
||||
GLFWdeallocatefun deallocate;
|
||||
/*! The user pointer for this custom allocator. This value will be passed to the
|
||||
* allocator functions.
|
||||
*/
|
||||
void* user;
|
||||
} GLFWallocator;
|
||||
|
||||
@ -2150,6 +2203,13 @@ typedef struct GLFWallocator
|
||||
* application locale according to the current environment if that category is
|
||||
* still "C". This is because the "C" locale breaks Unicode text input.
|
||||
*
|
||||
* @remark __Wayland, X11:__ If the library was compiled with support for both
|
||||
* Wayland and X11, and the @ref GLFW_PLATFORM init hint is set to
|
||||
* `GLFW_ANY_PLATFORM`, the `XDG_SESSION_TYPE` environment variable affects
|
||||
* which platform is picked. If the environment variable is not set, or is set
|
||||
* to something other than `wayland` or `x11`, the regular detection mechanism
|
||||
* will be used instead.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
* @sa @ref intro_init
|
||||
@ -2234,8 +2294,12 @@ GLFWAPI void glfwInitHint(int hint, int value);
|
||||
* To use the default allocator, call this function with a `NULL` argument.
|
||||
*
|
||||
* If you specify an allocator struct, every member must be a valid function
|
||||
* pointer. If any member is `NULL`, this function emits @ref
|
||||
* GLFW_INVALID_VALUE and the init allocator is unchanged.
|
||||
* pointer. If any member is `NULL`, this function will emit @ref
|
||||
* GLFW_INVALID_VALUE and the init allocator will be unchanged.
|
||||
*
|
||||
* The functions in the allocator must fulfil a number of requirements. See the
|
||||
* documentation for @ref GLFWallocatefun, @ref GLFWreallocatefun and @ref
|
||||
* GLFWdeallocatefun for details.
|
||||
*
|
||||
* @param[in] allocator The allocator to use at the next initialization, or
|
||||
* `NULL` to use the default one.
|
||||
@ -2602,9 +2666,10 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
|
||||
* specified monitor.
|
||||
*
|
||||
* Some platforms do not provide accurate monitor size information, either
|
||||
* because the monitor
|
||||
* [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
|
||||
* data is incorrect or because the driver does not report it accurately.
|
||||
* because the monitor [EDID][] data is incorrect or because the driver does
|
||||
* not report it accurately.
|
||||
*
|
||||
* [EDID]: https://en.wikipedia.org/wiki/Extended_display_identification_data
|
||||
*
|
||||
* Any or all of the size arguments may be `NULL`. If an error occurs, all
|
||||
* non-`NULL` size arguments will be set to zero.
|
||||
@ -2651,6 +2716,9 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @wayland Fractional scaling information is not yet available for
|
||||
* monitors, so this function only returns integer content scales.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
* @sa @ref monitor_scale
|
||||
@ -3091,8 +3159,8 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
|
||||
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @win32 Window creation will fail if the Microsoft GDI software
|
||||
* OpenGL implementation is the only one available.
|
||||
@ -3114,18 +3182,21 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
||||
* @remark @macos The GLFW window has no icon, as it is not a document
|
||||
* window, but the dock icon will be the same as the application bundle's icon.
|
||||
* For more information on bundles, see the
|
||||
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
|
||||
* in the Mac Developer Library.
|
||||
* [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
|
||||
*
|
||||
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
|
||||
*
|
||||
* @remark @macos On OS X 10.10 and later the window frame will not be rendered
|
||||
* at full resolution on Retina displays unless the
|
||||
* [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
|
||||
* [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
|
||||
* hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
|
||||
* application bundle's `Info.plist`. For more information, see
|
||||
* [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
|
||||
* in the Mac Developer Library. The GLFW test and example programs use
|
||||
* a custom `Info.plist` template for this, which can be found as
|
||||
* `CMake/Info.plist.in` in the source tree.
|
||||
* [High Resolution Guidelines for OS X][hidpi-guide] in the Mac Developer
|
||||
* Library. The GLFW test and example programs use a custom `Info.plist`
|
||||
* template for this, which can be found as `CMake/Info.plist.in` in the source
|
||||
* tree.
|
||||
*
|
||||
* [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
|
||||
*
|
||||
* @remark @macos When activating frame autosaving with
|
||||
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
|
||||
@ -3299,8 +3370,9 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
|
||||
* @remark @macos Regular windows do not have icons on macOS. This function
|
||||
* will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as
|
||||
* the application bundle's icon. For more information on bundles, see the
|
||||
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
|
||||
* in the Mac Developer Library.
|
||||
* [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
|
||||
*
|
||||
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
|
||||
*
|
||||
* @remark @wayland There is no existing protocol to change an icon, the
|
||||
* window will thus inherit the one defined in the application's desktop file.
|
||||
@ -3858,11 +3930,11 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
|
||||
*
|
||||
* @param[in] window The window to give input focus.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @wayland It is not possible for an application to set the input
|
||||
* focus. This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
* @remark @wayland The compositor will likely ignore focus requests unless
|
||||
* another window created by the same application already has input focus.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
@ -4043,11 +4115,14 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
|
||||
* GLFW_FEATURE_UNAVAILABLE.
|
||||
* GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark Calling @ref glfwGetWindowAttrib will always return the latest
|
||||
* value, even if that value is ignored by the current mode of the window.
|
||||
*
|
||||
* @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
|
||||
* not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
* @sa @ref window_attribs
|
||||
@ -4722,8 +4797,8 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
|
||||
* @param[in] scancode The scancode of the key to query.
|
||||
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark The contents of the returned string may change when a keyboard
|
||||
* layout change event is received.
|
||||
@ -4745,15 +4820,18 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
|
||||
*
|
||||
* This function returns the platform-specific scancode of the specified key.
|
||||
*
|
||||
* If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
|
||||
* method will return `-1`.
|
||||
* If the specified [key token](@ref keys) corresponds to a physical key not
|
||||
* supported on the current platform then this method will return `-1`.
|
||||
* Calling this function with anything other than a key token will return `-1`
|
||||
* and generate a @ref GLFW_INVALID_ENUM error.
|
||||
*
|
||||
* @param[in] key Any [named key](@ref keys).
|
||||
* @return The platform-specific scancode for the key, or `-1` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
* @param[in] key Any [key token](@ref keys).
|
||||
* @return The platform-specific scancode for the key, or `-1` if the key is
|
||||
* not supported on the current platform or an [error](@ref error_handling)
|
||||
* occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_INVALID_ENUM.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread.
|
||||
*
|
||||
@ -5062,9 +5140,9 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
|
||||
* [character callback](@ref glfwSetCharCallback) instead.
|
||||
*
|
||||
* When a window loses input focus, it will generate synthetic key release
|
||||
* events for all pressed keys. You can tell these events from user-generated
|
||||
* events by the fact that the synthetic ones are generated after the focus
|
||||
* loss event has been processed, i.e. after the
|
||||
* events for all pressed keys with associated key tokens. You can tell these
|
||||
* events from user-generated events by the fact that the synthetic ones are
|
||||
* generated after the focus loss event has been processed, i.e. after the
|
||||
* [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
|
||||
*
|
||||
* The scancode of a key is specific to that platform or sometimes even to that
|
||||
@ -5813,6 +5891,11 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @win32 The clipboard on Windows has a single global lock for reading and
|
||||
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
|
||||
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
|
||||
* It is safe to try this multiple times.
|
||||
*
|
||||
* @pointer_lifetime The specified string is copied before this function
|
||||
* returns.
|
||||
*
|
||||
@ -5841,6 +5924,11 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @win32 The clipboard on Windows has a single global lock for reading and
|
||||
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
|
||||
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
|
||||
* It is safe to try this multiple times.
|
||||
*
|
||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||
* should not free it yourself. It is valid until the next call to @ref
|
||||
* glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
|
||||
@ -5963,12 +6051,15 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
|
||||
* thread.
|
||||
*
|
||||
* This function makes the OpenGL or OpenGL ES context of the specified window
|
||||
* current on the calling thread. A context must only be made current on
|
||||
* a single thread at a time and each thread can have only a single current
|
||||
* context at a time.
|
||||
* current on the calling thread. It can also detach the current context from
|
||||
* the calling thread without making a new one current by passing in `NULL`.
|
||||
*
|
||||
* When moving a context between threads, you must make it non-current on the
|
||||
* old thread before making it current on the new one.
|
||||
* A context must only be made current on a single thread at a time and each
|
||||
* thread can have only a single current context at a time. Making a context
|
||||
* current detaches any previously current context on the calling thread.
|
||||
*
|
||||
* When moving a context between threads, you must detach it (make it
|
||||
* non-current) on the old thread before making it current on the new one.
|
||||
*
|
||||
* By default, making a context non-current implicitly forces a pipeline flush.
|
||||
* On machines that support `GL_KHR_context_flush_control`, you can control
|
||||
@ -5983,6 +6074,10 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
|
||||
* @param[in] window The window whose context to make current, or `NULL` to
|
||||
* detach the current context.
|
||||
*
|
||||
* @remarks If the previously current context was created via a different
|
||||
* context creation API than the one passed to this function, GLFW will still
|
||||
* detach the previous one from its API before making the new one current.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
|
@ -169,7 +169,8 @@ extern "C" {
|
||||
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
|
||||
* occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -186,7 +187,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
||||
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -202,7 +204,8 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||
* @return The `HWND` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @remark The `HDC` associated with the window can be queried with the
|
||||
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||
@ -228,8 +231,8 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||
* @return The `HGLRC` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @remark The `HDC` associated with the window can be queried with the
|
||||
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||
@ -255,7 +258,8 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||
* @return The `CGDirectDisplayID` of the specified monitor, or
|
||||
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -271,7 +275,8 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||
* @return The `NSWindow` of the specified window, or `nil` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -289,8 +294,8 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -308,7 +313,8 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||
* @return The `Display` used by GLFW, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -324,7 +330,8 @@ GLFWAPI Display* glfwGetX11Display(void);
|
||||
* @return The `RRCrtc` of the specified monitor, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -340,7 +347,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||
* @return The `RROutput` of the specified monitor, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -356,7 +364,8 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||
* @return The `Window` of the specified window, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -371,8 +380,8 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
|
||||
*
|
||||
* @param[in] string A UTF-8 encoded string.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @pointer_lifetime The specified string is copied before this function
|
||||
* returns.
|
||||
@ -397,8 +406,8 @@ GLFWAPI void glfwSetX11SelectionString(const char* string);
|
||||
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
|
||||
* if an [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||
* should not free it yourself. It is valid until the next call to @ref
|
||||
@ -424,8 +433,8 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
|
||||
* @return The `GLXContext` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -441,8 +450,8 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||
* @return The `GLXWindow` of the specified window, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -460,7 +469,8 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
||||
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -476,7 +486,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
|
||||
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -492,7 +503,8 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
|
||||
* an [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -529,8 +541,8 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
||||
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -546,8 +558,8 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -572,8 +584,8 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -596,8 +608,8 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
@ -613,8 +625,8 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
|
||||
* @return The `OSMesaContext` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
|
@ -73,47 +73,38 @@ if (GLFW_BUILD_WAYLAND)
|
||||
endif()
|
||||
|
||||
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
|
||||
if (NOT WAYLAND_SCANNER_EXECUTABLE)
|
||||
message(FATAL_ERROR "Failed to find wayland-scanner")
|
||||
endif()
|
||||
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15)
|
||||
pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
|
||||
pkg_get_variable(WAYLAND_CLIENT_PKGDATADIR wayland-client pkgdatadir)
|
||||
macro(generate_wayland_protocol protocol_file)
|
||||
set(protocol_path "${GLFW_SOURCE_DIR}/deps/wayland/${protocol_file}")
|
||||
|
||||
macro(wayland_generate protocol_file output_file)
|
||||
add_custom_command(OUTPUT "${output_file}.h"
|
||||
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_file}" "${output_file}.h"
|
||||
DEPENDS "${protocol_file}"
|
||||
string(REGEX REPLACE "\\.xml$" "-client-protocol.h" header_file ${protocol_file})
|
||||
string(REGEX REPLACE "\\.xml$" "-client-protocol-code.h" code_file ${protocol_file})
|
||||
|
||||
add_custom_command(OUTPUT ${header_file}
|
||||
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_path}" ${header_file}
|
||||
DEPENDS "${protocol_path}"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_command(OUTPUT "${output_file}-code.h"
|
||||
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_file}" "${output_file}-code.h"
|
||||
DEPENDS "${protocol_file}"
|
||||
add_custom_command(OUTPUT ${code_file}
|
||||
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_path}" ${code_file}
|
||||
DEPENDS "${protocol_path}"
|
||||
VERBATIM)
|
||||
|
||||
target_sources(glfw PRIVATE "${output_file}.h" "${output_file}-code.h")
|
||||
target_sources(glfw PRIVATE ${header_file} ${code_file})
|
||||
endmacro()
|
||||
|
||||
wayland_generate(
|
||||
"${WAYLAND_CLIENT_PKGDATADIR}/wayland.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-client-protocol")
|
||||
wayland_generate(
|
||||
"${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-xdg-shell-client-protocol")
|
||||
wayland_generate(
|
||||
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-xdg-decoration-client-protocol")
|
||||
wayland_generate(
|
||||
"${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-viewporter-client-protocol")
|
||||
wayland_generate(
|
||||
"${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-relative-pointer-unstable-v1-client-protocol")
|
||||
wayland_generate(
|
||||
"${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-pointer-constraints-unstable-v1-client-protocol")
|
||||
wayland_generate(
|
||||
"${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
|
||||
"${GLFW_BINARY_DIR}/src/wayland-idle-inhibit-unstable-v1-client-protocol")
|
||||
generate_wayland_protocol("wayland.xml")
|
||||
generate_wayland_protocol("viewporter.xml")
|
||||
generate_wayland_protocol("xdg-shell.xml")
|
||||
generate_wayland_protocol("idle-inhibit-unstable-v1.xml")
|
||||
generate_wayland_protocol("pointer-constraints-unstable-v1.xml")
|
||||
generate_wayland_protocol("relative-pointer-unstable-v1.xml")
|
||||
generate_wayland_protocol("fractional-scale-v1.xml")
|
||||
generate_wayland_protocol("xdg-activation-v1.xml")
|
||||
generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
|
||||
endif()
|
||||
|
||||
if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
|
||||
@ -127,6 +118,7 @@ if (UNIX AND GLFW_BUILD_SHARED_LIBRARY)
|
||||
else()
|
||||
set(GLFW_LIB_NAME glfw3)
|
||||
endif()
|
||||
set(GLFW_LIB_NAME_SUFFIX "")
|
||||
|
||||
set_target_properties(glfw PROPERTIES
|
||||
OUTPUT_NAME ${GLFW_LIB_NAME}
|
||||
@ -167,6 +159,8 @@ if (GLFW_BUILD_COCOA)
|
||||
endif()
|
||||
|
||||
if (GLFW_BUILD_WAYLAND)
|
||||
include(FindPkgConfig)
|
||||
|
||||
pkg_check_modules(Wayland REQUIRED
|
||||
wayland-client>=0.2.7
|
||||
wayland-cursor>=0.2.7
|
||||
@ -246,17 +240,6 @@ if (UNIX AND NOT APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Make GCC warn about declarations that VS 2010 and 2012 won't accept for all
|
||||
# source files that VS will build (Clang ignores this because we set -std=c99)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set_source_files_properties(context.c init.c input.c monitor.c platform.c vulkan.c
|
||||
webgpu.c window.c null_init.c null_joystick.c null_monitor.c
|
||||
null_window.c win32_init.c win32_joystick.c win32_module.c
|
||||
win32_monitor.c win32_time.c win32_thread.c win32_window.c
|
||||
wgl_context.c egl_context.c osmesa_context.c PROPERTIES
|
||||
COMPILE_FLAGS -Wdeclaration-after-statement)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (GLFW_USE_HYBRID_HPG)
|
||||
target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
|
||||
@ -301,25 +284,9 @@ if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
||||
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# Workaround for VS 2008 not shipping with stdint.h
|
||||
if (MSVC90)
|
||||
target_include_directories(glfw PUBLIC "${GLFW_SOURCE_DIR}/deps/vs2008")
|
||||
endif()
|
||||
|
||||
# Check for the DirectX 9 SDK as it is not included with VS 2008
|
||||
if (MSVC90)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(dinput.h DINPUT_H_FOUND)
|
||||
if (NOT DINPUT_H_FOUND)
|
||||
message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more)
|
||||
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
|
||||
endif()
|
||||
|
||||
if (GLFW_BUILD_WEBGPU)
|
||||
@ -346,6 +313,7 @@ if (GLFW_BUILD_SHARED_LIBRARY)
|
||||
# Add a suffix to the import library to avoid naming conflicts
|
||||
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
|
||||
endif()
|
||||
set (GLFW_LIB_NAME_SUFFIX "dll")
|
||||
|
||||
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||
endif()
|
||||
|
146
src/cocoa_init.m
146
src/cocoa_init.m
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -495,78 +493,78 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
|
||||
{
|
||||
const _GLFWplatform cocoa =
|
||||
{
|
||||
GLFW_PLATFORM_COCOA,
|
||||
_glfwInitCocoa,
|
||||
_glfwTerminateCocoa,
|
||||
_glfwGetCursorPosCocoa,
|
||||
_glfwSetCursorPosCocoa,
|
||||
_glfwSetCursorModeCocoa,
|
||||
_glfwSetRawMouseMotionCocoa,
|
||||
_glfwRawMouseMotionSupportedCocoa,
|
||||
_glfwCreateCursorCocoa,
|
||||
_glfwCreateStandardCursorCocoa,
|
||||
_glfwDestroyCursorCocoa,
|
||||
_glfwSetCursorCocoa,
|
||||
_glfwGetScancodeNameCocoa,
|
||||
_glfwGetKeyScancodeCocoa,
|
||||
_glfwSetClipboardStringCocoa,
|
||||
_glfwGetClipboardStringCocoa,
|
||||
_glfwInitJoysticksCocoa,
|
||||
_glfwTerminateJoysticksCocoa,
|
||||
_glfwPollJoystickCocoa,
|
||||
_glfwGetMappingNameCocoa,
|
||||
_glfwUpdateGamepadGUIDCocoa,
|
||||
_glfwFreeMonitorCocoa,
|
||||
_glfwGetMonitorPosCocoa,
|
||||
_glfwGetMonitorContentScaleCocoa,
|
||||
_glfwGetMonitorWorkareaCocoa,
|
||||
_glfwGetVideoModesCocoa,
|
||||
_glfwGetVideoModeCocoa,
|
||||
_glfwGetGammaRampCocoa,
|
||||
_glfwSetGammaRampCocoa,
|
||||
_glfwCreateWindowCocoa,
|
||||
_glfwDestroyWindowCocoa,
|
||||
_glfwSetWindowTitleCocoa,
|
||||
_glfwSetWindowIconCocoa,
|
||||
_glfwGetWindowPosCocoa,
|
||||
_glfwSetWindowPosCocoa,
|
||||
_glfwGetWindowSizeCocoa,
|
||||
_glfwSetWindowSizeCocoa,
|
||||
_glfwSetWindowSizeLimitsCocoa,
|
||||
_glfwSetWindowAspectRatioCocoa,
|
||||
_glfwGetFramebufferSizeCocoa,
|
||||
_glfwGetWindowFrameSizeCocoa,
|
||||
_glfwGetWindowContentScaleCocoa,
|
||||
_glfwIconifyWindowCocoa,
|
||||
_glfwRestoreWindowCocoa,
|
||||
_glfwMaximizeWindowCocoa,
|
||||
_glfwShowWindowCocoa,
|
||||
_glfwHideWindowCocoa,
|
||||
_glfwRequestWindowAttentionCocoa,
|
||||
_glfwFocusWindowCocoa,
|
||||
_glfwSetWindowMonitorCocoa,
|
||||
_glfwWindowFocusedCocoa,
|
||||
_glfwWindowIconifiedCocoa,
|
||||
_glfwWindowVisibleCocoa,
|
||||
_glfwWindowMaximizedCocoa,
|
||||
_glfwWindowHoveredCocoa,
|
||||
_glfwFramebufferTransparentCocoa,
|
||||
_glfwGetWindowOpacityCocoa,
|
||||
_glfwSetWindowResizableCocoa,
|
||||
_glfwSetWindowDecoratedCocoa,
|
||||
_glfwSetWindowFloatingCocoa,
|
||||
_glfwSetWindowOpacityCocoa,
|
||||
_glfwSetWindowMousePassthroughCocoa,
|
||||
_glfwPollEventsCocoa,
|
||||
_glfwWaitEventsCocoa,
|
||||
_glfwWaitEventsTimeoutCocoa,
|
||||
_glfwPostEmptyEventCocoa,
|
||||
_glfwGetEGLPlatformCocoa,
|
||||
_glfwGetEGLNativeDisplayCocoa,
|
||||
_glfwGetEGLNativeWindowCocoa,
|
||||
_glfwGetRequiredInstanceExtensionsCocoa,
|
||||
_glfwGetPhysicalDevicePresentationSupportCocoa,
|
||||
_glfwCreateWindowSurfaceCocoa,
|
||||
.platformID = GLFW_PLATFORM_COCOA,
|
||||
.init = _glfwInitCocoa,
|
||||
.terminate = _glfwTerminateCocoa,
|
||||
.getCursorPos = _glfwGetCursorPosCocoa,
|
||||
.setCursorPos = _glfwSetCursorPosCocoa,
|
||||
.setCursorMode = _glfwSetCursorModeCocoa,
|
||||
.setRawMouseMotion = _glfwSetRawMouseMotionCocoa,
|
||||
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedCocoa,
|
||||
.createCursor = _glfwCreateCursorCocoa,
|
||||
.createStandardCursor = _glfwCreateStandardCursorCocoa,
|
||||
.destroyCursor = _glfwDestroyCursorCocoa,
|
||||
.setCursor = _glfwSetCursorCocoa,
|
||||
.getScancodeName = _glfwGetScancodeNameCocoa,
|
||||
.getKeyScancode = _glfwGetKeyScancodeCocoa,
|
||||
.setClipboardString = _glfwSetClipboardStringCocoa,
|
||||
.getClipboardString = _glfwGetClipboardStringCocoa,
|
||||
.initJoysticks = _glfwInitJoysticksCocoa,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksCocoa,
|
||||
.pollJoystick = _glfwPollJoystickCocoa,
|
||||
.getMappingName = _glfwGetMappingNameCocoa,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDCocoa,
|
||||
.freeMonitor = _glfwFreeMonitorCocoa,
|
||||
.getMonitorPos = _glfwGetMonitorPosCocoa,
|
||||
.getMonitorContentScale = _glfwGetMonitorContentScaleCocoa,
|
||||
.getMonitorWorkarea = _glfwGetMonitorWorkareaCocoa,
|
||||
.getVideoModes = _glfwGetVideoModesCocoa,
|
||||
.getVideoMode = _glfwGetVideoModeCocoa,
|
||||
.getGammaRamp = _glfwGetGammaRampCocoa,
|
||||
.setGammaRamp = _glfwSetGammaRampCocoa,
|
||||
.createWindow = _glfwCreateWindowCocoa,
|
||||
.destroyWindow = _glfwDestroyWindowCocoa,
|
||||
.setWindowTitle = _glfwSetWindowTitleCocoa,
|
||||
.setWindowIcon = _glfwSetWindowIconCocoa,
|
||||
.getWindowPos = _glfwGetWindowPosCocoa,
|
||||
.setWindowPos = _glfwSetWindowPosCocoa,
|
||||
.getWindowSize = _glfwGetWindowSizeCocoa,
|
||||
.setWindowSize = _glfwSetWindowSizeCocoa,
|
||||
.setWindowSizeLimits = _glfwSetWindowSizeLimitsCocoa,
|
||||
.setWindowAspectRatio = _glfwSetWindowAspectRatioCocoa,
|
||||
.getFramebufferSize = _glfwGetFramebufferSizeCocoa,
|
||||
.getWindowFrameSize = _glfwGetWindowFrameSizeCocoa,
|
||||
.getWindowContentScale = _glfwGetWindowContentScaleCocoa,
|
||||
.iconifyWindow = _glfwIconifyWindowCocoa,
|
||||
.restoreWindow = _glfwRestoreWindowCocoa,
|
||||
.maximizeWindow = _glfwMaximizeWindowCocoa,
|
||||
.showWindow = _glfwShowWindowCocoa,
|
||||
.hideWindow = _glfwHideWindowCocoa,
|
||||
.requestWindowAttention = _glfwRequestWindowAttentionCocoa,
|
||||
.focusWindow = _glfwFocusWindowCocoa,
|
||||
.setWindowMonitor = _glfwSetWindowMonitorCocoa,
|
||||
.windowFocused = _glfwWindowFocusedCocoa,
|
||||
.windowIconified = _glfwWindowIconifiedCocoa,
|
||||
.windowVisible = _glfwWindowVisibleCocoa,
|
||||
.windowMaximized = _glfwWindowMaximizedCocoa,
|
||||
.windowHovered = _glfwWindowHoveredCocoa,
|
||||
.framebufferTransparent = _glfwFramebufferTransparentCocoa,
|
||||
.getWindowOpacity = _glfwGetWindowOpacityCocoa,
|
||||
.setWindowResizable = _glfwSetWindowResizableCocoa,
|
||||
.setWindowDecorated = _glfwSetWindowDecoratedCocoa,
|
||||
.setWindowFloating = _glfwSetWindowFloatingCocoa,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityCocoa,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughCocoa,
|
||||
.pollEvents = _glfwPollEventsCocoa,
|
||||
.waitEvents = _glfwWaitEventsCocoa,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutCocoa,
|
||||
.postEmptyEvent = _glfwPostEmptyEventCocoa,
|
||||
.getEGLPlatform = _glfwGetEGLPlatformCocoa,
|
||||
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayCocoa,
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowCocoa,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsCocoa,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportCocoa,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceCocoa
|
||||
};
|
||||
|
||||
*platform = cocoa;
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -136,6 +134,14 @@ static void matchCallback(void* context,
|
||||
return;
|
||||
}
|
||||
|
||||
CFArrayRef elements =
|
||||
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
||||
|
||||
// It is reportedly possible for this to fail on macOS 13 Ventura
|
||||
// if the application does not have input monitoring permissions
|
||||
if (!elements)
|
||||
return;
|
||||
|
||||
axes = CFArrayCreateMutable(NULL, 0, NULL);
|
||||
buttons = CFArrayCreateMutable(NULL, 0, NULL);
|
||||
hats = CFArrayCreateMutable(NULL, 0, NULL);
|
||||
@ -179,9 +185,6 @@ static void matchCallback(void* context,
|
||||
name[8], name[9], name[10]);
|
||||
}
|
||||
|
||||
CFArrayRef elements =
|
||||
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
||||
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(elements); i++)
|
||||
{
|
||||
IOHIDElementRef native = (IOHIDElementRef)
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -624,6 +622,13 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Cocoa: Platform not initialized");
|
||||
return kCGNullDirectDisplay;
|
||||
}
|
||||
|
||||
return monitor->ns.displayID;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ typedef struct _GLFWwindowNS
|
||||
|
||||
GLFWbool maximized;
|
||||
GLFWbool occluded;
|
||||
GLFWbool retina;
|
||||
GLFWbool scaleFramebuffer;
|
||||
|
||||
// Cached window properties to filter out duplicate events
|
||||
int width, height;
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -311,10 +309,15 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||
|
||||
- (void)windowDidChangeOcclusionState:(NSNotification* )notification
|
||||
{
|
||||
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
|
||||
window->ns.occluded = GLFW_FALSE;
|
||||
else
|
||||
window->ns.occluded = GLFW_TRUE;
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1090
|
||||
if ([window->ns.object respondsToSelector:@selector(occlusionState)])
|
||||
{
|
||||
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
|
||||
window->ns.occluded = GLFW_FALSE;
|
||||
else
|
||||
window->ns.occluded = GLFW_TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
@ -510,7 +513,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||
|
||||
if (xscale != window->ns.xscale || yscale != window->ns.yscale)
|
||||
{
|
||||
if (window->ns.retina && window->ns.layer)
|
||||
if (window->ns.scaleFramebuffer && window->ns.layer)
|
||||
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
|
||||
|
||||
window->ns.xscale = xscale;
|
||||
@ -869,7 +872,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
||||
[window->ns.object setFrameAutosaveName:@(wndconfig->ns.frameName)];
|
||||
|
||||
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
||||
window->ns.retina = wndconfig->ns.retina;
|
||||
window->ns.scaleFramebuffer = wndconfig->scaleFramebuffer;
|
||||
|
||||
if (fbconfig->transparent)
|
||||
{
|
||||
@ -1279,7 +1282,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
||||
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable);
|
||||
styleMask |= NSWindowStyleMaskBorderless;
|
||||
}
|
||||
else
|
||||
@ -1654,14 +1657,15 @@ const char* _glfwGetScancodeNameCocoa(int scancode)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (scancode < 0 || scancode > 0xff ||
|
||||
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
if (scancode < 0 || scancode > 0xff)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int key = _glfw.ns.keycodes[scancode];
|
||||
if (key == GLFW_KEY_UNKNOWN)
|
||||
return NULL;
|
||||
|
||||
UInt32 deadKeyState = 0;
|
||||
UniChar characters[4];
|
||||
@ -1965,7 +1969,7 @@ VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance,
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
if (window->ns.retina)
|
||||
if (window->ns.scaleFramebuffer)
|
||||
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
|
||||
|
||||
[window->ns.view setLayer:window->ns.layer];
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -363,6 +361,8 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
||||
|
||||
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
glfwMakeContextCurrent((GLFWwindow*) window);
|
||||
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
|
||||
return GLFW_FALSE;
|
||||
|
||||
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
|
||||
window->context.getProcAddress("glGetIntegerv");
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -311,6 +309,7 @@ static int extensionSupportedEGL(const char* extension)
|
||||
static GLFWglproc getProcAddressEGL(const char* procname)
|
||||
{
|
||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
assert(window != NULL);
|
||||
|
||||
if (window->context.egl.client)
|
||||
{
|
||||
@ -640,18 +639,18 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
|
||||
}
|
||||
|
||||
if (ctxconfig->noerror)
|
||||
{
|
||||
if (_glfw.egl.KHR_create_context_no_error)
|
||||
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
|
||||
}
|
||||
|
||||
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||
{
|
||||
SET_ATTRIB(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
|
||||
SET_ATTRIB(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
|
||||
}
|
||||
|
||||
if (ctxconfig->noerror)
|
||||
{
|
||||
if (_glfw.egl.KHR_create_context_no_error)
|
||||
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
SET_ATTRIB(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
|
||||
|
||||
@ -703,8 +702,11 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||
if (!fbconfig->doublebuffer)
|
||||
SET_ATTRIB(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
||||
|
||||
if (_glfw.egl.EXT_present_opaque)
|
||||
SET_ATTRIB(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
||||
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
|
||||
{
|
||||
if (_glfw.egl.EXT_present_opaque)
|
||||
SET_ATTRIB(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
||||
}
|
||||
|
||||
SET_ATTRIB(EGL_NONE, EGL_NONE);
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -192,6 +190,7 @@ static void swapBuffersGLX(_GLFWwindow* window)
|
||||
static void swapIntervalGLX(int interval)
|
||||
{
|
||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
assert(window != NULL);
|
||||
|
||||
if (_glfw.glx.EXT_swap_control)
|
||||
{
|
||||
|
45
src/init.c
45
src/init.c
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -51,19 +49,22 @@ static GLFWerrorfun _glfwErrorCallback;
|
||||
static GLFWallocator _glfwInitAllocator;
|
||||
static _GLFWinitconfig _glfwInitHints =
|
||||
{
|
||||
GLFW_TRUE, // hat buttons
|
||||
GLFW_ANGLE_PLATFORM_TYPE_NONE, // ANGLE backend
|
||||
GLFW_ANY_PLATFORM, // preferred platform
|
||||
NULL, // vkGetInstanceProcAddr function
|
||||
.hatButtons = GLFW_TRUE,
|
||||
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
|
||||
.platformID = GLFW_ANY_PLATFORM,
|
||||
.vulkanLoader = NULL,
|
||||
.ns =
|
||||
{
|
||||
GLFW_TRUE, // macOS menu bar
|
||||
GLFW_TRUE // macOS bundle chdir
|
||||
.menubar = GLFW_TRUE,
|
||||
.chdir = GLFW_TRUE
|
||||
},
|
||||
.x11 =
|
||||
{
|
||||
GLFW_TRUE, // X11 XCB Vulkan surface
|
||||
.xcbVulkanSurface = GLFW_TRUE,
|
||||
},
|
||||
.wl =
|
||||
{
|
||||
GLFW_WAYLAND_PREFER_LIBDECOR // Wayland libdecor mode
|
||||
.libdecorMode = GLFW_WAYLAND_PREFER_LIBDECOR
|
||||
},
|
||||
};
|
||||
|
||||
@ -245,30 +246,6 @@ int _glfw_max(int a, int b)
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
float _glfw_fminf(float a, float b)
|
||||
{
|
||||
if (a != a)
|
||||
return b;
|
||||
else if (b != b)
|
||||
return a;
|
||||
else if (a < b)
|
||||
return a;
|
||||
else
|
||||
return b;
|
||||
}
|
||||
|
||||
float _glfw_fmaxf(float a, float b)
|
||||
{
|
||||
if (a != a)
|
||||
return b;
|
||||
else if (b != b)
|
||||
return a;
|
||||
else if (a > b)
|
||||
return a;
|
||||
else
|
||||
return b;
|
||||
}
|
||||
|
||||
void* _glfw_calloc(size_t count, size_t size)
|
||||
{
|
||||
if (count && size)
|
||||
|
21
src/input.c
21
src/input.c
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include "mappings.h"
|
||||
@ -462,10 +460,11 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
||||
assert(hat >= 0);
|
||||
assert(hat < js->hatCount);
|
||||
|
||||
// Valid hat values only use the least significant nibble and have at most two bits
|
||||
// set, which can be considered adjacent plus an arbitrary rotation within the nibble
|
||||
// Valid hat values only use the least significant nibble
|
||||
assert((value & 0xf0) == 0);
|
||||
assert((value & ((value << 2) | (value >> 2))) == 0);
|
||||
// Valid hat values do not have both bits of an axis set
|
||||
assert((value & GLFW_HAT_LEFT) == 0 || (value & GLFW_HAT_RIGHT) == 0);
|
||||
assert((value & GLFW_HAT_UP) == 0 || (value & GLFW_HAT_DOWN) == 0);
|
||||
|
||||
base = js->buttonCount + hat * 4;
|
||||
|
||||
@ -701,6 +700,12 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
||||
|
||||
if (key != GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (key != GLFW_KEY_KP_EQUAL &&
|
||||
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
|
||||
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
|
||||
@ -716,12 +721,12 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
||||
|
||||
GLFWAPI int glfwGetKeyScancode(int key)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(-1);
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||
|
||||
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
|
||||
return GLFW_RELEASE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _glfw.platform.getKeyScancode(key);
|
||||
@ -1433,7 +1438,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
|
||||
if (e->type == _GLFW_JOYSTICK_AXIS)
|
||||
{
|
||||
const float value = js->axes[e->index] * e->axisScale + e->axisOffset;
|
||||
state->axes[i] = _glfw_fminf(_glfw_fmaxf(value, -1.f), 1.f);
|
||||
state->axes[i] = fminf(fmaxf(value, -1.f), 1.f);
|
||||
}
|
||||
else if (e->type == _GLFW_JOYSTICK_HATBIT)
|
||||
{
|
||||
|
@ -108,12 +108,6 @@ typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
|
||||
typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
|
||||
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
|
||||
|
||||
#if defined(_GLFW_WIN32)
|
||||
#define EGLAPIENTRY __stdcall
|
||||
#else
|
||||
#define EGLAPIENTRY
|
||||
#endif
|
||||
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
@ -200,22 +194,22 @@ typedef void* EGLNativeDisplayType;
|
||||
typedef void* EGLNativeWindowType;
|
||||
|
||||
// EGL function pointer typedefs
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
|
||||
typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
|
||||
typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum);
|
||||
typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
|
||||
typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
|
||||
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
|
||||
typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
|
||||
typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
|
||||
typedef EGLDisplay (APIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
|
||||
typedef EGLint (APIENTRY * PFN_eglGetError)(void);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglTerminate)(EGLDisplay);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglBindAPI)(EGLenum);
|
||||
typedef EGLContext (APIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
|
||||
typedef EGLSurface (APIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
|
||||
typedef EGLBoolean (APIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
|
||||
typedef const char* (APIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
|
||||
typedef GLFWglproc (APIENTRY * PFN_eglGetProcAddress)(const char*);
|
||||
#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
|
||||
#define eglGetConfigs _glfw.egl.GetConfigs
|
||||
#define eglGetDisplay _glfw.egl.GetDisplay
|
||||
@ -233,8 +227,8 @@ typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
|
||||
#define eglQueryString _glfw.egl.QueryString
|
||||
#define eglGetProcAddress _glfw.egl.GetProcAddress
|
||||
|
||||
typedef EGLDisplay (EGLAPIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*);
|
||||
typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*);
|
||||
typedef EGLDisplay (APIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*);
|
||||
typedef EGLSurface (APIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*);
|
||||
#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT
|
||||
#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT
|
||||
|
||||
@ -408,8 +402,8 @@ struct _GLFWwndconfig
|
||||
GLFWbool focusOnShow;
|
||||
GLFWbool mousePassthrough;
|
||||
GLFWbool scaleToMonitor;
|
||||
GLFWbool scaleFramebuffer;
|
||||
struct {
|
||||
GLFWbool retina;
|
||||
char frameName[256];
|
||||
} ns;
|
||||
struct {
|
||||
@ -418,6 +412,7 @@ struct _GLFWwndconfig
|
||||
} x11;
|
||||
struct {
|
||||
GLFWbool keymenu;
|
||||
GLFWbool showDefault;
|
||||
} win32;
|
||||
struct {
|
||||
char appId[256];
|
||||
@ -1003,8 +998,6 @@ char** _glfwParseUriList(char* text, int* count);
|
||||
char* _glfw_strdup(const char* source);
|
||||
int _glfw_min(int a, int b);
|
||||
int _glfw_max(int a, int b);
|
||||
float _glfw_fminf(float a, float b);
|
||||
float _glfw_fmaxf(float a, float b);
|
||||
|
||||
void* _glfw_calloc(size_t count, size_t size);
|
||||
void* _glfw_realloc(void* pointer, size_t size);
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -137,7 +135,7 @@ static GLFWbool openJoystickDevice(const char* path)
|
||||
}
|
||||
|
||||
_GLFWjoystickLinux linjs = {0};
|
||||
linjs.fd = open(path, O_RDONLY | O_NONBLOCK);
|
||||
linjs.fd = open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if (linjs.fd == -1)
|
||||
return GLFW_FALSE;
|
||||
|
||||
@ -326,7 +324,8 @@ GLFWbool _glfwInitJoysticksLinux(void)
|
||||
|
||||
// Continue without device connection notifications if inotify fails
|
||||
|
||||
if (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) != 0)
|
||||
_glfw.linjs.regexCompiled = (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) == 0);
|
||||
if (!_glfw.linjs.regexCompiled)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
|
||||
return GLFW_FALSE;
|
||||
@ -378,8 +377,10 @@ void _glfwTerminateJoysticksLinux(void)
|
||||
inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch);
|
||||
|
||||
close(_glfw.linjs.inotify);
|
||||
regfree(&_glfw.linjs.regex);
|
||||
}
|
||||
|
||||
if (_glfw.linjs.regexCompiled)
|
||||
regfree(&_glfw.linjs.regex);
|
||||
}
|
||||
|
||||
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
|
||||
|
@ -50,6 +50,7 @@ typedef struct _GLFWlibraryLinux
|
||||
int inotify;
|
||||
int watch;
|
||||
regex_t regex;
|
||||
GLFWbool regexCompiled;
|
||||
GLFWbool dropped;
|
||||
} _GLFWlibraryLinux;
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -489,7 +487,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
||||
// Apply gamma curve
|
||||
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
|
||||
// Clamp to value range
|
||||
value = _glfw_fminf(value, 65535.f);
|
||||
value = fminf(value, 65535.f);
|
||||
|
||||
values[i] = (unsigned short) value;
|
||||
}
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -83,11 +81,10 @@ static void swapIntervalNSGL(int interval)
|
||||
@autoreleasepool {
|
||||
|
||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
if (window)
|
||||
{
|
||||
[window->context.nsgl.object setValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
}
|
||||
assert(window != NULL);
|
||||
|
||||
[window->context.nsgl.object setValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
@ -336,7 +333,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||
}
|
||||
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina];
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.scaleFramebuffer];
|
||||
|
||||
[window->context.nsgl.object setView:window->ns.view];
|
||||
|
||||
|
146
src/null_init.c
146
src/null_init.c
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -41,78 +39,78 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform)
|
||||
{
|
||||
const _GLFWplatform null =
|
||||
{
|
||||
GLFW_PLATFORM_NULL,
|
||||
_glfwInitNull,
|
||||
_glfwTerminateNull,
|
||||
_glfwGetCursorPosNull,
|
||||
_glfwSetCursorPosNull,
|
||||
_glfwSetCursorModeNull,
|
||||
_glfwSetRawMouseMotionNull,
|
||||
_glfwRawMouseMotionSupportedNull,
|
||||
_glfwCreateCursorNull,
|
||||
_glfwCreateStandardCursorNull,
|
||||
_glfwDestroyCursorNull,
|
||||
_glfwSetCursorNull,
|
||||
_glfwGetScancodeNameNull,
|
||||
_glfwGetKeyScancodeNull,
|
||||
_glfwSetClipboardStringNull,
|
||||
_glfwGetClipboardStringNull,
|
||||
_glfwInitJoysticksNull,
|
||||
_glfwTerminateJoysticksNull,
|
||||
_glfwPollJoystickNull,
|
||||
_glfwGetMappingNameNull,
|
||||
_glfwUpdateGamepadGUIDNull,
|
||||
_glfwFreeMonitorNull,
|
||||
_glfwGetMonitorPosNull,
|
||||
_glfwGetMonitorContentScaleNull,
|
||||
_glfwGetMonitorWorkareaNull,
|
||||
_glfwGetVideoModesNull,
|
||||
_glfwGetVideoModeNull,
|
||||
_glfwGetGammaRampNull,
|
||||
_glfwSetGammaRampNull,
|
||||
_glfwCreateWindowNull,
|
||||
_glfwDestroyWindowNull,
|
||||
_glfwSetWindowTitleNull,
|
||||
_glfwSetWindowIconNull,
|
||||
_glfwGetWindowPosNull,
|
||||
_glfwSetWindowPosNull,
|
||||
_glfwGetWindowSizeNull,
|
||||
_glfwSetWindowSizeNull,
|
||||
_glfwSetWindowSizeLimitsNull,
|
||||
_glfwSetWindowAspectRatioNull,
|
||||
_glfwGetFramebufferSizeNull,
|
||||
_glfwGetWindowFrameSizeNull,
|
||||
_glfwGetWindowContentScaleNull,
|
||||
_glfwIconifyWindowNull,
|
||||
_glfwRestoreWindowNull,
|
||||
_glfwMaximizeWindowNull,
|
||||
_glfwShowWindowNull,
|
||||
_glfwHideWindowNull,
|
||||
_glfwRequestWindowAttentionNull,
|
||||
_glfwFocusWindowNull,
|
||||
_glfwSetWindowMonitorNull,
|
||||
_glfwWindowFocusedNull,
|
||||
_glfwWindowIconifiedNull,
|
||||
_glfwWindowVisibleNull,
|
||||
_glfwWindowMaximizedNull,
|
||||
_glfwWindowHoveredNull,
|
||||
_glfwFramebufferTransparentNull,
|
||||
_glfwGetWindowOpacityNull,
|
||||
_glfwSetWindowResizableNull,
|
||||
_glfwSetWindowDecoratedNull,
|
||||
_glfwSetWindowFloatingNull,
|
||||
_glfwSetWindowOpacityNull,
|
||||
_glfwSetWindowMousePassthroughNull,
|
||||
_glfwPollEventsNull,
|
||||
_glfwWaitEventsNull,
|
||||
_glfwWaitEventsTimeoutNull,
|
||||
_glfwPostEmptyEventNull,
|
||||
_glfwGetEGLPlatformNull,
|
||||
_glfwGetEGLNativeDisplayNull,
|
||||
_glfwGetEGLNativeWindowNull,
|
||||
_glfwGetRequiredInstanceExtensionsNull,
|
||||
_glfwGetPhysicalDevicePresentationSupportNull,
|
||||
_glfwCreateWindowSurfaceNull,
|
||||
.platformID = GLFW_PLATFORM_NULL,
|
||||
.init = _glfwInitNull,
|
||||
.terminate = _glfwTerminateNull,
|
||||
.getCursorPos = _glfwGetCursorPosNull,
|
||||
.setCursorPos = _glfwSetCursorPosNull,
|
||||
.setCursorMode = _glfwSetCursorModeNull,
|
||||
.setRawMouseMotion = _glfwSetRawMouseMotionNull,
|
||||
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedNull,
|
||||
.createCursor = _glfwCreateCursorNull,
|
||||
.createStandardCursor = _glfwCreateStandardCursorNull,
|
||||
.destroyCursor = _glfwDestroyCursorNull,
|
||||
.setCursor = _glfwSetCursorNull,
|
||||
.getScancodeName = _glfwGetScancodeNameNull,
|
||||
.getKeyScancode = _glfwGetKeyScancodeNull,
|
||||
.setClipboardString = _glfwSetClipboardStringNull,
|
||||
.getClipboardString = _glfwGetClipboardStringNull,
|
||||
.initJoysticks = _glfwInitJoysticksNull,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksNull,
|
||||
.pollJoystick = _glfwPollJoystickNull,
|
||||
.getMappingName = _glfwGetMappingNameNull,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
|
||||
.freeMonitor = _glfwFreeMonitorNull,
|
||||
.getMonitorPos = _glfwGetMonitorPosNull,
|
||||
.getMonitorContentScale = _glfwGetMonitorContentScaleNull,
|
||||
.getMonitorWorkarea = _glfwGetMonitorWorkareaNull,
|
||||
.getVideoModes = _glfwGetVideoModesNull,
|
||||
.getVideoMode = _glfwGetVideoModeNull,
|
||||
.getGammaRamp = _glfwGetGammaRampNull,
|
||||
.setGammaRamp = _glfwSetGammaRampNull,
|
||||
.createWindow = _glfwCreateWindowNull,
|
||||
.destroyWindow = _glfwDestroyWindowNull,
|
||||
.setWindowTitle = _glfwSetWindowTitleNull,
|
||||
.setWindowIcon = _glfwSetWindowIconNull,
|
||||
.getWindowPos = _glfwGetWindowPosNull,
|
||||
.setWindowPos = _glfwSetWindowPosNull,
|
||||
.getWindowSize = _glfwGetWindowSizeNull,
|
||||
.setWindowSize = _glfwSetWindowSizeNull,
|
||||
.setWindowSizeLimits = _glfwSetWindowSizeLimitsNull,
|
||||
.setWindowAspectRatio = _glfwSetWindowAspectRatioNull,
|
||||
.getFramebufferSize = _glfwGetFramebufferSizeNull,
|
||||
.getWindowFrameSize = _glfwGetWindowFrameSizeNull,
|
||||
.getWindowContentScale = _glfwGetWindowContentScaleNull,
|
||||
.iconifyWindow = _glfwIconifyWindowNull,
|
||||
.restoreWindow = _glfwRestoreWindowNull,
|
||||
.maximizeWindow = _glfwMaximizeWindowNull,
|
||||
.showWindow = _glfwShowWindowNull,
|
||||
.hideWindow = _glfwHideWindowNull,
|
||||
.requestWindowAttention = _glfwRequestWindowAttentionNull,
|
||||
.focusWindow = _glfwFocusWindowNull,
|
||||
.setWindowMonitor = _glfwSetWindowMonitorNull,
|
||||
.windowFocused = _glfwWindowFocusedNull,
|
||||
.windowIconified = _glfwWindowIconifiedNull,
|
||||
.windowVisible = _glfwWindowVisibleNull,
|
||||
.windowMaximized = _glfwWindowMaximizedNull,
|
||||
.windowHovered = _glfwWindowHoveredNull,
|
||||
.framebufferTransparent = _glfwFramebufferTransparentNull,
|
||||
.getWindowOpacity = _glfwGetWindowOpacityNull,
|
||||
.setWindowResizable = _glfwSetWindowResizableNull,
|
||||
.setWindowDecorated = _glfwSetWindowDecoratedNull,
|
||||
.setWindowFloating = _glfwSetWindowFloatingNull,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityNull,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughNull,
|
||||
.pollEvents = _glfwPollEventsNull,
|
||||
.waitEvents = _glfwWaitEventsNull,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutNull,
|
||||
.postEmptyEvent = _glfwPostEmptyEventNull,
|
||||
.getEGLPlatform = _glfwGetEGLPlatformNull,
|
||||
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayNull,
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowNull,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsNull,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportNull,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceNull
|
||||
};
|
||||
|
||||
*platform = null;
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -130,7 +128,7 @@ GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
float value;
|
||||
value = i / (float) (monitor->null.ramp.size - 1);
|
||||
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
|
||||
value = _glfw_fminf(value, 65535.f);
|
||||
value = fminf(value, 65535.f);
|
||||
|
||||
monitor->null.ramp.red[i] = (unsigned short) value;
|
||||
monitor->null.ramp.green[i] = (unsigned short) value;
|
||||
|
@ -239,7 +239,6 @@ void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled);
|
||||
GLFWbool _glfwRawMouseMotionSupportedNull(void);
|
||||
void _glfwShowWindowNull(_GLFWwindow* window);
|
||||
void _glfwRequestWindowAttentionNull(_GLFWwindow* window);
|
||||
void _glfwRequestWindowAttentionNull(_GLFWwindow* window);
|
||||
void _glfwHideWindowNull(_GLFWwindow* window);
|
||||
void _glfwFocusWindowNull(_GLFWwindow* window);
|
||||
GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window);
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -260,8 +258,9 @@ void _glfwSetWindowSizeNull(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
window->null.width = width;
|
||||
window->null.height = height;
|
||||
_glfwInputWindowSize(window, width, height);
|
||||
_glfwInputFramebufferSize(window, width, height);
|
||||
_glfwInputWindowDamage(window);
|
||||
_glfwInputWindowSize(window, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,16 +24,13 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
static void makeContextCurrentOSMesa(_GLFWwindow* window)
|
||||
{
|
||||
if (window)
|
||||
|
@ -24,11 +24,12 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// These construct a string literal from individual numeric constants
|
||||
#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
|
||||
#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
|
||||
@ -82,6 +83,22 @@ GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
#if defined(_GLFW_WAYLAND) && defined(_GLFW_X11)
|
||||
if (desiredID == GLFW_ANY_PLATFORM)
|
||||
{
|
||||
const char* const session = getenv("XDG_SESSION_TYPE");
|
||||
if (session)
|
||||
{
|
||||
// Only follow XDG_SESSION_TYPE if it is set correctly and the
|
||||
// environment looks plausble; otherwise fall back to detection
|
||||
if (strcmp(session, "wayland") == 0 && getenv("WAYLAND_DISPLAY"))
|
||||
desiredID = GLFW_PLATFORM_WAYLAND;
|
||||
else if (strcmp(session, "x11") == 0 && getenv("DISPLAY"))
|
||||
desiredID = GLFW_PLATFORM_X11;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (desiredID == GLFW_ANY_PLATFORM)
|
||||
{
|
||||
// If there is exactly one platform available for auto-selection, let it emit the
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include <poll.h>
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -117,6 +115,23 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
|
||||
if (_glfw.wgl.EXT_colorspace)
|
||||
ADD_ATTRIB(WGL_COLORSPACE_EXT);
|
||||
}
|
||||
|
||||
// NOTE: In a Parallels VM WGL_ARB_pixel_format returns fewer pixel formats than
|
||||
// DescribePixelFormat, violating the guarantees of the extension spec
|
||||
// HACK: Iterate through the minimum of both counts
|
||||
|
||||
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||
int extensionCount;
|
||||
|
||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
1, 0, 1, &attrib, &extensionCount))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to retrieve pixel format attribute");
|
||||
return 0;
|
||||
}
|
||||
|
||||
nativeCount = _glfw_min(nativeCount, extensionCount);
|
||||
}
|
||||
|
||||
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
@ -332,6 +347,7 @@ static void swapBuffersWGL(_GLFWwindow* window)
|
||||
static void swapIntervalWGL(int interval)
|
||||
{
|
||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
assert(window != NULL);
|
||||
|
||||
window->context.wgl.interval = interval;
|
||||
|
||||
|
150
src/win32_init.c
150
src/win32_init.c
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -432,7 +430,6 @@ static GLFWbool createHelperWindow(void)
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -605,78 +602,78 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
|
||||
{
|
||||
const _GLFWplatform win32 =
|
||||
{
|
||||
GLFW_PLATFORM_WIN32,
|
||||
_glfwInitWin32,
|
||||
_glfwTerminateWin32,
|
||||
_glfwGetCursorPosWin32,
|
||||
_glfwSetCursorPosWin32,
|
||||
_glfwSetCursorModeWin32,
|
||||
_glfwSetRawMouseMotionWin32,
|
||||
_glfwRawMouseMotionSupportedWin32,
|
||||
_glfwCreateCursorWin32,
|
||||
_glfwCreateStandardCursorWin32,
|
||||
_glfwDestroyCursorWin32,
|
||||
_glfwSetCursorWin32,
|
||||
_glfwGetScancodeNameWin32,
|
||||
_glfwGetKeyScancodeWin32,
|
||||
_glfwSetClipboardStringWin32,
|
||||
_glfwGetClipboardStringWin32,
|
||||
_glfwInitJoysticksWin32,
|
||||
_glfwTerminateJoysticksWin32,
|
||||
_glfwPollJoystickWin32,
|
||||
_glfwGetMappingNameWin32,
|
||||
_glfwUpdateGamepadGUIDWin32,
|
||||
_glfwFreeMonitorWin32,
|
||||
_glfwGetMonitorPosWin32,
|
||||
_glfwGetMonitorContentScaleWin32,
|
||||
_glfwGetMonitorWorkareaWin32,
|
||||
_glfwGetVideoModesWin32,
|
||||
_glfwGetVideoModeWin32,
|
||||
_glfwGetGammaRampWin32,
|
||||
_glfwSetGammaRampWin32,
|
||||
_glfwCreateWindowWin32,
|
||||
_glfwDestroyWindowWin32,
|
||||
_glfwSetWindowTitleWin32,
|
||||
_glfwSetWindowIconWin32,
|
||||
_glfwGetWindowPosWin32,
|
||||
_glfwSetWindowPosWin32,
|
||||
_glfwGetWindowSizeWin32,
|
||||
_glfwSetWindowSizeWin32,
|
||||
_glfwSetWindowSizeLimitsWin32,
|
||||
_glfwSetWindowAspectRatioWin32,
|
||||
_glfwGetFramebufferSizeWin32,
|
||||
_glfwGetWindowFrameSizeWin32,
|
||||
_glfwGetWindowContentScaleWin32,
|
||||
_glfwIconifyWindowWin32,
|
||||
_glfwRestoreWindowWin32,
|
||||
_glfwMaximizeWindowWin32,
|
||||
_glfwShowWindowWin32,
|
||||
_glfwHideWindowWin32,
|
||||
_glfwRequestWindowAttentionWin32,
|
||||
_glfwFocusWindowWin32,
|
||||
_glfwSetWindowMonitorWin32,
|
||||
_glfwWindowFocusedWin32,
|
||||
_glfwWindowIconifiedWin32,
|
||||
_glfwWindowVisibleWin32,
|
||||
_glfwWindowMaximizedWin32,
|
||||
_glfwWindowHoveredWin32,
|
||||
_glfwFramebufferTransparentWin32,
|
||||
_glfwGetWindowOpacityWin32,
|
||||
_glfwSetWindowResizableWin32,
|
||||
_glfwSetWindowDecoratedWin32,
|
||||
_glfwSetWindowFloatingWin32,
|
||||
_glfwSetWindowOpacityWin32,
|
||||
_glfwSetWindowMousePassthroughWin32,
|
||||
_glfwPollEventsWin32,
|
||||
_glfwWaitEventsWin32,
|
||||
_glfwWaitEventsTimeoutWin32,
|
||||
_glfwPostEmptyEventWin32,
|
||||
_glfwGetEGLPlatformWin32,
|
||||
_glfwGetEGLNativeDisplayWin32,
|
||||
_glfwGetEGLNativeWindowWin32,
|
||||
_glfwGetRequiredInstanceExtensionsWin32,
|
||||
_glfwGetPhysicalDevicePresentationSupportWin32,
|
||||
_glfwCreateWindowSurfaceWin32,
|
||||
.platformID = GLFW_PLATFORM_WIN32,
|
||||
.init = _glfwInitWin32,
|
||||
.terminate = _glfwTerminateWin32,
|
||||
.getCursorPos = _glfwGetCursorPosWin32,
|
||||
.setCursorPos = _glfwSetCursorPosWin32,
|
||||
.setCursorMode = _glfwSetCursorModeWin32,
|
||||
.setRawMouseMotion = _glfwSetRawMouseMotionWin32,
|
||||
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedWin32,
|
||||
.createCursor = _glfwCreateCursorWin32,
|
||||
.createStandardCursor = _glfwCreateStandardCursorWin32,
|
||||
.destroyCursor = _glfwDestroyCursorWin32,
|
||||
.setCursor = _glfwSetCursorWin32,
|
||||
.getScancodeName = _glfwGetScancodeNameWin32,
|
||||
.getKeyScancode = _glfwGetKeyScancodeWin32,
|
||||
.setClipboardString = _glfwSetClipboardStringWin32,
|
||||
.getClipboardString = _glfwGetClipboardStringWin32,
|
||||
.initJoysticks = _glfwInitJoysticksWin32,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksWin32,
|
||||
.pollJoystick = _glfwPollJoystickWin32,
|
||||
.getMappingName = _glfwGetMappingNameWin32,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDWin32,
|
||||
.freeMonitor = _glfwFreeMonitorWin32,
|
||||
.getMonitorPos = _glfwGetMonitorPosWin32,
|
||||
.getMonitorContentScale = _glfwGetMonitorContentScaleWin32,
|
||||
.getMonitorWorkarea = _glfwGetMonitorWorkareaWin32,
|
||||
.getVideoModes = _glfwGetVideoModesWin32,
|
||||
.getVideoMode = _glfwGetVideoModeWin32,
|
||||
.getGammaRamp = _glfwGetGammaRampWin32,
|
||||
.setGammaRamp = _glfwSetGammaRampWin32,
|
||||
.createWindow = _glfwCreateWindowWin32,
|
||||
.destroyWindow = _glfwDestroyWindowWin32,
|
||||
.setWindowTitle = _glfwSetWindowTitleWin32,
|
||||
.setWindowIcon = _glfwSetWindowIconWin32,
|
||||
.getWindowPos = _glfwGetWindowPosWin32,
|
||||
.setWindowPos = _glfwSetWindowPosWin32,
|
||||
.getWindowSize = _glfwGetWindowSizeWin32,
|
||||
.setWindowSize = _glfwSetWindowSizeWin32,
|
||||
.setWindowSizeLimits = _glfwSetWindowSizeLimitsWin32,
|
||||
.setWindowAspectRatio = _glfwSetWindowAspectRatioWin32,
|
||||
.getFramebufferSize = _glfwGetFramebufferSizeWin32,
|
||||
.getWindowFrameSize = _glfwGetWindowFrameSizeWin32,
|
||||
.getWindowContentScale = _glfwGetWindowContentScaleWin32,
|
||||
.iconifyWindow = _glfwIconifyWindowWin32,
|
||||
.restoreWindow = _glfwRestoreWindowWin32,
|
||||
.maximizeWindow = _glfwMaximizeWindowWin32,
|
||||
.showWindow = _glfwShowWindowWin32,
|
||||
.hideWindow = _glfwHideWindowWin32,
|
||||
.requestWindowAttention = _glfwRequestWindowAttentionWin32,
|
||||
.focusWindow = _glfwFocusWindowWin32,
|
||||
.setWindowMonitor = _glfwSetWindowMonitorWin32,
|
||||
.windowFocused = _glfwWindowFocusedWin32,
|
||||
.windowIconified = _glfwWindowIconifiedWin32,
|
||||
.windowVisible = _glfwWindowVisibleWin32,
|
||||
.windowMaximized = _glfwWindowMaximizedWin32,
|
||||
.windowHovered = _glfwWindowHoveredWin32,
|
||||
.framebufferTransparent = _glfwFramebufferTransparentWin32,
|
||||
.getWindowOpacity = _glfwGetWindowOpacityWin32,
|
||||
.setWindowResizable = _glfwSetWindowResizableWin32,
|
||||
.setWindowDecorated = _glfwSetWindowDecoratedWin32,
|
||||
.setWindowFloating = _glfwSetWindowFloatingWin32,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityWin32,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughWin32,
|
||||
.pollEvents = _glfwPollEventsWin32,
|
||||
.waitEvents = _glfwWaitEventsWin32,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutWin32,
|
||||
.postEmptyEvent = _glfwPostEmptyEventWin32,
|
||||
.getEGLPlatform = _glfwGetEGLPlatformWin32,
|
||||
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayWin32,
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowWin32,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsWin32,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportWin32,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceWin32
|
||||
};
|
||||
|
||||
*platform = win32;
|
||||
@ -707,6 +704,9 @@ int _glfwInitWin32(void)
|
||||
|
||||
void _glfwTerminateWin32(void)
|
||||
{
|
||||
if (_glfw.win32.blankCursor)
|
||||
DestroyIcon((HICON) _glfw.win32.blankCursor);
|
||||
|
||||
if (_glfw.win32.deviceNotificationHandle)
|
||||
UnregisterDeviceNotification(_glfw.win32.deviceNotificationHandle);
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -736,6 +734,13 @@ GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode)
|
||||
if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)
|
||||
dpad |= GLFW_HAT_LEFT;
|
||||
|
||||
// Treat invalid combinations as neither being pressed
|
||||
// while preserving what data can be preserved
|
||||
if ((dpad & GLFW_HAT_RIGHT) && (dpad & GLFW_HAT_LEFT))
|
||||
dpad &= ~(GLFW_HAT_RIGHT | GLFW_HAT_LEFT);
|
||||
if ((dpad & GLFW_HAT_UP) && (dpad & GLFW_HAT_DOWN))
|
||||
dpad &= ~(GLFW_HAT_UP | GLFW_HAT_DOWN);
|
||||
|
||||
_glfwInputJoystickHat(js, 0, dpad);
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -537,6 +535,13 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Win32: Platform not initialized");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return monitor->win32.publicAdapterName;
|
||||
}
|
||||
|
||||
@ -544,6 +549,13 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Win32: Platform not initialized");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return monitor->win32.publicDisplayName;
|
||||
}
|
||||
|
||||
|
@ -424,6 +424,7 @@ typedef struct _GLFWwindowWin32
|
||||
GLFWbool transparent;
|
||||
GLFWbool scaleToMonitor;
|
||||
GLFWbool keymenu;
|
||||
GLFWbool showDefault;
|
||||
|
||||
// Cached size used to filter out duplicate events
|
||||
int width, height;
|
||||
@ -457,6 +458,8 @@ typedef struct _GLFWlibraryWin32
|
||||
RAWINPUT* rawInput;
|
||||
int rawInputSize;
|
||||
UINT mouseTrailSize;
|
||||
// The cursor handle to use to hide the cursor (NULL or a transparent cursor)
|
||||
HCURSOR blankCursor;
|
||||
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -25,6 +25,11 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||
// but windows.h assumes no one will define APIENTRY before it does
|
||||
#undef APIENTRY
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define GLFW_WIN32_TLS_STATE _GLFWtlsWin32 win32;
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -25,6 +25,11 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||
// but windows.h assumes no one will define APIENTRY before it does
|
||||
#undef APIENTRY
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define GLFW_WIN32_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32;
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -234,7 +232,12 @@ static void updateCursorImage(_GLFWwindow* window)
|
||||
SetCursor(LoadCursorW(NULL, IDC_ARROW));
|
||||
}
|
||||
else
|
||||
SetCursor(NULL);
|
||||
{
|
||||
// NOTE: Via Remote Desktop, setting the cursor to NULL does not hide it.
|
||||
// HACK: When running locally, it is set to NULL, but when connected via Remote
|
||||
// Desktop, this is a transparent cursor.
|
||||
SetCursor(_glfw.win32.blankCursor);
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the cursor clip rect to the window content area
|
||||
@ -926,8 +929,28 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
||||
data = _glfw.win32.rawInput;
|
||||
if (data->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
|
||||
{
|
||||
dx = data->data.mouse.lLastX - window->win32.lastCursorPosX;
|
||||
dy = data->data.mouse.lLastY - window->win32.lastCursorPosY;
|
||||
POINT pos = {0};
|
||||
int width, height;
|
||||
|
||||
if (data->data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP)
|
||||
{
|
||||
pos.x += GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||
pos.y += GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||
height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = GetSystemMetrics(SM_CXSCREEN);
|
||||
height = GetSystemMetrics(SM_CYSCREEN);
|
||||
}
|
||||
|
||||
pos.x += (int) ((data->data.mouse.lLastX / 65535.f) * width);
|
||||
pos.y += (int) ((data->data.mouse.lLastY / 65535.f) * height);
|
||||
ScreenToClient(window->win32.handle, &pos);
|
||||
|
||||
dx = pos.x - window->win32.lastCursorPosX;
|
||||
dy = pos.y - window->win32.lastCursorPosY;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1291,6 +1314,34 @@ static int createNativeWindow(_GLFWwindow* window,
|
||||
}
|
||||
}
|
||||
|
||||
if (GetSystemMetrics(SM_REMOTESESSION))
|
||||
{
|
||||
// NOTE: On Remote Desktop, setting the cursor to NULL does not hide it
|
||||
// HACK: Create a transparent cursor and always set that instead of NULL
|
||||
// When not on Remote Desktop, this handle is NULL and normal hiding is used
|
||||
if (!_glfw.win32.blankCursor)
|
||||
{
|
||||
const int cursorWidth = GetSystemMetrics(SM_CXCURSOR);
|
||||
const int cursorHeight = GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
unsigned char* cursorPixels = _glfw_calloc(cursorWidth * cursorHeight, 4);
|
||||
if (!cursorPixels)
|
||||
return GLFW_FALSE;
|
||||
|
||||
// NOTE: Windows checks whether the image is fully transparent and if so
|
||||
// just ignores the alpha channel and makes the whole cursor opaque
|
||||
// HACK: Make one pixel slightly less transparent
|
||||
cursorPixels[3] = 1;
|
||||
|
||||
const GLFWimage cursorImage = { cursorWidth, cursorHeight, cursorPixels };
|
||||
_glfw.win32.blankCursor = createIcon(&cursorImage, 0, 0, FALSE);
|
||||
_glfw_free(cursorPixels);
|
||||
|
||||
if (!_glfw.win32.blankCursor)
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
@ -1367,6 +1418,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
||||
|
||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||
window->win32.keymenu = wndconfig->win32.keymenu;
|
||||
window->win32.showDefault = wndconfig->win32.showDefault;
|
||||
|
||||
if (!window->monitor)
|
||||
{
|
||||
@ -1749,7 +1801,23 @@ void _glfwMaximizeWindowWin32(_GLFWwindow* window)
|
||||
|
||||
void _glfwShowWindowWin32(_GLFWwindow* window)
|
||||
{
|
||||
ShowWindow(window->win32.handle, SW_SHOWNA);
|
||||
int showCommand = SW_SHOWNA;
|
||||
|
||||
if (window->win32.showDefault)
|
||||
{
|
||||
// NOTE: GLFW windows currently do not seem to match the Windows 10 definition of
|
||||
// a main window, so even SW_SHOWDEFAULT does nothing
|
||||
// This definition is undocumented and can change (source: Raymond Chen)
|
||||
// HACK: Apply the STARTUPINFO show command manually if available
|
||||
STARTUPINFOW si = { sizeof(si) };
|
||||
GetStartupInfoW(&si);
|
||||
if (si.dwFlags & STARTF_USESHOWWINDOW)
|
||||
showCommand = si.wShowWindow;
|
||||
|
||||
window->win32.showDefault = GLFW_FALSE;
|
||||
}
|
||||
|
||||
ShowWindow(window->win32.handle, showCommand);
|
||||
}
|
||||
|
||||
void _glfwHideWindowWin32(_GLFWwindow* window)
|
||||
@ -2104,6 +2172,7 @@ void _glfwPollEventsWin32(void)
|
||||
|
||||
// NOTE: Re-center the cursor only if it has moved since the last call,
|
||||
// to avoid breaking glfwWaitEvents with WM_MOUSEMOVE
|
||||
// The re-center is required in order to prevent the mouse cursor stopping at the edges of the screen.
|
||||
if (window->win32.lastCursorPosX != width / 2 ||
|
||||
window->win32.lastCursorPosY != height / 2)
|
||||
{
|
||||
@ -2121,7 +2190,7 @@ void _glfwWaitEventsWin32(void)
|
||||
|
||||
void _glfwWaitEventsTimeoutWin32(double timeout)
|
||||
{
|
||||
MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLEVENTS);
|
||||
MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLINPUT);
|
||||
|
||||
_glfwPollEventsWin32();
|
||||
}
|
||||
@ -2199,14 +2268,17 @@ void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode)
|
||||
|
||||
const char* _glfwGetScancodeNameWin32(int scancode)
|
||||
{
|
||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
||||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff))
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]];
|
||||
const int key = _glfw.win32.keycodes[scancode];
|
||||
if (key == GLFW_KEY_UNKNOWN)
|
||||
return NULL;
|
||||
|
||||
return _glfw.win32.keynames[key];
|
||||
}
|
||||
|
||||
int _glfwGetKeyScancodeWin32(int key)
|
||||
@ -2293,7 +2365,7 @@ void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||
|
||||
void _glfwSetClipboardStringWin32(const char* string)
|
||||
{
|
||||
int characterCount;
|
||||
int characterCount, tries = 0;
|
||||
HANDLE object;
|
||||
WCHAR* buffer;
|
||||
|
||||
@ -2321,12 +2393,20 @@ void _glfwSetClipboardStringWin32(const char* string)
|
||||
MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, characterCount);
|
||||
GlobalUnlock(object);
|
||||
|
||||
if (!OpenClipboard(_glfw.win32.helperWindowHandle))
|
||||
// NOTE: Retry clipboard opening a few times as some other application may have it
|
||||
// open and also the Windows Clipboard History reads it after each update
|
||||
while (!OpenClipboard(_glfw.win32.helperWindowHandle))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"Win32: Failed to open clipboard");
|
||||
GlobalFree(object);
|
||||
return;
|
||||
Sleep(1);
|
||||
tries++;
|
||||
|
||||
if (tries == 3)
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"Win32: Failed to open clipboard");
|
||||
GlobalFree(object);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EmptyClipboard();
|
||||
@ -2338,12 +2418,21 @@ const char* _glfwGetClipboardStringWin32(void)
|
||||
{
|
||||
HANDLE object;
|
||||
WCHAR* buffer;
|
||||
int tries = 0;
|
||||
|
||||
if (!OpenClipboard(_glfw.win32.helperWindowHandle))
|
||||
// NOTE: Retry clipboard opening a few times as some other application may have it
|
||||
// open and also the Windows Clipboard History reads it after each update
|
||||
while (!OpenClipboard(_glfw.win32.helperWindowHandle))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"Win32: Failed to open clipboard");
|
||||
return NULL;
|
||||
Sleep(1);
|
||||
tries++;
|
||||
|
||||
if (tries == 3)
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"Win32: Failed to open clipboard");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
object = GetClipboardData(CF_UNICODETEXT);
|
||||
|
18
src/window.c
18
src/window.c
@ -25,8 +25,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -276,6 +274,7 @@ void glfwDefaultWindowHints(void)
|
||||
_glfw.hints.window.focusOnShow = GLFW_TRUE;
|
||||
_glfw.hints.window.xpos = GLFW_ANY_POSITION;
|
||||
_glfw.hints.window.ypos = GLFW_ANY_POSITION;
|
||||
_glfw.hints.window.scaleFramebuffer = GLFW_TRUE;
|
||||
|
||||
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
|
||||
// double buffered
|
||||
@ -290,9 +289,6 @@ void glfwDefaultWindowHints(void)
|
||||
|
||||
// The default is to select the highest available refresh rate
|
||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||
|
||||
// The default is to use full Retina resolution framebuffers
|
||||
_glfw.hints.window.ns.retina = GLFW_TRUE;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
@ -376,18 +372,22 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
case GLFW_POSITION_Y:
|
||||
_glfw.hints.window.ypos = value;
|
||||
return;
|
||||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_WIN32_KEYBOARD_MENU:
|
||||
_glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_WIN32_SHOWDEFAULT:
|
||||
_glfw.hints.window.win32.showDefault = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_SCALE_TO_MONITOR:
|
||||
_glfw.hints.window.scaleToMonitor = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_SCALE_FRAMEBUFFER:
|
||||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||
_glfw.hints.window.scaleFramebuffer = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_CENTER_CURSOR:
|
||||
_glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
@ -742,7 +742,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(1.f);
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(0.f);
|
||||
return _glfw.platform.getWindowOpacity(window);
|
||||
}
|
||||
|
||||
|
273
src/wl_init.c
273
src/wl_init.c
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -40,14 +38,17 @@
|
||||
#include <sys/timerfd.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "wayland-client-protocol.h"
|
||||
#include "wayland-xdg-shell-client-protocol.h"
|
||||
#include "wayland-xdg-decoration-client-protocol.h"
|
||||
#include "wayland-viewporter-client-protocol.h"
|
||||
#include "wayland-relative-pointer-unstable-v1-client-protocol.h"
|
||||
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
|
||||
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
|
||||
#include "xdg-shell-client-protocol.h"
|
||||
#include "xdg-decoration-unstable-v1-client-protocol.h"
|
||||
#include "viewporter-client-protocol.h"
|
||||
#include "relative-pointer-unstable-v1-client-protocol.h"
|
||||
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
||||
#include "fractional-scale-v1-client-protocol.h"
|
||||
#include "xdg-activation-v1-client-protocol.h"
|
||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||
|
||||
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
|
||||
// wl_interface pointers 'types', making it impossible to combine several unmodified
|
||||
@ -59,27 +60,35 @@
|
||||
#undef types
|
||||
|
||||
#define types _glfw_xdg_shell_types
|
||||
#include "wayland-xdg-shell-client-protocol-code.h"
|
||||
#include "xdg-shell-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_xdg_decoration_types
|
||||
#include "wayland-xdg-decoration-client-protocol-code.h"
|
||||
#include "xdg-decoration-unstable-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_viewporter_types
|
||||
#include "wayland-viewporter-client-protocol-code.h"
|
||||
#include "viewporter-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_relative_pointer_types
|
||||
#include "wayland-relative-pointer-unstable-v1-client-protocol-code.h"
|
||||
#include "relative-pointer-unstable-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_pointer_constraints_types
|
||||
#include "wayland-pointer-constraints-unstable-v1-client-protocol-code.h"
|
||||
#include "pointer-constraints-unstable-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_fractional_scale_types
|
||||
#include "fractional-scale-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_xdg_activation_types
|
||||
#include "xdg-activation-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_idle_inhibit_types
|
||||
#include "wayland-idle-inhibit-unstable-v1-client-protocol-code.h"
|
||||
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
static void wmBaseHandlePing(void* userData,
|
||||
@ -178,6 +187,20 @@ static void registryHandleGlobal(void* userData,
|
||||
&zwp_idle_inhibit_manager_v1_interface,
|
||||
1);
|
||||
}
|
||||
else if (strcmp(interface, "xdg_activation_v1") == 0)
|
||||
{
|
||||
_glfw.wl.activationManager =
|
||||
wl_registry_bind(registry, name,
|
||||
&xdg_activation_v1_interface,
|
||||
1);
|
||||
}
|
||||
else if (strcmp(interface, "wp_fractional_scale_manager_v1") == 0)
|
||||
{
|
||||
_glfw.wl.fractionalScaleManager =
|
||||
wl_registry_bind(registry, name,
|
||||
&wp_fractional_scale_manager_v1_interface,
|
||||
1);
|
||||
}
|
||||
}
|
||||
|
||||
static void registryHandleGlobalRemove(void* userData,
|
||||
@ -216,6 +239,22 @@ static const struct libdecor_interface libdecorInterface =
|
||||
libdecorHandleError
|
||||
};
|
||||
|
||||
static void libdecorReadyCallback(void* userData,
|
||||
struct wl_callback* callback,
|
||||
uint32_t time)
|
||||
{
|
||||
_glfw.wl.libdecor.ready = GLFW_TRUE;
|
||||
|
||||
assert(_glfw.wl.libdecor.callback == callback);
|
||||
wl_callback_destroy(_glfw.wl.libdecor.callback);
|
||||
_glfw.wl.libdecor.callback = NULL;
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener libdecorReadyListener =
|
||||
{
|
||||
libdecorReadyCallback
|
||||
};
|
||||
|
||||
// Create key code translation tables
|
||||
//
|
||||
static void createKeyTables(void)
|
||||
@ -390,86 +429,86 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
|
||||
{
|
||||
const _GLFWplatform wayland =
|
||||
{
|
||||
GLFW_PLATFORM_WAYLAND,
|
||||
_glfwInitWayland,
|
||||
_glfwTerminateWayland,
|
||||
_glfwGetCursorPosWayland,
|
||||
_glfwSetCursorPosWayland,
|
||||
_glfwSetCursorModeWayland,
|
||||
_glfwSetRawMouseMotionWayland,
|
||||
_glfwRawMouseMotionSupportedWayland,
|
||||
_glfwCreateCursorWayland,
|
||||
_glfwCreateStandardCursorWayland,
|
||||
_glfwDestroyCursorWayland,
|
||||
_glfwSetCursorWayland,
|
||||
_glfwGetScancodeNameWayland,
|
||||
_glfwGetKeyScancodeWayland,
|
||||
_glfwSetClipboardStringWayland,
|
||||
_glfwGetClipboardStringWayland,
|
||||
.platformID = GLFW_PLATFORM_WAYLAND,
|
||||
.init = _glfwInitWayland,
|
||||
.terminate = _glfwTerminateWayland,
|
||||
.getCursorPos = _glfwGetCursorPosWayland,
|
||||
.setCursorPos = _glfwSetCursorPosWayland,
|
||||
.setCursorMode = _glfwSetCursorModeWayland,
|
||||
.setRawMouseMotion = _glfwSetRawMouseMotionWayland,
|
||||
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedWayland,
|
||||
.createCursor = _glfwCreateCursorWayland,
|
||||
.createStandardCursor = _glfwCreateStandardCursorWayland,
|
||||
.destroyCursor = _glfwDestroyCursorWayland,
|
||||
.setCursor = _glfwSetCursorWayland,
|
||||
.getScancodeName = _glfwGetScancodeNameWayland,
|
||||
.getKeyScancode = _glfwGetKeyScancodeWayland,
|
||||
.setClipboardString = _glfwSetClipboardStringWayland,
|
||||
.getClipboardString = _glfwGetClipboardStringWayland,
|
||||
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
|
||||
_glfwInitJoysticksLinux,
|
||||
_glfwTerminateJoysticksLinux,
|
||||
_glfwPollJoystickLinux,
|
||||
_glfwGetMappingNameLinux,
|
||||
_glfwUpdateGamepadGUIDLinux,
|
||||
.initJoysticks = _glfwInitJoysticksLinux,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksLinux,
|
||||
.pollJoystick = _glfwPollJoystickLinux,
|
||||
.getMappingName = _glfwGetMappingNameLinux,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDLinux,
|
||||
#else
|
||||
_glfwInitJoysticksNull,
|
||||
_glfwTerminateJoysticksNull,
|
||||
_glfwPollJoystickNull,
|
||||
_glfwGetMappingNameNull,
|
||||
_glfwUpdateGamepadGUIDNull,
|
||||
.initJoysticks = _glfwInitJoysticksNull,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksNull,
|
||||
.pollJoystick = _glfwPollJoystickNull,
|
||||
.getMappingName = _glfwGetMappingNameNull,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
|
||||
#endif
|
||||
_glfwFreeMonitorWayland,
|
||||
_glfwGetMonitorPosWayland,
|
||||
_glfwGetMonitorContentScaleWayland,
|
||||
_glfwGetMonitorWorkareaWayland,
|
||||
_glfwGetVideoModesWayland,
|
||||
_glfwGetVideoModeWayland,
|
||||
_glfwGetGammaRampWayland,
|
||||
_glfwSetGammaRampWayland,
|
||||
_glfwCreateWindowWayland,
|
||||
_glfwDestroyWindowWayland,
|
||||
_glfwSetWindowTitleWayland,
|
||||
_glfwSetWindowIconWayland,
|
||||
_glfwGetWindowPosWayland,
|
||||
_glfwSetWindowPosWayland,
|
||||
_glfwGetWindowSizeWayland,
|
||||
_glfwSetWindowSizeWayland,
|
||||
_glfwSetWindowSizeLimitsWayland,
|
||||
_glfwSetWindowAspectRatioWayland,
|
||||
_glfwGetFramebufferSizeWayland,
|
||||
_glfwGetWindowFrameSizeWayland,
|
||||
_glfwGetWindowContentScaleWayland,
|
||||
_glfwIconifyWindowWayland,
|
||||
_glfwRestoreWindowWayland,
|
||||
_glfwMaximizeWindowWayland,
|
||||
_glfwShowWindowWayland,
|
||||
_glfwHideWindowWayland,
|
||||
_glfwRequestWindowAttentionWayland,
|
||||
_glfwFocusWindowWayland,
|
||||
_glfwSetWindowMonitorWayland,
|
||||
_glfwWindowFocusedWayland,
|
||||
_glfwWindowIconifiedWayland,
|
||||
_glfwWindowVisibleWayland,
|
||||
_glfwWindowMaximizedWayland,
|
||||
_glfwWindowHoveredWayland,
|
||||
_glfwFramebufferTransparentWayland,
|
||||
_glfwGetWindowOpacityWayland,
|
||||
_glfwSetWindowResizableWayland,
|
||||
_glfwSetWindowDecoratedWayland,
|
||||
_glfwSetWindowFloatingWayland,
|
||||
_glfwSetWindowOpacityWayland,
|
||||
_glfwSetWindowMousePassthroughWayland,
|
||||
_glfwPollEventsWayland,
|
||||
_glfwWaitEventsWayland,
|
||||
_glfwWaitEventsTimeoutWayland,
|
||||
_glfwPostEmptyEventWayland,
|
||||
_glfwGetEGLPlatformWayland,
|
||||
_glfwGetEGLNativeDisplayWayland,
|
||||
_glfwGetEGLNativeWindowWayland,
|
||||
_glfwGetRequiredInstanceExtensionsWayland,
|
||||
_glfwGetPhysicalDevicePresentationSupportWayland,
|
||||
_glfwCreateWindowSurfaceWayland,
|
||||
.freeMonitor = _glfwFreeMonitorWayland,
|
||||
.getMonitorPos = _glfwGetMonitorPosWayland,
|
||||
.getMonitorContentScale = _glfwGetMonitorContentScaleWayland,
|
||||
.getMonitorWorkarea = _glfwGetMonitorWorkareaWayland,
|
||||
.getVideoModes = _glfwGetVideoModesWayland,
|
||||
.getVideoMode = _glfwGetVideoModeWayland,
|
||||
.getGammaRamp = _glfwGetGammaRampWayland,
|
||||
.setGammaRamp = _glfwSetGammaRampWayland,
|
||||
.createWindow = _glfwCreateWindowWayland,
|
||||
.destroyWindow = _glfwDestroyWindowWayland,
|
||||
.setWindowTitle = _glfwSetWindowTitleWayland,
|
||||
.setWindowIcon = _glfwSetWindowIconWayland,
|
||||
.getWindowPos = _glfwGetWindowPosWayland,
|
||||
.setWindowPos = _glfwSetWindowPosWayland,
|
||||
.getWindowSize = _glfwGetWindowSizeWayland,
|
||||
.setWindowSize = _glfwSetWindowSizeWayland,
|
||||
.setWindowSizeLimits = _glfwSetWindowSizeLimitsWayland,
|
||||
.setWindowAspectRatio = _glfwSetWindowAspectRatioWayland,
|
||||
.getFramebufferSize = _glfwGetFramebufferSizeWayland,
|
||||
.getWindowFrameSize = _glfwGetWindowFrameSizeWayland,
|
||||
.getWindowContentScale = _glfwGetWindowContentScaleWayland,
|
||||
.iconifyWindow = _glfwIconifyWindowWayland,
|
||||
.restoreWindow = _glfwRestoreWindowWayland,
|
||||
.maximizeWindow = _glfwMaximizeWindowWayland,
|
||||
.showWindow = _glfwShowWindowWayland,
|
||||
.hideWindow = _glfwHideWindowWayland,
|
||||
.requestWindowAttention = _glfwRequestWindowAttentionWayland,
|
||||
.focusWindow = _glfwFocusWindowWayland,
|
||||
.setWindowMonitor = _glfwSetWindowMonitorWayland,
|
||||
.windowFocused = _glfwWindowFocusedWayland,
|
||||
.windowIconified = _glfwWindowIconifiedWayland,
|
||||
.windowVisible = _glfwWindowVisibleWayland,
|
||||
.windowMaximized = _glfwWindowMaximizedWayland,
|
||||
.windowHovered = _glfwWindowHoveredWayland,
|
||||
.framebufferTransparent = _glfwFramebufferTransparentWayland,
|
||||
.getWindowOpacity = _glfwGetWindowOpacityWayland,
|
||||
.setWindowResizable = _glfwSetWindowResizableWayland,
|
||||
.setWindowDecorated = _glfwSetWindowDecoratedWayland,
|
||||
.setWindowFloating = _glfwSetWindowFloatingWayland,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityWayland,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughWayland,
|
||||
.pollEvents = _glfwPollEventsWayland,
|
||||
.waitEvents = _glfwWaitEventsWayland,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutWayland,
|
||||
.postEmptyEvent = _glfwPostEmptyEventWayland,
|
||||
.getEGLPlatform = _glfwGetEGLPlatformWayland,
|
||||
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayWayland,
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowWayland,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsWayland,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportWayland,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceWayland
|
||||
};
|
||||
|
||||
void* module = _glfwPlatformLoadModule("libwayland-client.so.0");
|
||||
@ -666,6 +705,32 @@ int _glfwInitWayland(void)
|
||||
_glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
|
||||
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
|
||||
|
||||
if (!_glfw.wl.xkb.context_new ||
|
||||
!_glfw.wl.xkb.context_unref ||
|
||||
!_glfw.wl.xkb.keymap_new_from_string ||
|
||||
!_glfw.wl.xkb.keymap_unref ||
|
||||
!_glfw.wl.xkb.keymap_mod_get_index ||
|
||||
!_glfw.wl.xkb.keymap_key_repeats ||
|
||||
!_glfw.wl.xkb.keymap_key_get_syms_by_level ||
|
||||
!_glfw.wl.xkb.state_new ||
|
||||
!_glfw.wl.xkb.state_unref ||
|
||||
!_glfw.wl.xkb.state_key_get_syms ||
|
||||
!_glfw.wl.xkb.state_update_mask ||
|
||||
!_glfw.wl.xkb.state_key_get_layout ||
|
||||
!_glfw.wl.xkb.state_mod_index_is_active ||
|
||||
!_glfw.wl.xkb.compose_table_new_from_locale ||
|
||||
!_glfw.wl.xkb.compose_table_unref ||
|
||||
!_glfw.wl.xkb.compose_state_new ||
|
||||
!_glfw.wl.xkb.compose_state_unref ||
|
||||
!_glfw.wl.xkb.compose_state_feed ||
|
||||
!_glfw.wl.xkb.compose_state_get_status ||
|
||||
!_glfw.wl.xkb.compose_state_get_one_sym)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Failed to load all entry points from libxkbcommon");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (_glfw.hints.init.wl.libdecorMode == GLFW_WAYLAND_PREFER_LIBDECOR)
|
||||
_glfw.wl.libdecor.handle = _glfwPlatformLoadModule("libdecor-0.so.0");
|
||||
|
||||
@ -775,19 +840,24 @@ int _glfwInitWayland(void)
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfw.wl.libdecor.context = libdecor_new(_glfw.wl.display, &libdecorInterface);
|
||||
|
||||
// Allow libdecor to receive its globals before proceeding
|
||||
if (_glfw.wl.libdecor.context)
|
||||
libdecor_dispatch(_glfw.wl.libdecor.context, 1);
|
||||
{
|
||||
// Perform an initial dispatch and flush to get the init started
|
||||
libdecor_dispatch(_glfw.wl.libdecor.context, 0);
|
||||
|
||||
// Create sync point to "know" when libdecor is ready for use
|
||||
_glfw.wl.libdecor.callback = wl_display_sync(_glfw.wl.display);
|
||||
wl_callback_add_listener(_glfw.wl.libdecor.callback,
|
||||
&libdecorReadyListener,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
||||
if (wl_seat_get_version(_glfw.wl.seat) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
|
||||
{
|
||||
_glfw.wl.keyRepeatTimerfd =
|
||||
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!_glfw.wl.wmBase)
|
||||
{
|
||||
@ -823,7 +893,14 @@ void _glfwTerminateWayland(void)
|
||||
_glfwTerminateOSMesa();
|
||||
|
||||
if (_glfw.wl.libdecor.context)
|
||||
{
|
||||
// Allow libdecor to finish receiving all its requested globals
|
||||
// and ensure the associated sync callback object is destroyed
|
||||
while (!_glfw.wl.libdecor.ready)
|
||||
_glfwWaitEventsWayland();
|
||||
|
||||
libdecor_unref(_glfw.wl.libdecor.context);
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
@ -902,6 +979,10 @@ void _glfwTerminateWayland(void)
|
||||
zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints);
|
||||
if (_glfw.wl.idleInhibitManager)
|
||||
zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager);
|
||||
if (_glfw.wl.activationManager)
|
||||
xdg_activation_v1_destroy(_glfw.wl.activationManager);
|
||||
if (_glfw.wl.fractionalScaleManager)
|
||||
wp_fractional_scale_manager_v1_destroy(_glfw.wl.fractionalScaleManager);
|
||||
if (_glfw.wl.registry)
|
||||
wl_registry_destroy(_glfw.wl.registry);
|
||||
if (_glfw.wl.display)
|
||||
|
@ -23,8 +23,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -114,24 +112,22 @@ static void outputHandleScale(void* userData,
|
||||
{
|
||||
struct _GLFWmonitor* monitor = userData;
|
||||
|
||||
monitor->wl.contentScale = factor;
|
||||
monitor->wl.scale = factor;
|
||||
|
||||
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
||||
{
|
||||
for (int i = 0; i < window->wl.scaleCount; i++)
|
||||
for (size_t i = 0; i < window->wl.outputScaleCount; i++)
|
||||
{
|
||||
if (window->wl.scales[i].output == monitor->wl.output)
|
||||
if (window->wl.outputScales[i].output == monitor->wl.output)
|
||||
{
|
||||
window->wl.scales[i].factor = monitor->wl.contentScale;
|
||||
_glfwUpdateContentScaleWayland(window);
|
||||
window->wl.outputScales[i].factor = monitor->wl.scale;
|
||||
_glfwUpdateBufferScaleFromOutputsWayland(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||
|
||||
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
|
||||
{
|
||||
struct _GLFWmonitor* monitor = userData;
|
||||
@ -145,18 +141,14 @@ void outputHandleDescription(void* userData,
|
||||
{
|
||||
}
|
||||
|
||||
#endif // WL_OUTPUT_NAME_SINCE_VERSION
|
||||
|
||||
static const struct wl_output_listener outputListener =
|
||||
{
|
||||
outputHandleGeometry,
|
||||
outputHandleMode,
|
||||
outputHandleDone,
|
||||
outputHandleScale,
|
||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||
outputHandleName,
|
||||
outputHandleDescription,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -173,11 +165,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||
version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
|
||||
#else
|
||||
version = 2;
|
||||
#endif
|
||||
|
||||
struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
|
||||
name,
|
||||
@ -188,7 +176,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
||||
|
||||
// The actual name of this output will be set in the geometry handler
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
|
||||
monitor->wl.contentScale = 1;
|
||||
monitor->wl.scale = 1;
|
||||
monitor->wl.output = output;
|
||||
monitor->wl.name = name;
|
||||
|
||||
@ -219,9 +207,9 @@ void _glfwGetMonitorContentScaleWayland(_GLFWmonitor* monitor,
|
||||
float* xscale, float* yscale)
|
||||
{
|
||||
if (xscale)
|
||||
*xscale = (float) monitor->wl.contentScale;
|
||||
*xscale = (float) monitor->wl.scale;
|
||||
if (yscale)
|
||||
*yscale = (float) monitor->wl.contentScale;
|
||||
*yscale = (float) monitor->wl.scale;
|
||||
}
|
||||
|
||||
void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor,
|
||||
@ -271,6 +259,13 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Wayland: Platform not initialized");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return monitor->wl.output;
|
||||
}
|
||||
|
||||
|
@ -129,6 +129,10 @@ struct wl_output;
|
||||
#define xdg_surface_interface _glfw_xdg_surface_interface
|
||||
#define xdg_toplevel_interface _glfw_xdg_toplevel_interface
|
||||
#define xdg_wm_base_interface _glfw_xdg_wm_base_interface
|
||||
#define xdg_activation_v1_interface _glfw_xdg_activation_v1_interface
|
||||
#define xdg_activation_token_v1_interface _glfw_xdg_activation_token_v1_interface
|
||||
#define wl_surface_interface _glfw_wl_surface_interface
|
||||
#define wp_fractional_scale_v1_interface _glfw_wp_fractional_scale_v1_interface
|
||||
|
||||
#define GLFW_WAYLAND_WINDOW_STATE _GLFWwindowWayland wl;
|
||||
#define GLFW_WAYLAND_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl;
|
||||
@ -321,21 +325,12 @@ typedef void (* PFN_libdecor_state_free)(struct libdecor_state*);
|
||||
#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
|
||||
#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
|
||||
|
||||
typedef enum _GLFWdecorationSideWayland
|
||||
{
|
||||
GLFW_MAIN_WINDOW,
|
||||
GLFW_TOP_DECORATION,
|
||||
GLFW_LEFT_DECORATION,
|
||||
GLFW_RIGHT_DECORATION,
|
||||
GLFW_BOTTOM_DECORATION
|
||||
} _GLFWdecorationSideWayland;
|
||||
|
||||
typedef struct _GLFWdecorationWayland
|
||||
typedef struct _GLFWfallbackEdgeWayland
|
||||
{
|
||||
struct wl_surface* surface;
|
||||
struct wl_subsurface* subsurface;
|
||||
struct wp_viewport* viewport;
|
||||
} _GLFWdecorationWayland;
|
||||
} _GLFWfallbackEdgeWayland;
|
||||
|
||||
typedef struct _GLFWofferWayland
|
||||
{
|
||||
@ -347,7 +342,7 @@ typedef struct _GLFWofferWayland
|
||||
typedef struct _GLFWscaleWayland
|
||||
{
|
||||
struct wl_output* output;
|
||||
int factor;
|
||||
int32_t factor;
|
||||
} _GLFWscaleWayland;
|
||||
|
||||
// Wayland-specific per-window data
|
||||
@ -355,12 +350,14 @@ typedef struct _GLFWscaleWayland
|
||||
typedef struct _GLFWwindowWayland
|
||||
{
|
||||
int width, height;
|
||||
int fbWidth, fbHeight;
|
||||
GLFWbool visible;
|
||||
GLFWbool maximized;
|
||||
GLFWbool activated;
|
||||
GLFWbool fullscreen;
|
||||
GLFWbool hovered;
|
||||
GLFWbool transparent;
|
||||
GLFWbool scaleFramebuffer;
|
||||
struct wl_surface* surface;
|
||||
struct wl_callback* callback;
|
||||
|
||||
@ -385,7 +382,6 @@ typedef struct _GLFWwindowWayland
|
||||
|
||||
struct {
|
||||
struct libdecor_frame* frame;
|
||||
int mode;
|
||||
} libdecor;
|
||||
|
||||
_GLFWcursor* currentCursor;
|
||||
@ -396,22 +392,28 @@ typedef struct _GLFWwindowWayland
|
||||
|
||||
// We need to track the monitors the window spans on to calculate the
|
||||
// optimal scaling factor.
|
||||
int contentScale;
|
||||
_GLFWscaleWayland* scales;
|
||||
int scaleCount;
|
||||
int scaleSize;
|
||||
int32_t bufferScale;
|
||||
_GLFWscaleWayland* outputScales;
|
||||
size_t outputScaleCount;
|
||||
size_t outputScaleSize;
|
||||
|
||||
struct wp_viewport* scalingViewport;
|
||||
uint32_t scalingNumerator;
|
||||
struct wp_fractional_scale_v1* fractionalScale;
|
||||
|
||||
struct zwp_relative_pointer_v1* relativePointer;
|
||||
struct zwp_locked_pointer_v1* lockedPointer;
|
||||
struct zwp_confined_pointer_v1* confinedPointer;
|
||||
|
||||
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
||||
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
||||
struct xdg_activation_token_v1* activationToken;
|
||||
|
||||
struct {
|
||||
struct wl_buffer* buffer;
|
||||
_GLFWdecorationWayland top, left, right, bottom;
|
||||
_GLFWdecorationSideWayland focus;
|
||||
} decorations;
|
||||
GLFWbool decorations;
|
||||
struct wl_buffer* buffer;
|
||||
_GLFWfallbackEdgeWayland top, left, right, bottom;
|
||||
struct wl_surface* focus;
|
||||
} fallback;
|
||||
} _GLFWwindowWayland;
|
||||
|
||||
// Wayland-specific global data
|
||||
@ -434,6 +436,8 @@ typedef struct _GLFWlibraryWayland
|
||||
struct zwp_relative_pointer_manager_v1* relativePointerManager;
|
||||
struct zwp_pointer_constraints_v1* pointerConstraints;
|
||||
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
|
||||
struct xdg_activation_v1* activationManager;
|
||||
struct wp_fractional_scale_manager_v1* fractionalScaleManager;
|
||||
|
||||
_GLFWofferWayland* offers;
|
||||
unsigned int offerCount;
|
||||
@ -550,6 +554,8 @@ typedef struct _GLFWlibraryWayland
|
||||
struct {
|
||||
void* handle;
|
||||
struct libdecor* context;
|
||||
struct wl_callback* callback;
|
||||
GLFWbool ready;
|
||||
PFN_libdecor_new libdecor_new_;
|
||||
PFN_libdecor_unref libdecor_unref_;
|
||||
PFN_libdecor_get_fd libdecor_get_fd_;
|
||||
@ -588,7 +594,7 @@ typedef struct _GLFWmonitorWayland
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int contentScale;
|
||||
int32_t scale;
|
||||
} _GLFWmonitorWayland;
|
||||
|
||||
// Wayland-specific per-cursor data
|
||||
@ -679,7 +685,7 @@ GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
|
||||
void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
||||
|
||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
||||
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
|
||||
void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window);
|
||||
|
||||
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
|
||||
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
|
||||
|
956
src/wl_window.c
956
src/wl_window.c
File diff suppressed because it is too large
Load Diff
156
src/x11_init.c
156
src/x11_init.c
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -1168,86 +1166,86 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform)
|
||||
{
|
||||
const _GLFWplatform x11 =
|
||||
{
|
||||
GLFW_PLATFORM_X11,
|
||||
_glfwInitX11,
|
||||
_glfwTerminateX11,
|
||||
_glfwGetCursorPosX11,
|
||||
_glfwSetCursorPosX11,
|
||||
_glfwSetCursorModeX11,
|
||||
_glfwSetRawMouseMotionX11,
|
||||
_glfwRawMouseMotionSupportedX11,
|
||||
_glfwCreateCursorX11,
|
||||
_glfwCreateStandardCursorX11,
|
||||
_glfwDestroyCursorX11,
|
||||
_glfwSetCursorX11,
|
||||
_glfwGetScancodeNameX11,
|
||||
_glfwGetKeyScancodeX11,
|
||||
_glfwSetClipboardStringX11,
|
||||
_glfwGetClipboardStringX11,
|
||||
.platformID = GLFW_PLATFORM_X11,
|
||||
.init = _glfwInitX11,
|
||||
.terminate = _glfwTerminateX11,
|
||||
.getCursorPos = _glfwGetCursorPosX11,
|
||||
.setCursorPos = _glfwSetCursorPosX11,
|
||||
.setCursorMode = _glfwSetCursorModeX11,
|
||||
.setRawMouseMotion = _glfwSetRawMouseMotionX11,
|
||||
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedX11,
|
||||
.createCursor = _glfwCreateCursorX11,
|
||||
.createStandardCursor = _glfwCreateStandardCursorX11,
|
||||
.destroyCursor = _glfwDestroyCursorX11,
|
||||
.setCursor = _glfwSetCursorX11,
|
||||
.getScancodeName = _glfwGetScancodeNameX11,
|
||||
.getKeyScancode = _glfwGetKeyScancodeX11,
|
||||
.setClipboardString = _glfwSetClipboardStringX11,
|
||||
.getClipboardString = _glfwGetClipboardStringX11,
|
||||
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
|
||||
_glfwInitJoysticksLinux,
|
||||
_glfwTerminateJoysticksLinux,
|
||||
_glfwPollJoystickLinux,
|
||||
_glfwGetMappingNameLinux,
|
||||
_glfwUpdateGamepadGUIDLinux,
|
||||
.initJoysticks = _glfwInitJoysticksLinux,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksLinux,
|
||||
.pollJoystick = _glfwPollJoystickLinux,
|
||||
.getMappingName = _glfwGetMappingNameLinux,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDLinux,
|
||||
#else
|
||||
_glfwInitJoysticksNull,
|
||||
_glfwTerminateJoysticksNull,
|
||||
_glfwPollJoystickNull,
|
||||
_glfwGetMappingNameNull,
|
||||
_glfwUpdateGamepadGUIDNull,
|
||||
.initJoysticks = _glfwInitJoysticksNull,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksNull,
|
||||
.pollJoystick = _glfwPollJoystickNull,
|
||||
.getMappingName = _glfwGetMappingNameNull,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
|
||||
#endif
|
||||
_glfwFreeMonitorX11,
|
||||
_glfwGetMonitorPosX11,
|
||||
_glfwGetMonitorContentScaleX11,
|
||||
_glfwGetMonitorWorkareaX11,
|
||||
_glfwGetVideoModesX11,
|
||||
_glfwGetVideoModeX11,
|
||||
_glfwGetGammaRampX11,
|
||||
_glfwSetGammaRampX11,
|
||||
_glfwCreateWindowX11,
|
||||
_glfwDestroyWindowX11,
|
||||
_glfwSetWindowTitleX11,
|
||||
_glfwSetWindowIconX11,
|
||||
_glfwGetWindowPosX11,
|
||||
_glfwSetWindowPosX11,
|
||||
_glfwGetWindowSizeX11,
|
||||
_glfwSetWindowSizeX11,
|
||||
_glfwSetWindowSizeLimitsX11,
|
||||
_glfwSetWindowAspectRatioX11,
|
||||
_glfwGetFramebufferSizeX11,
|
||||
_glfwGetWindowFrameSizeX11,
|
||||
_glfwGetWindowContentScaleX11,
|
||||
_glfwIconifyWindowX11,
|
||||
_glfwRestoreWindowX11,
|
||||
_glfwMaximizeWindowX11,
|
||||
_glfwShowWindowX11,
|
||||
_glfwHideWindowX11,
|
||||
_glfwRequestWindowAttentionX11,
|
||||
_glfwFocusWindowX11,
|
||||
_glfwSetWindowMonitorX11,
|
||||
_glfwWindowFocusedX11,
|
||||
_glfwWindowIconifiedX11,
|
||||
_glfwWindowVisibleX11,
|
||||
_glfwWindowMaximizedX11,
|
||||
_glfwWindowHoveredX11,
|
||||
_glfwFramebufferTransparentX11,
|
||||
_glfwGetWindowOpacityX11,
|
||||
_glfwSetWindowResizableX11,
|
||||
_glfwSetWindowDecoratedX11,
|
||||
_glfwSetWindowFloatingX11,
|
||||
_glfwSetWindowOpacityX11,
|
||||
_glfwSetWindowMousePassthroughX11,
|
||||
_glfwPollEventsX11,
|
||||
_glfwWaitEventsX11,
|
||||
_glfwWaitEventsTimeoutX11,
|
||||
_glfwPostEmptyEventX11,
|
||||
_glfwGetEGLPlatformX11,
|
||||
_glfwGetEGLNativeDisplayX11,
|
||||
_glfwGetEGLNativeWindowX11,
|
||||
_glfwGetRequiredInstanceExtensionsX11,
|
||||
_glfwGetPhysicalDevicePresentationSupportX11,
|
||||
_glfwCreateWindowSurfaceX11,
|
||||
.freeMonitor = _glfwFreeMonitorX11,
|
||||
.getMonitorPos = _glfwGetMonitorPosX11,
|
||||
.getMonitorContentScale = _glfwGetMonitorContentScaleX11,
|
||||
.getMonitorWorkarea = _glfwGetMonitorWorkareaX11,
|
||||
.getVideoModes = _glfwGetVideoModesX11,
|
||||
.getVideoMode = _glfwGetVideoModeX11,
|
||||
.getGammaRamp = _glfwGetGammaRampX11,
|
||||
.setGammaRamp = _glfwSetGammaRampX11,
|
||||
.createWindow = _glfwCreateWindowX11,
|
||||
.destroyWindow = _glfwDestroyWindowX11,
|
||||
.setWindowTitle = _glfwSetWindowTitleX11,
|
||||
.setWindowIcon = _glfwSetWindowIconX11,
|
||||
.getWindowPos = _glfwGetWindowPosX11,
|
||||
.setWindowPos = _glfwSetWindowPosX11,
|
||||
.getWindowSize = _glfwGetWindowSizeX11,
|
||||
.setWindowSize = _glfwSetWindowSizeX11,
|
||||
.setWindowSizeLimits = _glfwSetWindowSizeLimitsX11,
|
||||
.setWindowAspectRatio = _glfwSetWindowAspectRatioX11,
|
||||
.getFramebufferSize = _glfwGetFramebufferSizeX11,
|
||||
.getWindowFrameSize = _glfwGetWindowFrameSizeX11,
|
||||
.getWindowContentScale = _glfwGetWindowContentScaleX11,
|
||||
.iconifyWindow = _glfwIconifyWindowX11,
|
||||
.restoreWindow = _glfwRestoreWindowX11,
|
||||
.maximizeWindow = _glfwMaximizeWindowX11,
|
||||
.showWindow = _glfwShowWindowX11,
|
||||
.hideWindow = _glfwHideWindowX11,
|
||||
.requestWindowAttention = _glfwRequestWindowAttentionX11,
|
||||
.focusWindow = _glfwFocusWindowX11,
|
||||
.setWindowMonitor = _glfwSetWindowMonitorX11,
|
||||
.windowFocused = _glfwWindowFocusedX11,
|
||||
.windowIconified = _glfwWindowIconifiedX11,
|
||||
.windowVisible = _glfwWindowVisibleX11,
|
||||
.windowMaximized = _glfwWindowMaximizedX11,
|
||||
.windowHovered = _glfwWindowHoveredX11,
|
||||
.framebufferTransparent = _glfwFramebufferTransparentX11,
|
||||
.getWindowOpacity = _glfwGetWindowOpacityX11,
|
||||
.setWindowResizable = _glfwSetWindowResizableX11,
|
||||
.setWindowDecorated = _glfwSetWindowDecoratedX11,
|
||||
.setWindowFloating = _glfwSetWindowFloatingX11,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityX11,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughX11,
|
||||
.pollEvents = _glfwPollEventsX11,
|
||||
.waitEvents = _glfwWaitEventsX11,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutX11,
|
||||
.postEmptyEvent = _glfwPostEmptyEventX11,
|
||||
.getEGLPlatform = _glfwGetEGLPlatformX11,
|
||||
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayX11,
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowX11,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsX11,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportX11,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceX11
|
||||
};
|
||||
|
||||
// HACK: If the application has left the locale as "C" then both wide
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -606,6 +604,13 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
|
||||
return None;
|
||||
}
|
||||
|
||||
return monitor->x11.crtc;
|
||||
}
|
||||
|
||||
@ -613,6 +618,13 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
|
||||
return None;
|
||||
}
|
||||
|
||||
return monitor->x11.output;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -81,24 +79,25 @@ static GLFWbool waitForX11Event(double* timeout)
|
||||
//
|
||||
static GLFWbool waitForAnyEvent(double* timeout)
|
||||
{
|
||||
nfds_t count = 2;
|
||||
struct pollfd fds[3] =
|
||||
enum { XLIB_FD, PIPE_FD, INOTIFY_FD };
|
||||
struct pollfd fds[] =
|
||||
{
|
||||
{ ConnectionNumber(_glfw.x11.display), POLLIN },
|
||||
{ _glfw.x11.emptyEventPipe[0], POLLIN }
|
||||
[XLIB_FD] = { ConnectionNumber(_glfw.x11.display), POLLIN },
|
||||
[PIPE_FD] = { _glfw.x11.emptyEventPipe[0], POLLIN },
|
||||
[INOTIFY_FD] = { -1, POLLIN }
|
||||
};
|
||||
|
||||
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
|
||||
if (_glfw.joysticksInitialized)
|
||||
fds[count++] = (struct pollfd) { _glfw.linjs.inotify, POLLIN };
|
||||
fds[INOTIFY_FD].fd = _glfw.linjs.inotify;
|
||||
#endif
|
||||
|
||||
while (!XPending(_glfw.x11.display))
|
||||
{
|
||||
if (!_glfwPollPOSIX(fds, count, timeout))
|
||||
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
|
||||
return GLFW_FALSE;
|
||||
|
||||
for (int i = 1; i < count; i++)
|
||||
for (int i = 1; i < sizeof(fds) / sizeof(fds[0]); i++)
|
||||
{
|
||||
if (fds[i].revents & POLLIN)
|
||||
return GLFW_TRUE;
|
||||
@ -1489,6 +1488,9 @@ static void processEvent(XEvent *event)
|
||||
if (event->xconfigure.width != window->x11.width ||
|
||||
event->xconfigure.height != window->x11.height)
|
||||
{
|
||||
window->x11.width = event->xconfigure.width;
|
||||
window->x11.height = event->xconfigure.height;
|
||||
|
||||
_glfwInputFramebufferSize(window,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height);
|
||||
@ -1496,9 +1498,6 @@ static void processEvent(XEvent *event)
|
||||
_glfwInputWindowSize(window,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height);
|
||||
|
||||
window->x11.width = event->xconfigure.width;
|
||||
window->x11.height = event->xconfigure.height;
|
||||
}
|
||||
|
||||
int xpos = event->xconfigure.x;
|
||||
@ -1526,9 +1525,10 @@ static void processEvent(XEvent *event)
|
||||
|
||||
if (xpos != window->x11.xpos || ypos != window->x11.ypos)
|
||||
{
|
||||
_glfwInputWindowPos(window, xpos, ypos);
|
||||
window->x11.xpos = xpos;
|
||||
window->x11.ypos = ypos;
|
||||
|
||||
_glfwInputWindowPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -2903,14 +2903,16 @@ const char* _glfwGetScancodeNameX11(int scancode)
|
||||
if (!_glfw.x11.xkb.available)
|
||||
return NULL;
|
||||
|
||||
if (scancode < 0 || scancode > 0xff ||
|
||||
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
if (scancode < 0 || scancode > 0xff)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int key = _glfw.x11.keycodes[scancode];
|
||||
if (key == GLFW_KEY_UNKNOWN)
|
||||
return NULL;
|
||||
|
||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
||||
scancode, _glfw.x11.xkb.group, 0);
|
||||
if (keysym == NoSymbol)
|
||||
|
@ -24,8 +24,6 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -400,24 +400,34 @@ static void scroll_callback(GLFWwindow* window, double x, double y)
|
||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
const char* name = glfwGetKeyName(key, scancode);
|
||||
|
||||
if (name)
|
||||
if (key == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
||||
get_key_name(key),
|
||||
name,
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
printf("%08x to %i at %0.3f: Key (%s) Scancode 0x%04x (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(),
|
||||
get_key_name(key), scancode,
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
||||
get_key_name(key),
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
const char* name = glfwGetKeyName(key, scancode);
|
||||
if (name)
|
||||
{
|
||||
printf("%08x to %i at %0.3f: Key 0x%04x (%s) Scancode 0x%04x Name %s (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(),
|
||||
key, get_key_name(key), scancode, name,
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%08x to %i at %0.3f: Key 0x%04x (%s) Scancode 0x%04x (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(),
|
||||
key, get_key_name(key), scancode,
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
}
|
||||
}
|
||||
|
||||
if (action != GLFW_PRESS)
|
||||
|
@ -71,7 +71,7 @@ int main(int argc, char** argv)
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(600, 600, "Window Features", NULL, NULL);
|
||||
GLFWwindow* window = glfwCreateWindow(600, 630, "Window Features", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
@ -121,17 +121,20 @@ int main(int argc, char** argv)
|
||||
nk_glfw3_new_frame();
|
||||
if (nk_begin(nk, "main", area, 0))
|
||||
{
|
||||
nk_layout_row_dynamic(nk, 30, 5);
|
||||
nk_layout_row_dynamic(nk, 30, 4);
|
||||
|
||||
if (nk_button_label(nk, "Toggle Fullscreen"))
|
||||
if (glfwGetWindowMonitor(window))
|
||||
{
|
||||
if (glfwGetWindowMonitor(window))
|
||||
if (nk_button_label(nk, "Make Windowed"))
|
||||
{
|
||||
glfwSetWindowMonitor(window, NULL,
|
||||
windowed_x, windowed_y,
|
||||
windowed_width, windowed_height, 0);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nk_button_label(nk, "Make Fullscreen"))
|
||||
{
|
||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||
@ -149,7 +152,10 @@ int main(int argc, char** argv)
|
||||
glfwIconifyWindow(window);
|
||||
if (nk_button_label(nk, "Restore"))
|
||||
glfwRestoreWindow(window);
|
||||
if (nk_button_label(nk, "Hide (briefly)"))
|
||||
|
||||
nk_layout_row_dynamic(nk, 30, 2);
|
||||
|
||||
if (nk_button_label(nk, "Hide (for 3s)"))
|
||||
{
|
||||
glfwHideWindow(window);
|
||||
|
||||
@ -159,6 +165,16 @@ int main(int argc, char** argv)
|
||||
|
||||
glfwShowWindow(window);
|
||||
}
|
||||
if (nk_button_label(nk, "Request Attention (after 3s)"))
|
||||
{
|
||||
glfwIconifyWindow(window);
|
||||
|
||||
const double time = glfwGetTime() + 3.0;
|
||||
while (glfwGetTime() < time)
|
||||
glfwWaitEventsTimeout(1.0);
|
||||
|
||||
glfwRequestWindowAttention(window);
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(nk, 30, 1);
|
||||
|
||||
@ -211,7 +227,7 @@ int main(int argc, char** argv)
|
||||
last_ypos = ypos;
|
||||
}
|
||||
else
|
||||
nk_label(nk, "Position not supported", NK_TEXT_LEFT);
|
||||
nk_label(nk, "Platform does not support window position", NK_TEXT_LEFT);
|
||||
|
||||
nk_layout_row_dynamic(nk, 30, 3);
|
||||
nk_label(nk, "Size", NK_TEXT_LEFT);
|
||||
|
Loading…
Reference in New Issue
Block a user