mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Merge branch 'latest' into new-cursors-on-3.3-stable
This commit is contained in:
commit
e91fa399f1
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -1,8 +1,6 @@
|
|||||||
|
|
||||||
* @elmindreda
|
* @elmindreda
|
||||||
|
|
||||||
src/wl_* @linkmauve
|
|
||||||
|
|
||||||
docs/*.css @glfw/webdev
|
docs/*.css @glfw/webdev
|
||||||
docs/*.scss @glfw/webdev
|
docs/*.scss @glfw/webdev
|
||||||
docs/*.html @glfw/webdev
|
docs/*.html @glfw/webdev
|
||||||
|
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
@ -12,11 +12,12 @@ jobs:
|
|||||||
build-linux-x11-clang:
|
build-linux-x11-clang:
|
||||||
name: X11 (Linux, Clang)
|
name: X11 (Linux, Clang)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 4
|
||||||
env:
|
env:
|
||||||
CC: clang
|
CC: clang
|
||||||
CFLAGS: -Werror
|
CFLAGS: -Werror
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@ -35,11 +36,12 @@ jobs:
|
|||||||
build-linux-wayland-clang:
|
build-linux-wayland-clang:
|
||||||
name: Wayland (Linux, Clang)
|
name: Wayland (Linux, Clang)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 4
|
||||||
env:
|
env:
|
||||||
CC: clang
|
CC: clang
|
||||||
CFLAGS: -Werror
|
CFLAGS: -Werror
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@ -58,11 +60,12 @@ jobs:
|
|||||||
build-linux-null-clang:
|
build-linux-null-clang:
|
||||||
name: Null (Linux, Clang)
|
name: Null (Linux, Clang)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 4
|
||||||
env:
|
env:
|
||||||
CC: clang
|
CC: clang
|
||||||
CFLAGS: -Werror
|
CFLAGS: -Werror
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@ -81,11 +84,12 @@ jobs:
|
|||||||
build-macos-cocoa-clang:
|
build-macos-cocoa-clang:
|
||||||
name: Cocoa (macOS, Clang)
|
name: Cocoa (macOS, Clang)
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
timeout-minutes: 4
|
||||||
env:
|
env:
|
||||||
CFLAGS: -Werror
|
CFLAGS: -Werror
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.8
|
MACOSX_DEPLOYMENT_TARGET: 10.8
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure static library
|
- name: Configure static library
|
||||||
run: cmake -S . -B build-static
|
run: cmake -S . -B build-static
|
||||||
@ -100,10 +104,11 @@ jobs:
|
|||||||
build-windows-win32-vs2022:
|
build-windows-win32-vs2022:
|
||||||
name: Win32 (Windows, VS2022)
|
name: Win32 (Windows, VS2022)
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
timeout-minutes: 4
|
||||||
env:
|
env:
|
||||||
CFLAGS: /WX
|
CFLAGS: /WX
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure static library
|
- name: Configure static library
|
||||||
run: cmake -S . -B build-static -G "Visual Studio 17 2022"
|
run: cmake -S . -B build-static -G "Visual Studio 17 2022"
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
# The canonical out-of-tree build subdirectory
|
# The canonical out-of-tree build subdirectory
|
||||||
build
|
build
|
||||||
|
build-*
|
||||||
|
|
||||||
# Visual Studio clutter
|
# Visual Studio clutter
|
||||||
_ReSharper*
|
_ReSharper*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
|
||||||
|
|
||||||
project(GLFW VERSION 3.3.9 LANGUAGES C)
|
project(GLFW VERSION 3.3.10 LANGUAGES C)
|
||||||
|
|
||||||
if (POLICY CMP0054)
|
if (POLICY CMP0054)
|
||||||
cmake_policy(SET CMP0054 NEW)
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
@ -45,6 +45,7 @@ video tutorials.
|
|||||||
- Bailey Cosier
|
- Bailey Cosier
|
||||||
- Noel Cower
|
- Noel Cower
|
||||||
- CuriouserThing
|
- CuriouserThing
|
||||||
|
- Bill Currie
|
||||||
- Jason Daly
|
- Jason Daly
|
||||||
- danhambleton
|
- danhambleton
|
||||||
- Jarrod Davis
|
- Jarrod Davis
|
||||||
@ -129,6 +130,7 @@ video tutorials.
|
|||||||
- lo-v-ol
|
- lo-v-ol
|
||||||
- Eyal Lotem
|
- Eyal Lotem
|
||||||
- Aaron Loucks
|
- Aaron Loucks
|
||||||
|
- Ned Loynd
|
||||||
- Luflosi
|
- Luflosi
|
||||||
- lukect
|
- lukect
|
||||||
- Tristam MacDonald
|
- Tristam MacDonald
|
||||||
@ -161,6 +163,7 @@ video tutorials.
|
|||||||
- Martins Mozeiko
|
- Martins Mozeiko
|
||||||
- James Murphy
|
- James Murphy
|
||||||
- Julian Møller
|
- Julian Møller
|
||||||
|
- NateIsStalling
|
||||||
- ndogxj
|
- ndogxj
|
||||||
- F. Nedelec
|
- F. Nedelec
|
||||||
- Kristian Nielsen
|
- Kristian Nielsen
|
||||||
@ -202,6 +205,7 @@ video tutorials.
|
|||||||
- Aleksey Rybalkin
|
- Aleksey Rybalkin
|
||||||
- Mikko Rytkönen
|
- Mikko Rytkönen
|
||||||
- Riku Salminen
|
- Riku Salminen
|
||||||
|
- Anton Samokhvalov
|
||||||
- Brandon Schaefer
|
- Brandon Schaefer
|
||||||
- Sebastian Schuberth
|
- Sebastian Schuberth
|
||||||
- Christian Sdunek
|
- Christian Sdunek
|
||||||
@ -231,6 +235,7 @@ video tutorials.
|
|||||||
- Paul Sultana
|
- Paul Sultana
|
||||||
- Nathan Sweet
|
- Nathan Sweet
|
||||||
- TTK-Bandit
|
- TTK-Bandit
|
||||||
|
- Nuno Teixeira
|
||||||
- Sergey Tikhomirov
|
- Sergey Tikhomirov
|
||||||
- Arthur Tombs
|
- Arthur Tombs
|
||||||
- TronicLabs
|
- TronicLabs
|
||||||
@ -253,6 +258,7 @@ video tutorials.
|
|||||||
- Jay Weisskopf
|
- Jay Weisskopf
|
||||||
- Frank Wille
|
- Frank Wille
|
||||||
- Richard A. Wilkes
|
- Richard A. Wilkes
|
||||||
|
- Andy Williams
|
||||||
- Tatsuya Yatagawa
|
- Tatsuya Yatagawa
|
||||||
- Ryogo Yoshimura
|
- Ryogo Yoshimura
|
||||||
- Rácz Zalán
|
- Rácz Zalán
|
||||||
|
39
README.md
39
README.md
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
[![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions)
|
[![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions)
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw)
|
[![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw)
|
||||||
[![Coverity Scan](https://scan.coverity.com/projects/4884/badge.svg)](https://scan.coverity.com/projects/glfw-glfw)
|
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
@ -123,33 +122,12 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Bugfix: `glfwGetKeyScancode` returned `0` on error when initialized instead of `-1`
|
- Bugfix: `glfwGetKeyName` emitted `GLFW_INVALID_VALUE` for scancodes with no
|
||||||
- Bugfix: Failure to make a newly created context current could cause segfault (#2327)
|
key token (#1785,#2214)
|
||||||
- [Win32] Fix pkg-config for dynamic library on Windows (#2386, #2420)
|
- [Wayland] Bugfix: Terminating the library before showing a window could segfault
|
||||||
- [Win32] Bugfix: `glfwWaitEventsTimeout` did not return for some sent messages (#2408)
|
- [Wayland] Bugfix: Compilation failed on FreeBSD (#2445)
|
||||||
- [Win32] Bugfix: XInput could reportedly provide invalid DPad bit masks (#2291)
|
- [Linux] Bugfix: `regfree´ was called on invalid data (#2464)
|
||||||
- [Cocoa] Bugfix: Compilation failed on OS X 10.8 due to unconditional use of 10.9+
|
- [WGL] Bugfix: Context creation failed in Parallels VM (#2191,#2406,#2467)
|
||||||
symbols (#2161)
|
|
||||||
- [Cocoa] Bugfix: Full screen windows were resizable by the user (#2377,#2405)
|
|
||||||
- [Cocoa] Bugfix: Full screen windows were miniaturized when clicked on macOS
|
|
||||||
10.15 (#2377,#2405)
|
|
||||||
- [Cocoa] Bugfix: Querying joystick elements could reportedly segfault on macOS
|
|
||||||
13 Ventura (#2320)
|
|
||||||
- [Cocoa] Bugfix: Print Screen key was not correctly reported (#1786,#2169)
|
|
||||||
- [Wayland] Added improved fallback window decorations via libdecor (#1639,#1693)
|
|
||||||
- [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450)
|
|
||||||
- [Wayland] Disabled alpha channel for opaque windows on systems lacking
|
|
||||||
`EGL_EXT_present_opaque` (#1895)
|
|
||||||
- [Wayland] Bugfix: Buffer would overrun when storing received drag offer (#2225)
|
|
||||||
- [Wayland] Bugfix: Joysticks connected after `glfwInit` were not detected (#2198)
|
|
||||||
- [Wayland] Bugfix: Fallback decorations emitted `GLFW_CURSOR_UNAVAILABLE` errors
|
|
||||||
- [Wayland] Bugfix: Some events could fail to end wait for new events (#2397)
|
|
||||||
- [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043)
|
|
||||||
- [Linux] Bugfix: A small amount of memory could leak if initialization failed (#2229)
|
|
||||||
- [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL
|
|
||||||
- [EGL] Bugfix: `EGL_EXT_present_opaque` caused issues on X11 with Nvidia blob (#2365)
|
|
||||||
- [EGL] Bugfix: Setting `GLFW_CONTEXT_DEBUG` caused creation to fail (#2348)
|
|
||||||
- [GLX] Added loading of glvnd `libGLX.so.0` where available
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
@ -158,13 +136,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.
|
well as news, documentation and other information about the project.
|
||||||
|
|
||||||
If you have questions related to the use of GLFW, we have a
|
If you have questions related to the use of GLFW, we have a
|
||||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
[forum](https://discourse.glfw.org/).
|
||||||
[Libera.Chat](https://libera.chat/).
|
|
||||||
|
|
||||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||||
request, please file it in the
|
request, please file it in the
|
||||||
[issue tracker](https://github.com/glfw/glfw/issues) on GitHub.
|
[issue tracker](https://github.com/glfw/glfw/issues) on GitHub.
|
||||||
|
|
||||||
Finally, if you're interested in helping out with the development of GLFW or
|
Finally, if you're interested in helping out with the development of GLFW or
|
||||||
porting it to your favorite platform, join us on the forum, GitHub or IRC.
|
porting it to your favorite platform, join us on the forum or GitHub.
|
||||||
|
|
||||||
|
@ -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
|
section](https://discourse.glfw.org/c/support) of the forum, under the [Stack
|
||||||
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
||||||
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
||||||
Stack Exchange or in the IRC channel `#glfw` on
|
Stack Exchange.
|
||||||
[Libera.Chat](https://libera.chat/).
|
|
||||||
|
|
||||||
Questions about the design or implementation of GLFW or about future plans
|
Questions about the design or implementation of GLFW or about future plans
|
||||||
should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
|
should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
|
||||||
forum or in the IRC channel. Please don't open a GitHub issue to discuss design
|
forum. Please don't open a GitHub issue to discuss design questions without
|
||||||
questions without first checking with a maintainer.
|
first checking with a maintainer.
|
||||||
|
|
||||||
|
|
||||||
## Reporting a bug
|
## Reporting a bug
|
||||||
|
@ -4,8 +4,7 @@ See the [latest documentation](https://www.glfw.org/docs/latest/) for tutorials,
|
|||||||
guides and the API reference.
|
guides and the API reference.
|
||||||
|
|
||||||
If you have questions about using GLFW, we have a
|
If you have questions about using GLFW, we have a
|
||||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
[forum](https://discourse.glfw.org/).
|
||||||
[Libera.Chat](https://libera.chat/).
|
|
||||||
|
|
||||||
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
||||||
Please check the [contribution
|
Please check the [contribution
|
||||||
|
111
docs/build.dox
111
docs/build.dox
@ -160,20 +160,94 @@ A good general introduction to linking is
|
|||||||
David Drysdale.
|
David Drysdale.
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_win32 With MinGW or Visual C++ on Windows
|
@subsection build_link_win32 With Visual C++ and GLFW binaries
|
||||||
|
|
||||||
The static version of the GLFW library is named `glfw3`. When using this
|
If you are using a downloaded
|
||||||
version, it is also necessary to link with some libraries that GLFW uses.
|
[binary archive](https://www.glfw.org/download.html), first make sure you have
|
||||||
|
the archive matching the architecture you are building for (32-bit or 64-bit),
|
||||||
|
or you will get link errors. Also make sure you are using the binaries for your
|
||||||
|
version of Visual C++ or you may get other link errors.
|
||||||
|
|
||||||
When using MinGW to link an application with the static version of GLFW, you
|
There are two version of the static GLFW library in the binary archive, because
|
||||||
must also explicitly link with `gdi32`. Other toolchains including MinGW-w64
|
it needs to use the same base run-time library variant as the rest of your
|
||||||
include it in the set of default libraries along with other dependencies like
|
executable.
|
||||||
`user32` and `kernel32`.
|
|
||||||
|
|
||||||
The link library for the GLFW DLL is named `glfw3dll`. When compiling an
|
One is named `glfw3.lib` and is for projects with the _Runtime Library_ project
|
||||||
application that uses the DLL version of GLFW, you need to define the @ref
|
option set to _Multi-threaded DLL_ or _Multi-threaded Debug DLL_. The other is
|
||||||
GLFW_DLL macro _before_ any inclusion of the GLFW header. This can be done
|
named `glfw3_mt.lib` and is for projects with _Runtime Library_ set to
|
||||||
either with a compiler switch or by defining it in your source code.
|
_Multi-threaded_ or _Multi-threaded Debug_. To use the static GLFW library you
|
||||||
|
will need to add `path/to/glfw3.lib` or `path/to/glfw3_mt.lib` to the
|
||||||
|
_Additional Dependencies_ project option.
|
||||||
|
|
||||||
|
If you compiled a GLFW static library yourself then there will only be one,
|
||||||
|
named `glfw3.lib`, and you have to make sure the run-time library variant
|
||||||
|
matches.
|
||||||
|
|
||||||
|
The DLL version of the GLFW library is named `glfw3.dll`, but you will be
|
||||||
|
linking against the `glfw3dll.lib` link library. To use the DLL you will need
|
||||||
|
to add `path/to/glfw3dll.lib` to the _Additional Dependencies_ project option.
|
||||||
|
All of its dependencies are already listed there by default, but when building
|
||||||
|
with the DLL version of GLFW, you also need to define the @ref GLFW_DLL. This
|
||||||
|
can be done either in the _Preprocessor Definitions_ project option or by
|
||||||
|
defining it in your source code before including the GLFW header.
|
||||||
|
|
||||||
|
@code
|
||||||
|
#define GLFW_DLL
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
All link-time dependencies for GLFW are already listed in the _Additional
|
||||||
|
Dependencies_ option by default.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection build_link_mingw With MinGW-w64 and GLFW binaries
|
||||||
|
|
||||||
|
This is intended for building a program from the command-line or by writing
|
||||||
|
a makefile, on Windows with [MinGW-w64](https://www.mingw-w64.org/) and GLFW
|
||||||
|
binaries. These can be from a downloaded and extracted
|
||||||
|
[binary archive](https://www.glfw.org/download.html) or by compiling GLFW
|
||||||
|
yourself. The paths below assume a binary archive is used.
|
||||||
|
|
||||||
|
If you are using a downloaded binary archive, first make sure you have the
|
||||||
|
archive matching the architecture you are building for (32-bit or 64-bit) or you
|
||||||
|
will get link errors.
|
||||||
|
|
||||||
|
Note that the order of source files and libraries matter for GCC. Dependencies
|
||||||
|
must be listed after the files that depend on them. Any source files that
|
||||||
|
depend on GLFW must be listed before the GLFW library. GLFW in turn depends on
|
||||||
|
`gdi32` and must be listed before it.
|
||||||
|
|
||||||
|
If you are using the static version of the GLFW library, which is named
|
||||||
|
`libglfw3.a`, do:
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
gcc -o myprog myprog.c -I path/to/glfw/include path/to/glfw/lib-mingw-w64/libglfw3.a -lgdi32
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you are using the DLL version of the GLFW library, which is named
|
||||||
|
`glfw3.dll`, you will need to use the `libglfw3dll.a` link library.
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
gcc -o myprog myprog.c -I path/to/glfw/include path/to/glfw/lib-mingw-w64/libglfw3dll.a -lgdi32
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The resulting executable will need to find `glfw3.dll` to run, typically by
|
||||||
|
keeping both files in the same directory.
|
||||||
|
|
||||||
|
When you are building with the DLL version of GLFW, you will also need to define
|
||||||
|
the @ref GLFW_DLL macro. This can be done in your source files, as long as it
|
||||||
|
done before including the GLFW header:
|
||||||
|
|
||||||
|
@code
|
||||||
|
#define GLFW_DLL
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
It can also be done on the command-line:
|
||||||
|
|
||||||
|
@code{.sh}
|
||||||
|
gcc -o myprog myprog.c -D GLFW_DLL -I path/to/glfw/include path/to/glfw/lib-mingw-w64/libglfw3dll.a -lgdi32
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_cmake_source With CMake and GLFW source
|
@subsection build_link_cmake_source With CMake and GLFW source
|
||||||
@ -271,7 +345,10 @@ target_link_libraries(myapp OpenGL::GL)
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_pkgconfig With makefiles and pkg-config on Unix
|
@subsection build_link_pkgconfig With pkg-config and GLFW binaries on Unix
|
||||||
|
|
||||||
|
This is intended for building a program from the command-line or by writing
|
||||||
|
a makefile, on macOS or any Unix-like system like Linux, FreeBSD and Cygwin.
|
||||||
|
|
||||||
GLFW supports [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/),
|
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 the `glfw3.pc` pkg-config file is generated when the GLFW library is built
|
||||||
@ -322,13 +399,13 @@ OpenGL and IOKit frameworks to the project as dependencies. They can all be
|
|||||||
found in `/System/Library/Frameworks`.
|
found in `/System/Library/Frameworks`.
|
||||||
|
|
||||||
|
|
||||||
@subsection build_link_osx With command-line on macOS
|
@subsection build_link_osx With command-line or makefile on macOS
|
||||||
|
|
||||||
It is recommended that you use [pkg-config](@ref build_link_pkgconfig) when
|
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
|
using installed GLFW binaries from the command line on macOS. That way you will
|
||||||
dependencies added automatically. If you still wish to build manually, you need
|
get any new dependencies added automatically. If you still wish to build
|
||||||
to add the required frameworks and libraries to your command-line yourself using
|
manually, you need to add the required frameworks and libraries to your
|
||||||
the `-l` and `-framework` switches.
|
command-line yourself using the `-l` and `-framework` switches.
|
||||||
|
|
||||||
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
||||||
|
|
||||||
|
@ -97,11 +97,11 @@ On Fedora and derivatives like Red Hat you will need the `wayland-devel`,
|
|||||||
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules
|
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
On FreeBSD you will need the `wayland`, `libxkbcommon`, `wayland-protocols` and
|
On FreeBSD you will need the `wayland`, `libxkbcommon`, `wayland-protocols`,
|
||||||
`kf5-extra-cmake-modules` packages.
|
`evdev-proto` and `kf5-extra-cmake-modules` packages.
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
pkg install wayland libxkbcommon wayland-protocols kf5-extra-cmake-modules
|
pkg install wayland libxkbcommon wayland-protocols evdev-proto kf5-extra-cmake-modules
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Once you have the required depdendencies, move on to @ref compile_generate.
|
Once you have the required depdendencies, move on to @ref compile_generate.
|
||||||
|
@ -322,7 +322,7 @@ Starting with GLFW 3.3.7, events posted with @ref glfwPostEmptyEvent now use a s
|
|||||||
unnamed pipe instead of sending an X11 client event to the helper window.
|
unnamed pipe instead of sending an X11 client event to the helper window.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection wayland_alpha_34 Frambuffer may lack alpha channel on older Wayland systems
|
@subsubsection wayland_alpha_33 Framebuffer may lack alpha channel on older Wayland systems
|
||||||
|
|
||||||
On Wayland, when creating an EGL context on a machine lacking the new
|
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
|
`EGL_EXT_present_opaque` extension, the @ref GLFW_ALPHA_BITS window hint will be
|
||||||
|
@ -298,7 +298,7 @@ extern "C" {
|
|||||||
* release is made that does not contain any API changes.
|
* release is made that does not contain any API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 9
|
#define GLFW_VERSION_REVISION 10
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@ -2688,8 +2688,8 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
|||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
|
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
|
||||||
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
|
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @win32 Window creation will fail if the Microsoft GDI software
|
* @remark @win32 Window creation will fail if the Microsoft GDI software
|
||||||
* OpenGL implementation is the only one available.
|
* OpenGL implementation is the only one available.
|
||||||
@ -3638,11 +3638,15 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
|
|||||||
* @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
|
* @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark Calling @ref glfwGetWindowAttrib will always return the latest
|
* @remark Calling @ref glfwGetWindowAttrib will always return the latest
|
||||||
* value, even if that value is ignored by the current mode of the window.
|
* value, even if that value is ignored by the current mode of the window.
|
||||||
*
|
*
|
||||||
|
* @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window
|
||||||
|
* attribute is not supported. Setting this will emit @ref
|
||||||
|
* GLFW_PLATFORM_ERROR.
|
||||||
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_attribs
|
* @sa @ref window_attribs
|
||||||
|
@ -1635,14 +1635,15 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
if (scancode < 0 || scancode > 0xff ||
|
if (scancode < 0 || scancode > 0xff)
|
||||||
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int key = _glfw.ns.keycodes[scancode];
|
const int key = _glfw.ns.keycodes[scancode];
|
||||||
|
if (key == GLFW_KEY_UNKNOWN)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
UInt32 deadKeyState = 0;
|
UInt32 deadKeyState = 0;
|
||||||
UniChar characters[4];
|
UniChar characters[4];
|
||||||
|
@ -637,7 +637,7 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
GLFWAPI int glfwGetKeyScancode(int key)
|
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)
|
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
|
||||||
{
|
{
|
||||||
|
@ -334,8 +334,6 @@ void _glfwTerminateJoysticksLinux(void)
|
|||||||
closeJoystick(js);
|
closeJoystick(js);
|
||||||
}
|
}
|
||||||
|
|
||||||
regfree(&_glfw.linjs.regex);
|
|
||||||
|
|
||||||
if (_glfw.linjs.inotify > 0)
|
if (_glfw.linjs.inotify > 0)
|
||||||
{
|
{
|
||||||
if (_glfw.linjs.watch > 0)
|
if (_glfw.linjs.watch > 0)
|
||||||
|
@ -161,7 +161,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||||||
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"NSGL: OpenGL ES is not available on macOS");
|
"NSGL: OpenGL ES is not available via NSGL");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,13 +27,12 @@
|
|||||||
// Please use C89 style variable declarations in this file because VS 2010
|
// Please use C89 style variable declarations in this file because VS 2010
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
static void makeContextCurrentOSMesa(_GLFWwindow* window)
|
static void makeContextCurrentOSMesa(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window)
|
if (window)
|
||||||
|
@ -80,6 +80,23 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (_glfw.wgl.ARB_pixel_format)
|
if (_glfw.wgl.ARB_pixel_format)
|
||||||
{
|
{
|
||||||
|
// 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);
|
||||||
|
|
||||||
addAttrib(WGL_SUPPORT_OPENGL_ARB);
|
addAttrib(WGL_SUPPORT_OPENGL_ARB);
|
||||||
addAttrib(WGL_DRAW_TO_WINDOW_ARB);
|
addAttrib(WGL_DRAW_TO_WINDOW_ARB);
|
||||||
addAttrib(WGL_PIXEL_TYPE_ARB);
|
addAttrib(WGL_PIXEL_TYPE_ARB);
|
||||||
|
@ -2191,14 +2191,19 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetScancodeName(int scancode)
|
const char* _glfwPlatformGetScancodeName(int scancode)
|
||||||
{
|
{
|
||||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
int key;
|
||||||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
|
||||||
|
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]];
|
key = _glfw.win32.keycodes[scancode];
|
||||||
|
if (key == GLFW_KEY_UNKNOWN)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return _glfw.win32.keynames[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
|
@ -694,7 +694,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
|
|||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(1.f);
|
_GLFW_REQUIRE_INIT_OR_RETURN(0.f);
|
||||||
return _glfwPlatformGetWindowOpacity(window);
|
return _glfwPlatformGetWindowOpacity(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,10 +637,15 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfwTerminateEGL();
|
_glfwTerminateEGL();
|
||||||
_glfwTerminateOSMesa();
|
_glfwTerminateOSMesa();
|
||||||
|
|
||||||
if (_glfw.wl.libdecor.callback)
|
|
||||||
wl_callback_destroy(_glfw.wl.libdecor.callback);
|
|
||||||
if (_glfw.wl.libdecor.context)
|
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)
|
||||||
|
_glfwPlatformWaitEvents();
|
||||||
|
|
||||||
libdecor_unref(_glfw.wl.libdecor.context);
|
libdecor_unref(_glfw.wl.libdecor.context);
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.wl.libdecor.handle)
|
if (_glfw.wl.libdecor.handle)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
|
||||||
#define GLFW_BORDER_SIZE 4
|
#define GLFW_BORDER_SIZE 4
|
||||||
#define GLFW_CAPTION_HEIGHT 24
|
#define GLFW_CAPTION_HEIGHT 24
|
||||||
@ -1537,24 +1538,14 @@ static void pointerHandleAxis(void* userData,
|
|||||||
wl_fixed_t value)
|
wl_fixed_t value)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||||
double x = 0.0, y = 0.0;
|
|
||||||
// Wayland scroll events are in pointer motion coordinate space (think two
|
|
||||||
// finger scroll). The factor 10 is commonly used to convert to "scroll
|
|
||||||
// step means 1.0.
|
|
||||||
const double scrollFactor = 1.0 / 10.0;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
|
// NOTE: 10 units of motion per mouse wheel step seems to be a common ratio
|
||||||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
|
|
||||||
|
|
||||||
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
|
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
|
||||||
x = -wl_fixed_to_double(value) * scrollFactor;
|
_glfwInputScroll(window, -wl_fixed_to_double(value) / 10.0, 0.0);
|
||||||
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
||||||
y = -wl_fixed_to_double(value) * scrollFactor;
|
_glfwInputScroll(window, 0.0, -wl_fixed_to_double(value) / 10.0);
|
||||||
|
|
||||||
_glfwInputScroll(window, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_pointer_listener pointerListener =
|
static const struct wl_pointer_listener pointerListener =
|
||||||
@ -2563,8 +2554,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetScancodeName(int scancode)
|
const char* _glfwPlatformGetScancodeName(int scancode)
|
||||||
{
|
{
|
||||||
if (scancode < 0 || scancode > 255 ||
|
if (scancode < 0 || scancode > 255)
|
||||||
_glfw.wl.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Wayland: Invalid scancode %i",
|
"Wayland: Invalid scancode %i",
|
||||||
@ -2573,6 +2563,9 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int key = _glfw.wl.keycodes[scancode];
|
const int key = _glfw.wl.keycodes[scancode];
|
||||||
|
if (key == GLFW_KEY_UNKNOWN)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
const xkb_keycode_t keycode = scancode + 8;
|
const xkb_keycode_t keycode = scancode + 8;
|
||||||
const xkb_layout_index_t layout =
|
const xkb_layout_index_t layout =
|
||||||
xkb_state_key_get_layout(_glfw.wl.xkb.state, keycode);
|
xkb_state_key_get_layout(_glfw.wl.xkb.state, keycode);
|
||||||
|
@ -2930,14 +2930,16 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (!_glfw.x11.xkb.available)
|
if (!_glfw.x11.xkb.available)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (scancode < 0 || scancode > 0xff ||
|
if (scancode < 0 || scancode > 0xff)
|
||||||
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int key = _glfw.x11.keycodes[scancode];
|
const int key = _glfw.x11.keycodes[scancode];
|
||||||
|
if (key == GLFW_KEY_UNKNOWN)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
||||||
scancode, _glfw.x11.xkb.group, 0);
|
scancode, _glfw.x11.xkb.group, 0);
|
||||||
if (keysym == NoSymbol)
|
if (keysym == NoSymbol)
|
||||||
|
@ -393,24 +393,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)
|
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
Slot* slot = glfwGetWindowUserPointer(window);
|
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",
|
printf("%08x to %i at %0.3f: Key (%s) Scancode 0x%04x (with%s) was %s\n",
|
||||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
counter++, slot->number, glfwGetTime(),
|
||||||
get_key_name(key),
|
get_key_name(key), scancode,
|
||||||
name,
|
get_mods_name(mods),
|
||||||
get_mods_name(mods),
|
get_action_name(action));
|
||||||
get_action_name(action));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n",
|
const char* name = glfwGetKeyName(key, scancode);
|
||||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
if (name)
|
||||||
get_key_name(key),
|
{
|
||||||
get_mods_name(mods),
|
printf("%08x to %i at %0.3f: Key 0x%04x (%s) Scancode 0x%04x Name %s (with%s) was %s\n",
|
||||||
get_action_name(action));
|
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)
|
if (action != GLFW_PRESS)
|
||||||
|
Loading…
Reference in New Issue
Block a user