mirror of
https://github.com/glfw/glfw.git
synced 2026-09-20 08:23:13 +00:00
Compare commits
115 Commits
3.3.8
...
3.3-stable
| Author | SHA1 | Date | |
|---|---|---|---|
| dc46d3f812 | |||
| 07efe9068e | |||
| 3af1a1f514 | |||
| a7c3e95980 | |||
| 0cac1ad41f | |||
| 2d51e650be | |||
| bc788a9333 | |||
| ae44e10b33 | |||
| 438cd224d7 | |||
| 8d95aeac69 | |||
| a1090c867d | |||
| 15b771759d | |||
| d172fec64b | |||
| bfa24c9f2d | |||
| 20bd0329a5 | |||
| fafcba3824 | |||
| 7554375d6d | |||
| dbe2d7cb4a | |||
| 76227fa519 | |||
| 0161cde6f3 | |||
| c710d2c05d | |||
| a943d9ac17 | |||
| 7998629ad2 | |||
| 9ba47ca13a | |||
| e2c9264546 | |||
| 7b60753aeb | |||
| 628385e99e | |||
| 217c269d66 | |||
| 6ea5bf9032 | |||
| 1fab407e44 | |||
| 7cdd41170b | |||
| e0de6ea513 | |||
| 79d957ca18 | |||
| 63bba49e31 | |||
| 80d45cdfd7 | |||
| 683b7524d2 | |||
| 356f56a166 | |||
| 5f936a6276 | |||
| 1c989eace3 | |||
| c98860db9e | |||
| cb0dafa7c0 | |||
| 11f517e557 | |||
| 2a4e26870b | |||
| 31f08cc7fc | |||
| 9809035ed2 | |||
| 7cc8879ab9 | |||
| 89b149a56f | |||
| b52b074be5 | |||
| b211975131 | |||
| 2c09407bff | |||
| 7c7cc59889 | |||
| 6f9686f1f4 | |||
| 89bea58b18 | |||
| ff156743ab | |||
| 489339b837 | |||
| af93f06259 | |||
| 8ef347157a | |||
| c754de5deb | |||
| bf429fb628 | |||
| 8da6223c90 | |||
| c3f15da23a | |||
| 1d766c8b39 | |||
| 67d722788d | |||
| 06a2ed38ea | |||
| 0c2db4a23e | |||
| 1ad5df8032 | |||
| 95b35c43c2 | |||
| e5d19c9fac | |||
| 5ac970120a | |||
| 677fbb0f82 | |||
| a29b5f38c6 | |||
| 1de73c0dc5 | |||
| a6e3efbafc | |||
| ba99e20f6a | |||
| 8522447792 | |||
| ba80e23dab | |||
| 2178c3e536 | |||
| 1b4e126dc0 | |||
| 71dfc3f65c | |||
| 4a33051456 | |||
| b06a91e92b | |||
| c7a5333873 | |||
| 05e28537a3 | |||
| af3e14fbc2 | |||
| d36d062d72 | |||
| 493df4a0b5 | |||
| 31b038663a | |||
| 6fb86c089e | |||
| bc36010350 | |||
| bd13f55ca8 | |||
| 8b4f1ebbea | |||
| 1f675ab62f | |||
| ed55529ce8 | |||
| 426c6ed6b1 | |||
| 1fe29e2c19 | |||
| 34bfb52641 | |||
| 3670cd0561 | |||
| 0ee9b7281b | |||
| 5f3e5542cf | |||
| 632d35e0d4 | |||
| 5189d52ae3 | |||
| 78edf2516e | |||
| 74090d30cd | |||
| ad206bdaee | |||
| b08271d315 | |||
| 2ca3bda1cc | |||
| 388d0cf7c2 | |||
| 4affd2207c | |||
| dea9914692 | |||
| 1acd67eeb6 | |||
| a8d543f1f8 | |||
| ca5ccd819d | |||
| 41bb7b8617 | |||
| ccbbada181 | |||
| fe2ac5027b |
@@ -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
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches: [ ci, master, latest, 3.3-stable ]
|
branches: [ ci, master, latest, 3.3-stable ]
|
||||||
|
workflow_dispatch:
|
||||||
permissions:
|
permissions:
|
||||||
statuses: write
|
statuses: write
|
||||||
contents: read
|
contents: read
|
||||||
@@ -11,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@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -34,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@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -57,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@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -80,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@v2
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure static library
|
- name: Configure static library
|
||||||
run: cmake -S . -B build-static
|
run: cmake -S . -B build-static
|
||||||
@@ -99,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@v2
|
- 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,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*
|
||||||
|
|||||||
+6
-3
@@ -1,8 +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.8 LANGUAGES C)
|
project(GLFW VERSION 3.3.10 LANGUAGES C)
|
||||||
|
|
||||||
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
|
||||||
|
|
||||||
if (POLICY CMP0054)
|
if (POLICY CMP0054)
|
||||||
cmake_policy(SET CMP0054 NEW)
|
cmake_policy(SET CMP0054 NEW)
|
||||||
@@ -47,6 +45,7 @@ if (BUILD_SHARED_LIBS AND UNIX)
|
|||||||
else()
|
else()
|
||||||
set(GLFW_LIB_NAME glfw3)
|
set(GLFW_LIB_NAME glfw3)
|
||||||
endif()
|
endif()
|
||||||
|
set(GLFW_LIB_NAME_SUFFIX "")
|
||||||
|
|
||||||
if (GLFW_VULKAN_STATIC)
|
if (GLFW_VULKAN_STATIC)
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
@@ -198,6 +197,10 @@ if (_GLFW_WIN32)
|
|||||||
if (GLFW_USE_HYBRID_HPG)
|
if (GLFW_USE_HYBRID_HPG)
|
||||||
set(_GLFW_USE_HYBRID_HPG 1)
|
set(_GLFW_USE_HYBRID_HPG 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set (GLFW_LIB_NAME_SUFFIX "dll")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ video tutorials.
|
|||||||
- Bobyshev Alexander
|
- Bobyshev Alexander
|
||||||
- Laurent Aphecetche
|
- Laurent Aphecetche
|
||||||
- Matt Arsenault
|
- Matt Arsenault
|
||||||
|
- Takuro Ashie
|
||||||
- ashishgamedev
|
- ashishgamedev
|
||||||
- David Avedissian
|
- David Avedissian
|
||||||
- Keith Bauer
|
- Keith Bauer
|
||||||
@@ -44,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
|
||||||
@@ -63,11 +65,13 @@ video tutorials.
|
|||||||
- Nikita Fediuchin
|
- Nikita Fediuchin
|
||||||
- Felipe Ferreira
|
- Felipe Ferreira
|
||||||
- Michael Fogleman
|
- Michael Fogleman
|
||||||
|
- forworldm
|
||||||
- Jason Francis
|
- Jason Francis
|
||||||
- Gerald Franz
|
- Gerald Franz
|
||||||
- Mário Freitas
|
- Mário Freitas
|
||||||
- GeO4d
|
- GeO4d
|
||||||
- Marcus Geelnard
|
- Marcus Geelnard
|
||||||
|
- Gegy
|
||||||
- ghuser404
|
- ghuser404
|
||||||
- Charles Giessen
|
- Charles Giessen
|
||||||
- Ryan C. Gordon
|
- Ryan C. Gordon
|
||||||
@@ -75,12 +79,16 @@ video tutorials.
|
|||||||
- Kovid Goyal
|
- Kovid Goyal
|
||||||
- Kevin Grandemange
|
- Kevin Grandemange
|
||||||
- Eloi Marín Gratacós
|
- Eloi Marín Gratacós
|
||||||
|
- Grzesiek11
|
||||||
- Stefan Gustavson
|
- Stefan Gustavson
|
||||||
- Andrew Gutekanst
|
- Andrew Gutekanst
|
||||||
- Stephen Gutekanst
|
- Stephen Gutekanst
|
||||||
- Jonathan Hale
|
- Jonathan Hale
|
||||||
|
- Daniel Hauser
|
||||||
- hdf89shfdfs
|
- hdf89shfdfs
|
||||||
|
- Moritz Heinemann
|
||||||
- Sylvain Hellegouarch
|
- Sylvain Hellegouarch
|
||||||
|
- Björn Hempel
|
||||||
- Matthew Henry
|
- Matthew Henry
|
||||||
- heromyth
|
- heromyth
|
||||||
- Lucas Hinderberger
|
- Lucas Hinderberger
|
||||||
@@ -96,6 +104,7 @@ video tutorials.
|
|||||||
- JannikGM
|
- JannikGM
|
||||||
- Erik S. V. Jansson
|
- Erik S. V. Jansson
|
||||||
- jjYBdx4IL
|
- jjYBdx4IL
|
||||||
|
- Peter Johnson
|
||||||
- Toni Jovanoski
|
- Toni Jovanoski
|
||||||
- Arseny Kapoulkine
|
- Arseny Kapoulkine
|
||||||
- Cem Karan
|
- Cem Karan
|
||||||
@@ -118,12 +127,16 @@ video tutorials.
|
|||||||
- Anders Lindqvist
|
- Anders Lindqvist
|
||||||
- Leon Linhart
|
- Leon Linhart
|
||||||
- Marco Lizza
|
- Marco Lizza
|
||||||
|
- lo-v-ol
|
||||||
- Eyal Lotem
|
- Eyal Lotem
|
||||||
- Aaron Loucks
|
- Aaron Loucks
|
||||||
|
- Ned Loynd
|
||||||
- Luflosi
|
- Luflosi
|
||||||
- lukect
|
- lukect
|
||||||
- Tristam MacDonald
|
- Tristam MacDonald
|
||||||
|
- Jean-Luc Mackail
|
||||||
- Hans Mackowiak
|
- Hans Mackowiak
|
||||||
|
- Ramiro Magno
|
||||||
- Дмитри Малышев
|
- Дмитри Малышев
|
||||||
- Zbigniew Mandziejewicz
|
- Zbigniew Mandziejewicz
|
||||||
- Adam Marcus
|
- Adam Marcus
|
||||||
@@ -136,6 +149,7 @@ video tutorials.
|
|||||||
- Marcel Metz
|
- Marcel Metz
|
||||||
- Liam Middlebrook
|
- Liam Middlebrook
|
||||||
- Ave Milia
|
- Ave Milia
|
||||||
|
- Icyllis Milica
|
||||||
- Jonathan Miller
|
- Jonathan Miller
|
||||||
- Kenneth Miller
|
- Kenneth Miller
|
||||||
- Bruce Mitchener
|
- Bruce Mitchener
|
||||||
@@ -149,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
|
||||||
@@ -179,26 +194,31 @@ video tutorials.
|
|||||||
- pthom
|
- pthom
|
||||||
- Martin Pulec
|
- Martin Pulec
|
||||||
- Guillaume Racicot
|
- Guillaume Racicot
|
||||||
|
- Christian Rauch
|
||||||
- Philip Rideout
|
- Philip Rideout
|
||||||
- Eddie Ringle
|
- Eddie Ringle
|
||||||
- Max Risuhin
|
- Max Risuhin
|
||||||
|
- Joe Roback
|
||||||
- Jorge Rodriguez
|
- Jorge Rodriguez
|
||||||
- Luca Rood
|
- Luca Rood
|
||||||
- Ed Ropple
|
- Ed Ropple
|
||||||
- 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
|
||||||
- Matt Sealey
|
- Matt Sealey
|
||||||
- Steve Sexton
|
- Steve Sexton
|
||||||
- Arkady Shapkin
|
- Arkady Shapkin
|
||||||
|
- Mingjie Shen
|
||||||
- Ali Sherief
|
- Ali Sherief
|
||||||
- Yoshiki Shibukawa
|
- Yoshiki Shibukawa
|
||||||
- Dmitri Shuralyov
|
- Dmitri Shuralyov
|
||||||
- Joao da Silva
|
- Joao da Silva
|
||||||
- Daniel Sieger
|
- Daniel Sieger
|
||||||
|
- Michael Skec
|
||||||
- Daniel Skorupski
|
- Daniel Skorupski
|
||||||
- Slemmie
|
- Slemmie
|
||||||
- Bradley Smith
|
- Bradley Smith
|
||||||
@@ -215,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
|
||||||
@@ -227,14 +248,17 @@ video tutorials.
|
|||||||
- Jari Vetoniemi
|
- Jari Vetoniemi
|
||||||
- Ricardo Vieira
|
- Ricardo Vieira
|
||||||
- Nicholas Vitovitch
|
- Nicholas Vitovitch
|
||||||
|
- Vladimír Vondruš
|
||||||
- Simon Voordouw
|
- Simon Voordouw
|
||||||
- Corentin Wallez
|
- Corentin Wallez
|
||||||
- Torsten Walluhn
|
- Torsten Walluhn
|
||||||
- Patrick Walton
|
- Patrick Walton
|
||||||
|
- Jim Wang
|
||||||
- Xo Wang
|
- Xo Wang
|
||||||
- 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
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
[](https://github.com/glfw/glfw/actions)
|
[](https://github.com/glfw/glfw/actions)
|
||||||
[](https://ci.appveyor.com/project/elmindreda/glfw)
|
[](https://ci.appveyor.com/project/elmindreda/glfw)
|
||||||
[](https://scan.coverity.com/projects/glfw-glfw)
|
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
@@ -123,74 +122,12 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
|
- Bugfix: `glfwGetKeyName` emitted `GLFW_INVALID_VALUE` for scancodes with no
|
||||||
- Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization
|
key token (#1785,#2214)
|
||||||
- Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization
|
- [Wayland] Bugfix: Terminating the library before showing a window could segfault
|
||||||
- Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092)
|
- [Wayland] Bugfix: Compilation failed on FreeBSD (#2445)
|
||||||
- [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different
|
- [Linux] Bugfix: `regfree´ was called on invalid data (#2464)
|
||||||
scancode than `PrtSc` (#1993)
|
- [WGL] Bugfix: Context creation failed in Parallels VM (#2191,#2406,#2467)
|
||||||
- [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not
|
|
||||||
match event scancode (#1993)
|
|
||||||
- [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)
|
|
||||||
- [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false
|
|
||||||
- [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791)
|
|
||||||
- [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination
|
|
||||||
- [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false
|
|
||||||
- [Cocoa] Bugfix: Changing `GLFW_DECORATED` in macOS fullscreen would abort
|
|
||||||
application (#1886)
|
|
||||||
- [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort
|
|
||||||
application (#2110)
|
|
||||||
- [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle
|
|
||||||
subdirectory (#2113,#2120)
|
|
||||||
- [X11] Bugfix: The OSMesa libray was not unloaded on termination
|
|
||||||
- [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 support for file path drop events (#2040)
|
|
||||||
- [Wayland] Added support for more human-readable monitor names where available
|
|
||||||
- [Wayland] Removed support for the deprecated wl\_shell protocol
|
|
||||||
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
|
|
||||||
`glfwGetClipboardString`
|
|
||||||
- [Wayland] Bugfix: Data source creation error would cause double free at termination
|
|
||||||
- [Wayland] Bugfix: Partial writes of clipboard string would cause beginning to repeat
|
|
||||||
- [Wayland] Bugfix: Some errors would cause clipboard string transfer to hang
|
|
||||||
- [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string
|
|
||||||
- [Wayland] Bugfix: MIME type matching was not performed for clipboard string
|
|
||||||
- [Wayland] Bugfix: The OSMesa library was not unloaded on termination
|
|
||||||
- [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_PLATFORM_ERROR`
|
|
||||||
- [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed
|
|
||||||
- [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995)
|
|
||||||
- [Wayland] Bugfix: A window leaving full screen mode ignored its desired size
|
|
||||||
- [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
|
|
||||||
- [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed
|
|
||||||
- [Wayland] Bugfix: A window maximized or restored by the user would enter an
|
|
||||||
inconsistent state
|
|
||||||
- [Wayland] Bugfix: Window maximization events were not emitted
|
|
||||||
- [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode
|
|
||||||
- [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window
|
|
||||||
- [Wayland] Bugfix: A window content scale event would be emitted every time
|
|
||||||
the window resized
|
|
||||||
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
|
|
||||||
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
|
|
||||||
(#1991,#2115,#2127)
|
|
||||||
- [Wayland] Bugfix: Size limits included frame size for fallback decorations
|
|
||||||
- [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side
|
|
||||||
decorations
|
|
||||||
- [Wayland] Bugfix: A monitor would be reported as connected again if its scale
|
|
||||||
changed
|
|
||||||
- [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed
|
|
||||||
scale
|
|
||||||
- [Wayland] Bugfix: Window content scale events were not emitted when monitor
|
|
||||||
scale changed
|
|
||||||
- [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of
|
|
||||||
applying the specified ratio
|
|
||||||
- [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect
|
|
||||||
- [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show
|
|
||||||
- [Wayland] Bugfix: Hiding and then showing a window caused program abort on
|
|
||||||
wlroots compositors (#1268)
|
|
||||||
- [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
|
|
||||||
decorations
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
@@ -199,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
|
||||||
|
|||||||
+1849
-940
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -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
|
||||||
|
|||||||
+95
-18
@@ -26,7 +26,7 @@ GLFW.
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This header defines all the constants and declares all the types and function
|
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
|
prototypes of the GLFW API. By default, it also includes the OpenGL header from
|
||||||
your development environment. See [option macros](@ref build_macros) below for
|
your development environment. See [option macros](@ref build_macros) below for
|
||||||
how to select OpenGL ES headers and more.
|
how to select OpenGL ES headers and more.
|
||||||
|
|
||||||
@@ -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:
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -122,6 +122,14 @@ 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
|
does not support this protocol, the screensaver may start even for full screen
|
||||||
windows.
|
windows.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
GLFW uses the [xdg-decoration
|
GLFW uses the [xdg-decoration
|
||||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
|
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
|
to request decorations to be drawn around its windows. This protocol is part
|
||||||
@@ -146,7 +154,7 @@ formats. If GLX 1.3 is not supported, @ref glfwInit will fail.
|
|||||||
|
|
||||||
GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
|
GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
|
||||||
`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
|
`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
|
||||||
(or _vsync_), in that order of preference. Where none of these extension are
|
(or _vsync_), in that order of preference. When none of these extensions are
|
||||||
available, calling @ref glfwSwapInterval will have no effect.
|
available, calling @ref glfwSwapInterval will have no effect.
|
||||||
|
|
||||||
GLFW uses the `GLX_ARB_multisample` extension to create contexts with
|
GLFW uses the `GLX_ARB_multisample` extension to create contexts with
|
||||||
@@ -215,8 +223,8 @@ extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
|
|||||||
effect and the context will always be flushed when released.
|
effect and the context will always be flushed when released.
|
||||||
|
|
||||||
GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB`
|
GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB`
|
||||||
extensions to provide support for sRGB framebuffers. Where both of these
|
extensions to provide support for sRGB framebuffers. When both of these
|
||||||
extension are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
|
extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
|
||||||
|
|
||||||
|
|
||||||
@section compat_osx OpenGL on macOS
|
@section compat_osx OpenGL on macOS
|
||||||
|
|||||||
+9
-8
@@ -45,7 +45,7 @@ Linux and FreeBSD you will need a few extra packages.
|
|||||||
To compile GLFW for X11, you need to have the X11 development packages
|
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.
|
installed. They are not needed to build or run programs that use GLFW.
|
||||||
|
|
||||||
On Debian and derivates like Ubuntu and Linux Mint the `xorg-dev` meta-package
|
On Debian and derivatives like Ubuntu and Linux Mint the `xorg-dev` meta-package
|
||||||
pulls in the development packages for all of X11.
|
pulls in the development packages for all of X11.
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
@@ -82,8 +82,9 @@ To compile GLFW for Wayland, you need to have the Wayland and xkbcommon
|
|||||||
development packages installed. They are not needed to build or run programs
|
development packages installed. They are not needed to build or run programs
|
||||||
that use GLFW.
|
that use GLFW.
|
||||||
|
|
||||||
On Debian and derivates like Ubuntu and Linux Mint you will need the `libwayland-dev`,
|
On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`,
|
||||||
`libxkbcommon-dev`, `wayland-protocols` and `extra-cmake-modules` packages.
|
`libxkbcommon-dev`, `wayland-protocols` and `extra-cmake-modules` packages.
|
||||||
|
These will pull in all other dependencies.
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
|
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
|
||||||
@@ -96,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.
|
||||||
@@ -137,7 +138,7 @@ 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
|
_Generate_ to have the new values take effect. The variable list will be
|
||||||
populated after the first configure step.
|
populated after the first configure step.
|
||||||
|
|
||||||
By default GLFW will use X11 on Linux and other Unix-like systems other
|
By default, GLFW will use X11 on Linux and other Unix-like systems other
|
||||||
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` option in the
|
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` option in the
|
||||||
GLFW section of the variable list, then apply the new value as described above.
|
GLFW section of the variable list, then apply the new value as described above.
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ flag.
|
|||||||
cmake -S path/to/glfw -B path/to/build -G Xcode
|
cmake -S path/to/glfw -B path/to/build -G Xcode
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
By default GLFW will use X11 on Linux and other Unix-like systems other
|
By default, GLFW will use X11 on Linux and other Unix-like systems other
|
||||||
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` CMake option.
|
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` CMake option.
|
||||||
|
|
||||||
@code{.sh}
|
@code{.sh}
|
||||||
@@ -327,7 +328,7 @@ For more details see the
|
|||||||
@section compile_manual Compiling GLFW manually
|
@section compile_manual Compiling GLFW manually
|
||||||
|
|
||||||
If you wish to compile GLFW without its CMake build environment then you will
|
If you wish to compile GLFW without its CMake build environment then you will
|
||||||
have to do at least some of the platform detection yourself. GLFW needs
|
have to do at least some of the platform-detection yourself. GLFW needs
|
||||||
a configuration macro to be defined in order to know what window system it is
|
a configuration macro to be defined in order to know what window system it is
|
||||||
being compiled for and also has optional, platform-specific ones for various
|
being compiled for and also has optional, platform-specific ones for various
|
||||||
features.
|
features.
|
||||||
|
|||||||
+7
-6
@@ -61,7 +61,7 @@ information. The name and number of this chapter unfortunately varies between
|
|||||||
versions and APIs, but has at times been named _Shared Objects and Multiple
|
versions and APIs, but has at times been named _Shared Objects and Multiple
|
||||||
Contexts_.
|
Contexts_.
|
||||||
|
|
||||||
GLFW comes with a barebones object sharing example program called `sharing`.
|
GLFW comes with a bare-bones object sharing example program called `sharing`.
|
||||||
|
|
||||||
|
|
||||||
@subsection context_offscreen Offscreen contexts
|
@subsection context_offscreen Offscreen contexts
|
||||||
@@ -92,9 +92,10 @@ creation can be disabled with the @ref GLFW_COCOA_MENUBAR init hint.
|
|||||||
@subsection context_less Windows without contexts
|
@subsection context_less Windows without contexts
|
||||||
|
|
||||||
You can disable context creation by setting the
|
You can disable context creation by setting the
|
||||||
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. Windows
|
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
|
||||||
without contexts must not be passed to @ref glfwMakeContextCurrent or @ref
|
|
||||||
glfwSwapBuffers.
|
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
|
@section context_current Current context
|
||||||
@@ -193,7 +194,7 @@ it suppresses the development environment's OpenGL or OpenGL ES header.
|
|||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Finally you need to initialize glad once you have a suitable current context.
|
Finally, you need to initialize glad once you have a suitable current context.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
window = glfwCreateWindow(640, 480, "My Window", NULL, NULL);
|
window = glfwCreateWindow(640, 480, "My Window", NULL, NULL);
|
||||||
@@ -209,7 +210,7 @@ gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
|||||||
|
|
||||||
Once glad has been loaded, you have access to all OpenGL core and extension
|
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
|
functions supported by both the context you created and the glad loader you
|
||||||
generated and you are ready to start rendering.
|
generated. After that, you are ready to start rendering.
|
||||||
|
|
||||||
You can specify a minimum required OpenGL or OpenGL ES version with
|
You can specify a minimum required OpenGL or OpenGL ES version with
|
||||||
[context hints](@ref window_hints_ctx). If your needs are more complex, you can
|
[context hints](@ref window_hints_ctx). If your needs are more complex, you can
|
||||||
|
|||||||
+20
-14
@@ -24,7 +24,7 @@ All input callbacks receive a window handle. By using the
|
|||||||
or objects from your callbacks.
|
or objects from your callbacks.
|
||||||
|
|
||||||
To get a better feel for how the various events callbacks behave, run the
|
To get a better feel for how the various events callbacks behave, run the
|
||||||
`events` test program. It register every callback supported by GLFW and prints
|
`events` test program. It registers every callback supported by GLFW and prints
|
||||||
out all arguments provided for every event, along with time and sequence
|
out all arguments provided for every event, along with time and sequence
|
||||||
information.
|
information.
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ new size before everything returns back out of the @ref glfwSetWindowSize call.
|
|||||||
|
|
||||||
GLFW divides keyboard input into two categories; key events and character
|
GLFW divides keyboard input into two categories; key events and character
|
||||||
events. Key events relate to actual physical keyboard keys, whereas 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
|
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
|
characters, and a single character may require several keys to produce. This
|
||||||
@@ -127,6 +127,10 @@ 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
|
`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.
|
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
|
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
|
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
|
repeated even if several keys are held down. `GLFW_REPEAT` actions should not
|
||||||
@@ -142,16 +146,16 @@ keys.
|
|||||||
The scancode is unique for every key, regardless of whether it has a key token.
|
The scancode is unique for every key, regardless of whether it has a key token.
|
||||||
Scancodes are platform-specific but consistent over time, so keys will have
|
Scancodes are platform-specific but consistent over time, so keys will have
|
||||||
different scancodes depending on the platform but they are safe to save to disk.
|
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
|
You can query the scancode for any [key token](@ref keys) supported on the
|
||||||
platform with @ref glfwGetKeyScancode.
|
current platform with @ref glfwGetKeyScancode.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
const int scancode = glfwGetKeyScancode(GLFW_KEY_X);
|
const int scancode = glfwGetKeyScancode(GLFW_KEY_X);
|
||||||
set_key_mapping(scancode, swap_weapons);
|
set_key_mapping(scancode, swap_weapons);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The last reported state for every [named key](@ref keys) is also saved in
|
The last reported state for every physical key with a [key token](@ref keys) is
|
||||||
per-window state arrays that can be polled with @ref glfwGetKey.
|
also saved in per-window state arrays that can be polled with @ref glfwGetKey.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int state = glfwGetKey(window, GLFW_KEY_E);
|
int state = glfwGetKey(window, GLFW_KEY_E);
|
||||||
@@ -164,7 +168,8 @@ if (state == GLFW_PRESS)
|
|||||||
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
This function only returns cached key event state. It does not poll the
|
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
|
@anchor GLFW_STICKY_KEYS
|
||||||
Whenever you poll state, you risk missing the state change you are looking for.
|
Whenever you poll state, you risk missing the state change you are looking for.
|
||||||
@@ -195,15 +200,15 @@ Lock was on when the event occurred and the @ref GLFW_MOD_NUM_LOCK bit set if
|
|||||||
Num Lock was on.
|
Num Lock was on.
|
||||||
|
|
||||||
The `GLFW_KEY_LAST` constant holds the highest value of any
|
The `GLFW_KEY_LAST` constant holds the highest value of any
|
||||||
[named key](@ref keys).
|
[key token](@ref keys).
|
||||||
|
|
||||||
|
|
||||||
@subsection input_char Text input
|
@subsection input_char Text input
|
||||||
|
|
||||||
GLFW supports text input in the form of a stream of
|
GLFW supports text input in the form of a stream of
|
||||||
[Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the
|
[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
|
operating system text input system. Unlike key input, text input is affected by
|
||||||
layouts and modifier keys and supports composing characters using
|
keyboard layouts and modifier keys and supports composing characters using
|
||||||
[dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can
|
[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.
|
encode the code points into UTF-8 or any other encoding you prefer.
|
||||||
|
|
||||||
@@ -382,7 +387,7 @@ sequential rows, starting from the top-left corner.
|
|||||||
@subsubsection cursor_standard Standard cursor creation
|
@subsubsection cursor_standard Standard cursor creation
|
||||||
|
|
||||||
A cursor with a [standard shape](@ref shapes) from the current system cursor
|
A cursor with a [standard shape](@ref shapes) from the current system cursor
|
||||||
theme can be can be created with @ref glfwCreateStandardCursor.
|
theme can be created with @ref glfwCreateStandardCursor.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
||||||
@@ -487,8 +492,9 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|||||||
|
|
||||||
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
Mouse button states for [named buttons](@ref buttons) are also saved in
|
The last reported state for every [supported mouse button](@ref buttons) is also
|
||||||
per-window state arrays that can be polled with @ref glfwGetMouseButton.
|
saved in per-window state arrays that can be polled with @ref
|
||||||
|
glfwGetMouseButton.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
|
int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
|
||||||
@@ -521,7 +527,7 @@ had been processed in the meantime, the state will reset to `GLFW_RELEASE`,
|
|||||||
otherwise it will remain `GLFW_PRESS`.
|
otherwise it will remain `GLFW_PRESS`.
|
||||||
|
|
||||||
The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any
|
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
|
@subsection scrolling Scroll input
|
||||||
|
|||||||
+32
-7
@@ -102,6 +102,30 @@ a nib or manually, when the first window is created, which is when AppKit is
|
|||||||
initialized. Set this with @ref glfwInitHint.
|
initialized. Set this with @ref glfwInitHint.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection init_hints_wayland Wayland specific init hints
|
||||||
|
|
||||||
|
@anchor GLFW_WAYLAND_LIBDECOR_hint
|
||||||
|
__GLFW_WAYLAND_LIBDECOR__ specifies whether to use
|
||||||
|
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) for window
|
||||||
|
decorations where available. Possible values are `GLFW_WAYLAND_PREFER_LIBDECOR`
|
||||||
|
and `GLFW_WAYLAND_DISABLE_LIBDECOR`. This is ignored on other platforms.
|
||||||
|
|
||||||
|
@note This init hint was added in 3.3.9 and is not present in earlier patch releases. It
|
||||||
|
is safe to attempt to set this hint on earlier versions of GLFW 3.3 but it will emit
|
||||||
|
a harmless @ref GLFW_INVALID_ENUM error. If you need to avoid causing any errors, you can
|
||||||
|
check the library version first with @ref glfwGetVersion.
|
||||||
|
|
||||||
|
@note To set this hint while also building against earlier versions of GLFW 3.3, you can
|
||||||
|
use the numerical constants directly.
|
||||||
|
|
||||||
|
@note @code
|
||||||
|
int minor, patch;
|
||||||
|
glfwGetVersion(NULL, &minor, &patch);
|
||||||
|
if (minor > 3 || (minor == 3 && patch >= 9))
|
||||||
|
glfwInitHint(0x00053001 /*GLFW_WAYLAND_LIBDECOR*/, 0x00038002 /*GLFW_WAYLAND_DISABLE_LIBDECOR*/);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
@subsubsection init_hints_values Supported and default values
|
@subsubsection init_hints_values Supported and default values
|
||||||
|
|
||||||
Initialization hint | Default value | Supported values
|
Initialization hint | Default value | Supported values
|
||||||
@@ -109,6 +133,7 @@ Initialization hint | Default value | Supported values
|
|||||||
@ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
@ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
|
@ref GLFW_WAYLAND_LIBDECOR | `GLFW_WAYLAND_PREFER_LIBDECOR` | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
|
||||||
|
|
||||||
|
|
||||||
@subsection intro_init_terminate Terminating GLFW
|
@subsection intro_init_terminate Terminating GLFW
|
||||||
@@ -124,9 +149,9 @@ 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
|
modified gamma ramps, re-enable the screensaver if it had been disabled and free
|
||||||
any other resources allocated by GLFW.
|
any other resources allocated by GLFW.
|
||||||
|
|
||||||
Once the library is terminated, it is as if it had never been initialized and
|
Once the library is terminated, it is as if it had never been initialized, therefore
|
||||||
you will need to initialize it again before being able to use GLFW. If the
|
you will need to initialize it again before being able to use GLFW. If the
|
||||||
library was not initialized or had already been terminated, it return
|
library was not initialized or had already been terminated, it returns
|
||||||
immediately.
|
immediately.
|
||||||
|
|
||||||
|
|
||||||
@@ -246,14 +271,14 @@ which monitor the window is currently considered to be on.
|
|||||||
|
|
||||||
This section describes the conditions under which GLFW can be expected to
|
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
|
function, barring bugs in the operating system or drivers. Use of GLFW outside
|
||||||
of these limits may work on some platforms, or on some machines, or some of the
|
these limits may work on some platforms, or on some machines, or some of the
|
||||||
time, or on some versions of GLFW, but it may break at any time and this will
|
time, or on some versions of GLFW, but it may break at any time and this will
|
||||||
not be considered a bug.
|
not be considered a bug.
|
||||||
|
|
||||||
|
|
||||||
@subsection lifetime Pointer lifetimes
|
@subsection lifetime Pointer lifetimes
|
||||||
|
|
||||||
GLFW will never free any pointer you provide to it and you must never free any
|
GLFW will never free any pointer you provide to it, and you must never free any
|
||||||
pointer it provides to you.
|
pointer it provides to you.
|
||||||
|
|
||||||
Many GLFW functions return pointers to dynamically allocated structures, strings
|
Many GLFW functions return pointers to dynamically allocated structures, strings
|
||||||
@@ -444,11 +469,11 @@ The format of the string is as follows:
|
|||||||
- The name of the context creation API
|
- The name of the context creation API
|
||||||
- Any additional options or APIs
|
- Any additional options or APIs
|
||||||
|
|
||||||
For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL
|
For example, when compiling GLFW 3.3.9 with MinGW for Windows, may result in
|
||||||
back ends, the version string may look something like this:
|
a version string like this:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
3.0.0 Win32 WGL MinGW
|
3.3.9 Win32 WGL EGL OSMesa MinGW
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-2
@@ -138,7 +138,7 @@ glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm);
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
While this can be used to calculate the raw DPI of a monitor, this is often not
|
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
|
useful. Instead, use the [monitor content scale](@ref monitor_scale) and
|
||||||
[window content scale](@ref window_scale) to scale your content.
|
[window content scale](@ref window_scale) to scale your content.
|
||||||
|
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ To experiment with gamma correction via the @ref glfwSetGamma function, run the
|
|||||||
`gamma` test program.
|
`gamma` test program.
|
||||||
|
|
||||||
@note The software controlled gamma ramp is applied _in addition_ to the
|
@note The software controlled gamma ramp is applied _in addition_ to the
|
||||||
hardware gamma correction, which today is usually an approximation of sRGB
|
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
|
gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will
|
||||||
produce the default (usually sRGB-like) behavior.
|
produce the default (usually sRGB-like) behavior.
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -243,7 +243,7 @@ while (!glfwWindowShouldClose(window))
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The close callback no longer returns a value. Instead, it is called after the
|
The close callback no longer returns a value. Instead, it is called after the
|
||||||
close flag has been set so it can override its value, if it chooses to, before
|
close flag has been set, so it can optionally override its value, before
|
||||||
event processing completes. You may however not call @ref glfwDestroyWindow
|
event processing completes. You may however not call @ref glfwDestroyWindow
|
||||||
from the close callback (or any other window related callback).
|
from the close callback (or any other window related callback).
|
||||||
|
|
||||||
@@ -350,11 +350,11 @@ from a repeat. Note that @ref glfwGetKey still returns only `GLFW_PRESS` or
|
|||||||
|
|
||||||
GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to
|
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
|
the values generated by the current keyboard layout. The tokens are named
|
||||||
according to the values they would have using the standard US layout, but this
|
according to the values they would have in the standard US layout, but this
|
||||||
is only a convenience, as most programmers are assumed to know that layout.
|
is only a convenience, as most programmers are assumed to know that layout.
|
||||||
This means that (for example) `GLFW_KEY_LEFT_BRACKET` is always a single key and
|
This means that (for example) `GLFW_KEY_LEFT_BRACKET` is always a single key and
|
||||||
is the same key in the same place regardless of what keyboard layouts the users
|
is the same key in the same place regardless of what keyboard layouts the users
|
||||||
of your program has.
|
of your program have.
|
||||||
|
|
||||||
The key input facility was never meant for text input, although using it that
|
The key input facility was never meant for text input, although using it that
|
||||||
way worked slightly better in GLFW 2. If you were using it to input text, you
|
way worked slightly better in GLFW 2. If you were using it to input text, you
|
||||||
|
|||||||
@@ -37,6 +37,16 @@ SDK](https://vulkan.lunarg.com/).
|
|||||||
For more information see @ref vulkan_guide.
|
For more information see @ref vulkan_guide.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection wayland_libdecor_33 Wayland libdecor decorations
|
||||||
|
|
||||||
|
GLFW now supports improved fallback window decorations via
|
||||||
|
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor).
|
||||||
|
|
||||||
|
Support for libdecor can be toggled before GLFW is initialized with the
|
||||||
|
[GLFW_WAYLAND_LIBDECOR](@ref GLFW_WAYLAND_LIBDECOR_hint) init hint. It is
|
||||||
|
enabled by default.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection content_scale_33 Content scale queries for DPI-aware rendering
|
@subsubsection content_scale_33 Content scale queries for DPI-aware rendering
|
||||||
|
|
||||||
GLFW now provides content scales for windows and monitors, i.e. the ratio
|
GLFW now provides content scales for windows and monitors, i.e. the ratio
|
||||||
@@ -312,6 +322,19 @@ 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_33 Framebuffer may lack alpha channel on older Wayland systems
|
||||||
|
|
||||||
|
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
|
||||||
|
ignored and the framebuffer will have no alpha channel. This is because some
|
||||||
|
Wayland compositors treat any buffer with an alpha channel as per-pixel
|
||||||
|
transparent.
|
||||||
|
|
||||||
|
If you want a per-pixel transparent window, see the
|
||||||
|
[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) window
|
||||||
|
hint.
|
||||||
|
|
||||||
|
|
||||||
@subsection deprecations_33 Deprecations in version 3.3
|
@subsection deprecations_33 Deprecations in version 3.3
|
||||||
|
|
||||||
@subsubsection charmods_callback_33 Character with modifiers callback
|
@subsubsection charmods_callback_33 Character with modifiers callback
|
||||||
@@ -430,6 +453,9 @@ Use Wayland or X11 instead.
|
|||||||
- @ref GLFWwindowmaximizefun
|
- @ref GLFWwindowmaximizefun
|
||||||
- @ref GLFWwindowcontentscalefun
|
- @ref GLFWwindowcontentscalefun
|
||||||
- @ref GLFWgamepadstate
|
- @ref GLFWgamepadstate
|
||||||
|
- @ref GLFW_WAYLAND_LIBDECOR
|
||||||
|
- @ref GLFW_WAYLAND_PREFER_LIBDECOR
|
||||||
|
- @ref GLFW_WAYLAND_DISABLE_LIBDECOR
|
||||||
|
|
||||||
|
|
||||||
@subsubsection constants_33 New constants in version 3.3
|
@subsubsection constants_33 New constants in version 3.3
|
||||||
|
|||||||
+1
-5
@@ -144,10 +144,6 @@ if (!window)
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The window handle is passed to all window related functions and is provided to
|
|
||||||
along to all window related callbacks, so they can tell which window received
|
|
||||||
the event.
|
|
||||||
|
|
||||||
When a window and context is no longer needed, destroy it.
|
When a window and context is no longer needed, destroy it.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
@@ -233,7 +229,7 @@ events as described below.
|
|||||||
@subsection quick_render Rendering with OpenGL
|
@subsection quick_render Rendering with OpenGL
|
||||||
|
|
||||||
Once you have a current OpenGL context, you can use OpenGL normally. In this
|
Once you have a current OpenGL context, you can use OpenGL normally. In this
|
||||||
tutorial, a multi-colored rotating triangle will be rendered. The framebuffer
|
tutorial, a multicolored rotating triangle will be rendered. The framebuffer
|
||||||
size needs to be retrieved for `glViewport`.
|
size needs to be retrieved for `glViewport`.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
|||||||
+1
-1
@@ -131,7 +131,7 @@ PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)
|
|||||||
glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr");
|
glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Device-specific functions may execute a little bit faster, due to not having to
|
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
|
dispatch internally based on the device passed to them. For more information
|
||||||
about `vkGetDeviceProcAddr`, see the Vulkan documentation.
|
about `vkGetDeviceProcAddr`, see the Vulkan documentation.
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -471,7 +471,8 @@ should also declare this in its `Info.plist` by setting the
|
|||||||
@anchor GLFW_X11_CLASS_NAME_hint
|
@anchor GLFW_X11_CLASS_NAME_hint
|
||||||
@anchor GLFW_X11_INSTANCE_NAME_hint
|
@anchor GLFW_X11_INSTANCE_NAME_hint
|
||||||
__GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired
|
__GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired
|
||||||
ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property.
|
ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. Both
|
||||||
|
hints need to be set to something other than an empty string for them to take effect.
|
||||||
These are set with @ref glfwWindowHintString.
|
These are set with @ref glfwWindowHintString.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+50
-26
@@ -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 8
|
#define GLFW_VERSION_REVISION 10
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@@ -361,10 +361,15 @@ extern "C" {
|
|||||||
#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
|
#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_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
|
||||||
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
|
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
|
||||||
|
|
||||||
|
/*! @ingroup input
|
||||||
|
*/
|
||||||
|
#define GLFW_KEY_UNKNOWN -1
|
||||||
|
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @defgroup keys Keyboard keys
|
/*! @defgroup keys Keyboard key tokens
|
||||||
* @brief Keyboard key IDs.
|
* @brief Keyboard key tokens.
|
||||||
*
|
*
|
||||||
* See [key input](@ref input_key) for how these are used.
|
* See [key input](@ref input_key) for how these are used.
|
||||||
*
|
*
|
||||||
@@ -387,9 +392,6 @@ extern "C" {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The unknown key */
|
|
||||||
#define GLFW_KEY_UNKNOWN -1
|
|
||||||
|
|
||||||
/* Printable keys */
|
/* Printable keys */
|
||||||
#define GLFW_KEY_SPACE 32
|
#define GLFW_KEY_SPACE 32
|
||||||
#define GLFW_KEY_APOSTROPHE 39 /* ' */
|
#define GLFW_KEY_APOSTROPHE 39 /* ' */
|
||||||
@@ -1063,6 +1065,9 @@ extern "C" {
|
|||||||
#define GLFW_EGL_CONTEXT_API 0x00036002
|
#define GLFW_EGL_CONTEXT_API 0x00036002
|
||||||
#define GLFW_OSMESA_CONTEXT_API 0x00036003
|
#define GLFW_OSMESA_CONTEXT_API 0x00036003
|
||||||
|
|
||||||
|
#define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001
|
||||||
|
#define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002
|
||||||
|
|
||||||
/*! @defgroup shapes Standard cursor shapes
|
/*! @defgroup shapes Standard cursor shapes
|
||||||
* @brief Standard system cursor shapes.
|
* @brief Standard system cursor shapes.
|
||||||
*
|
*
|
||||||
@@ -1123,6 +1128,11 @@ extern "C" {
|
|||||||
* macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
|
* macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
|
||||||
*/
|
*/
|
||||||
#define GLFW_COCOA_MENUBAR 0x00051002
|
#define GLFW_COCOA_MENUBAR 0x00051002
|
||||||
|
/*! @brief Wayland specific init hint.
|
||||||
|
*
|
||||||
|
* Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
|
||||||
|
*/
|
||||||
|
#define GLFW_WAYLAND_LIBDECOR 0x00053001
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
#define GLFW_DONT_CARE -1
|
#define GLFW_DONT_CARE -1
|
||||||
@@ -2601,8 +2611,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.
|
||||||
@@ -3551,11 +3561,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
|
||||||
@@ -4230,8 +4244,8 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
|
|||||||
* @param[in] scancode The scancode of the key to query.
|
* @param[in] scancode The scancode of the key to query.
|
||||||
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
|
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark The contents of the returned string may change when a keyboard
|
* @remark The contents of the returned string may change when a keyboard
|
||||||
* layout change event is received.
|
* layout change event is received.
|
||||||
@@ -4253,15 +4267,18 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
|
|||||||
*
|
*
|
||||||
* This function returns the platform-specific scancode of the specified key.
|
* 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
|
* If the specified [key token](@ref keys) corresponds to a physical key not
|
||||||
* method will return `-1`.
|
* 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).
|
* @param[in] key Any [key token](@ref keys).
|
||||||
* @return The platform-specific scancode for the key, or `-1` if an
|
* @return The platform-specific scancode for the key, or `-1` if the key is
|
||||||
* [error](@ref error_handling) occurred.
|
* not supported on the current platform or an [error](@ref error_handling)
|
||||||
|
* occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_INVALID_ENUM.
|
||||||
*
|
*
|
||||||
* @thread_safety This function may be called from any thread.
|
* @thread_safety This function may be called from any thread.
|
||||||
*
|
*
|
||||||
@@ -4545,9 +4562,9 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
|
|||||||
* [character callback](@ref glfwSetCharCallback) instead.
|
* [character callback](@ref glfwSetCharCallback) instead.
|
||||||
*
|
*
|
||||||
* When a window loses input focus, it will generate synthetic key release
|
* 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 for all pressed keys with associated key tokens. You can tell these
|
||||||
* events by the fact that the synthetic ones are generated after the focus
|
* events from user-generated events by the fact that the synthetic ones are
|
||||||
* loss event has been processed, i.e. after the
|
* generated after the focus loss event has been processed, i.e. after the
|
||||||
* [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
|
* [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
|
||||||
*
|
*
|
||||||
* The scancode of a key is specific to that platform or sometimes even to that
|
* The scancode of a key is specific to that platform or sometimes even to that
|
||||||
@@ -5446,12 +5463,15 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
|
|||||||
* thread.
|
* thread.
|
||||||
*
|
*
|
||||||
* This function makes the OpenGL or OpenGL ES context of the specified window
|
* 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
|
* current on the calling thread. It can also detach the current context from
|
||||||
* a single thread at a time and each thread can have only a single current
|
* the calling thread without making a new one current by passing in `NULL`.
|
||||||
* context at a time.
|
|
||||||
*
|
*
|
||||||
* When moving a context between threads, you must make it non-current on the
|
* A context must only be made current on a single thread at a time and each
|
||||||
* old thread before making it current on the new one.
|
* 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.
|
* By default, making a context non-current implicitly forces a pipeline flush.
|
||||||
* On machines that support `GL_KHR_context_flush_control`, you can control
|
* On machines that support `GL_KHR_context_flush_control`, you can control
|
||||||
@@ -5466,6 +5486,10 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
|
|||||||
* @param[in] window The window whose context to make current, or `NULL` to
|
* @param[in] window The window whose context to make current, or `NULL` to
|
||||||
* detach the current context.
|
* 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
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -103,17 +103,23 @@ extern "C" {
|
|||||||
#undef GLFW_APIENTRY_DEFINED
|
#undef GLFW_APIENTRY_DEFINED
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
#if defined(__OBJC__)
|
#if defined(__OBJC__)
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#else
|
#else
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <objc/objc.h>
|
#include <objc/objc.h>
|
||||||
#endif
|
#endif
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ if (BUILD_SHARED_LIBS)
|
|||||||
# Add a suffix to the import library to avoid naming conflicts
|
# Add a suffix to the import library to avoid naming conflicts
|
||||||
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
|
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
|
||||||
endif()
|
endif()
|
||||||
|
set (GLFW_LIB_NAME_SUFFIX "dll")
|
||||||
|
|
||||||
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
|
|||||||
+1
-1
@@ -251,7 +251,7 @@ static void createKeyTables(void)
|
|||||||
_glfw.ns.keycodes[0x6D] = GLFW_KEY_F10;
|
_glfw.ns.keycodes[0x6D] = GLFW_KEY_F10;
|
||||||
_glfw.ns.keycodes[0x67] = GLFW_KEY_F11;
|
_glfw.ns.keycodes[0x67] = GLFW_KEY_F11;
|
||||||
_glfw.ns.keycodes[0x6F] = GLFW_KEY_F12;
|
_glfw.ns.keycodes[0x6F] = GLFW_KEY_F12;
|
||||||
_glfw.ns.keycodes[0x69] = GLFW_KEY_F13;
|
_glfw.ns.keycodes[0x69] = GLFW_KEY_PRINT_SCREEN;
|
||||||
_glfw.ns.keycodes[0x6B] = GLFW_KEY_F14;
|
_glfw.ns.keycodes[0x6B] = GLFW_KEY_F14;
|
||||||
_glfw.ns.keycodes[0x71] = GLFW_KEY_F15;
|
_glfw.ns.keycodes[0x71] = GLFW_KEY_F15;
|
||||||
_glfw.ns.keycodes[0x6A] = GLFW_KEY_F16;
|
_glfw.ns.keycodes[0x6A] = GLFW_KEY_F16;
|
||||||
|
|||||||
@@ -137,6 +137,14 @@ static void matchCallback(void* context,
|
|||||||
return;
|
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);
|
axes = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
buttons = CFArrayCreateMutable(NULL, 0, NULL);
|
buttons = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
hats = CFArrayCreateMutable(NULL, 0, NULL);
|
hats = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
@@ -180,9 +188,6 @@ static void matchCallback(void* context,
|
|||||||
name[8], name[9], name[10]);
|
name[8], name[9], name[10]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFArrayRef elements =
|
|
||||||
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
|
||||||
|
|
||||||
for (i = 0; i < CFArrayGetCount(elements); i++)
|
for (i = 0; i < CFArrayGetCount(elements); i++)
|
||||||
{
|
{
|
||||||
IOHIDElementRef native = (IOHIDElementRef)
|
IOHIDElementRef native = (IOHIDElementRef)
|
||||||
|
|||||||
+13
-7
@@ -309,10 +309,15 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
- (void)windowDidChangeOcclusionState:(NSNotification* )notification
|
- (void)windowDidChangeOcclusionState:(NSNotification* )notification
|
||||||
{
|
{
|
||||||
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1090
|
||||||
window->ns.occluded = GLFW_FALSE;
|
if ([window->ns.object respondsToSelector:@selector(occlusionState)])
|
||||||
else
|
{
|
||||||
window->ns.occluded = GLFW_TRUE;
|
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
|
||||||
|
window->ns.occluded = GLFW_FALSE;
|
||||||
|
else
|
||||||
|
window->ns.occluded = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -1260,7 +1265,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable);
|
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable);
|
||||||
styleMask |= NSWindowStyleMaskBorderless;
|
styleMask |= NSWindowStyleMaskBorderless;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1630,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];
|
||||||
|
|||||||
+19
-10
@@ -48,16 +48,6 @@
|
|||||||
//
|
//
|
||||||
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
||||||
{
|
{
|
||||||
if (ctxconfig->share)
|
|
||||||
{
|
|
||||||
if (ctxconfig->client == GLFW_NO_API ||
|
|
||||||
ctxconfig->share->context.client == GLFW_NO_API)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API &&
|
if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API &&
|
||||||
ctxconfig->source != GLFW_EGL_CONTEXT_API &&
|
ctxconfig->source != GLFW_EGL_CONTEXT_API &&
|
||||||
ctxconfig->source != GLFW_OSMESA_CONTEXT_API)
|
ctxconfig->source != GLFW_OSMESA_CONTEXT_API)
|
||||||
@@ -78,6 +68,23 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->share)
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_NO_API ||
|
||||||
|
ctxconfig->share->context.client == GLFW_NO_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->source != ctxconfig->share->context.source)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Context creation APIs do not match between contexts");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ctxconfig->client == GLFW_OPENGL_API)
|
if (ctxconfig->client == GLFW_OPENGL_API)
|
||||||
{
|
{
|
||||||
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
|
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
|
||||||
@@ -356,6 +363,8 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
|||||||
|
|
||||||
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
|
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
glfwMakeContextCurrent((GLFWwindow*) window);
|
glfwMakeContextCurrent((GLFWwindow*) window);
|
||||||
|
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
|
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
|
||||||
window->context.getProcAddress("glGetIntegerv");
|
window->context.getProcAddress("glGetIntegerv");
|
||||||
|
|||||||
+76
-35
@@ -88,13 +88,30 @@ static int getEGLConfigAttrib(EGLConfig config, int attrib)
|
|||||||
// Return the EGLConfig most closely matching the specified hints
|
// Return the EGLConfig most closely matching the specified hints
|
||||||
//
|
//
|
||||||
static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* desired,
|
const _GLFWfbconfig* fbconfig,
|
||||||
EGLConfig* result)
|
EGLConfig* result)
|
||||||
{
|
{
|
||||||
EGLConfig* nativeConfigs;
|
EGLConfig* nativeConfigs;
|
||||||
_GLFWfbconfig* usableConfigs;
|
_GLFWfbconfig* usableConfigs;
|
||||||
const _GLFWfbconfig* closest;
|
const _GLFWfbconfig* closest;
|
||||||
int i, nativeCount, usableCount;
|
int i, nativeCount, usableCount, apiBit;
|
||||||
|
GLFWbool wrongApiAvailable = GLFW_FALSE;
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major == 1)
|
||||||
|
apiBit = EGL_OPENGL_ES_BIT;
|
||||||
|
else
|
||||||
|
apiBit = EGL_OPENGL_ES2_BIT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
apiBit = EGL_OPENGL_BIT;
|
||||||
|
|
||||||
|
if (fbconfig->stereo)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Stereo rendering not supported");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount);
|
eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount);
|
||||||
if (!nativeCount)
|
if (!nativeCount)
|
||||||
@@ -131,7 +148,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||||||
if (!vi.visualid)
|
if (!vi.visualid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (desired->transparent)
|
if (fbconfig->transparent)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
XVisualInfo* vis =
|
XVisualInfo* vis =
|
||||||
@@ -145,23 +162,10 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||||||
}
|
}
|
||||||
#endif // _GLFW_X11
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & apiBit))
|
||||||
{
|
{
|
||||||
if (ctxconfig->major == 1)
|
wrongApiAvailable = GLFW_TRUE;
|
||||||
{
|
continue;
|
||||||
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ctxconfig->client == GLFW_OPENGL_API)
|
|
||||||
{
|
|
||||||
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT))
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE);
|
u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE);
|
||||||
@@ -172,16 +176,57 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||||||
u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE);
|
u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE);
|
||||||
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||||
|
|
||||||
|
#if defined(_GLFW_WAYLAND)
|
||||||
|
// NOTE: The wl_surface opaque region is no guarantee that its buffer
|
||||||
|
// is presented as opaque, if it also has an alpha channel
|
||||||
|
// HACK: If EGL_EXT_present_opaque is unavailable, ignore any config
|
||||||
|
// with an alpha channel to ensure the buffer is opaque
|
||||||
|
if (!_glfw.egl.EXT_present_opaque)
|
||||||
|
{
|
||||||
|
if (!fbconfig->transparent && u->alphaBits > 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif // _GLFW_WAYLAND
|
||||||
|
|
||||||
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
||||||
u->doublebuffer = desired->doublebuffer;
|
u->doublebuffer = fbconfig->doublebuffer;
|
||||||
|
|
||||||
u->handle = (uintptr_t) n;
|
u->handle = (uintptr_t) n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
closest = _glfwChooseFBConfig(fbconfig, usableConfigs, usableCount);
|
||||||
if (closest)
|
if (closest)
|
||||||
*result = (EGLConfig) closest->handle;
|
*result = (EGLConfig) closest->handle;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (wrongApiAvailable)
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major == 1)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find support for OpenGL ES 1.x");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find support for OpenGL ES 2 or later");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find support for OpenGL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find a suitable EGLConfig");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(nativeConfigs);
|
free(nativeConfigs);
|
||||||
free(usableConfigs);
|
free(usableConfigs);
|
||||||
@@ -259,6 +304,7 @@ static int extensionSupportedEGL(const char* extension)
|
|||||||
static GLFWglproc getProcAddressEGL(const char* procname)
|
static GLFWglproc getProcAddressEGL(const char* procname)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
if (window->context.egl.client)
|
if (window->context.egl.client)
|
||||||
{
|
{
|
||||||
@@ -485,11 +531,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
share = ctxconfig->share->context.egl.handle;
|
share = ctxconfig->share->context.egl.handle;
|
||||||
|
|
||||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
|
if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
|
||||||
"EGL: Failed to find a suitable EGLConfig");
|
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
@@ -546,18 +588,18 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
|
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctxconfig->noerror)
|
|
||||||
{
|
|
||||||
if (_glfw.egl.KHR_create_context_no_error)
|
|
||||||
setAttrib(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
{
|
{
|
||||||
setAttrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
|
setAttrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
|
||||||
setAttrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
|
setAttrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->noerror)
|
||||||
|
{
|
||||||
|
if (_glfw.egl.KHR_create_context_no_error)
|
||||||
|
setAttrib(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
setAttrib(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
|
setAttrib(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
|
||||||
|
|
||||||
@@ -609,8 +651,10 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
if (!fbconfig->doublebuffer)
|
if (!fbconfig->doublebuffer)
|
||||||
setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
||||||
|
|
||||||
|
#if defined(_GLFW_WAYLAND)
|
||||||
if (_glfw.egl.EXT_present_opaque)
|
if (_glfw.egl.EXT_present_opaque)
|
||||||
setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
||||||
|
#endif // _GLFW_WAYLAND
|
||||||
|
|
||||||
setAttrib(EGL_NONE, EGL_NONE);
|
setAttrib(EGL_NONE, EGL_NONE);
|
||||||
|
|
||||||
@@ -678,6 +722,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
"libGL.so",
|
"libGL.so",
|
||||||
#else
|
#else
|
||||||
|
"libOpenGL.so.0",
|
||||||
"libGL.so.1",
|
"libGL.so.1",
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
@@ -740,11 +785,7 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
|
|||||||
const long vimask = VisualScreenMask | VisualIDMask;
|
const long vimask = VisualScreenMask | VisualIDMask;
|
||||||
|
|
||||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &native))
|
if (!chooseEGLConfig(ctxconfig, fbconfig, &native))
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
|
||||||
"EGL: Failed to find a suitable EGLConfig");
|
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
eglGetConfigAttrib(_glfw.egl.display, native,
|
eglGetConfigAttrib(_glfw.egl.display, native,
|
||||||
EGL_NATIVE_VISUAL_ID, &visualID);
|
EGL_NATIVE_VISUAL_ID, &visualID);
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,6 @@ Description: A multi-platform library for OpenGL, window and input
|
|||||||
Version: @GLFW_VERSION@
|
Version: @GLFW_VERSION@
|
||||||
URL: https://www.glfw.org/
|
URL: https://www.glfw.org/
|
||||||
Requires.private: @GLFW_PKG_DEPS@
|
Requires.private: @GLFW_PKG_DEPS@
|
||||||
Libs: -L${libdir} -l@GLFW_LIB_NAME@
|
Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
|
||||||
Libs.private: @GLFW_PKG_LIBS@
|
Libs.private: @GLFW_PKG_LIBS@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ static void swapBuffersGLX(_GLFWwindow* window)
|
|||||||
static void swapIntervalGLX(int interval)
|
static void swapIntervalGLX(int interval)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
if (_glfw.glx.EXT_swap_control)
|
if (_glfw.glx.EXT_swap_control)
|
||||||
{
|
{
|
||||||
@@ -226,7 +227,10 @@ static GLFWglproc getProcAddressGLX(const char* procname)
|
|||||||
else if (_glfw.glx.GetProcAddressARB)
|
else if (_glfw.glx.GetProcAddressARB)
|
||||||
return _glfw.glx.GetProcAddressARB((const GLubyte*) procname);
|
return _glfw.glx.GetProcAddressARB((const GLubyte*) procname);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// NOTE: glvnd provides GLX 1.4, so this can only happen with libGL
|
||||||
return _glfw_dlsym(_glfw.glx.handle, procname);
|
return _glfw_dlsym(_glfw.glx.handle, procname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyContextGLX(_GLFWwindow* window)
|
static void destroyContextGLX(_GLFWwindow* window)
|
||||||
@@ -263,6 +267,7 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
"libGL.so",
|
"libGL.so",
|
||||||
#else
|
#else
|
||||||
|
"libGLX.so.0",
|
||||||
"libGL.so.1",
|
"libGL.so.1",
|
||||||
"libGL.so",
|
"libGL.so",
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ typedef struct _GLFWlibraryGLX
|
|||||||
int eventBase;
|
int eventBase;
|
||||||
int errorBase;
|
int errorBase;
|
||||||
|
|
||||||
// dlopen handle for libGL.so.1
|
|
||||||
void* handle;
|
void* handle;
|
||||||
|
|
||||||
// GLX 1.3 functions
|
// GLX 1.3 functions
|
||||||
|
|||||||
+7
-1
@@ -54,7 +54,10 @@ static _GLFWinitconfig _glfwInitHints =
|
|||||||
{
|
{
|
||||||
GLFW_TRUE, // macOS menu bar
|
GLFW_TRUE, // macOS menu bar
|
||||||
GLFW_TRUE // macOS bundle chdir
|
GLFW_TRUE // macOS bundle chdir
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
GLFW_WAYLAND_PREFER_LIBDECOR // Wayland libdecor mode
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Terminate the library
|
// Terminate the library
|
||||||
@@ -367,6 +370,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
|
|||||||
case GLFW_COCOA_MENUBAR:
|
case GLFW_COCOA_MENUBAR:
|
||||||
_glfwInitHints.ns.menubar = value;
|
_glfwInitHints.ns.menubar = value;
|
||||||
return;
|
return;
|
||||||
|
case GLFW_WAYLAND_LIBDECOR:
|
||||||
|
_glfwInitHints.wl.libdecorMode = value;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
|||||||
+8
-2
@@ -616,6 +616,12 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
if (key != GLFW_KEY_UNKNOWN)
|
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 &&
|
if (key != GLFW_KEY_KP_EQUAL &&
|
||||||
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
|
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
|
||||||
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
|
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
|
||||||
@@ -631,12 +637,12 @@ 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)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
|
||||||
return GLFW_RELEASE;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _glfwPlatformGetKeyScancode(key);
|
return _glfwPlatformGetKeyScancode(key);
|
||||||
|
|||||||
@@ -244,6 +244,9 @@ struct _GLFWinitconfig
|
|||||||
GLFWbool menubar;
|
GLFWbool menubar;
|
||||||
GLFWbool chdir;
|
GLFWbool chdir;
|
||||||
} ns;
|
} ns;
|
||||||
|
struct {
|
||||||
|
int libdecorMode;
|
||||||
|
} wl;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Window configuration
|
// Window configuration
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure this device supports the events expected of a joystick
|
// Ensure this device supports the events expected of a joystick
|
||||||
if (!isBitSet(EV_KEY, evBits) || !isBitSet(EV_ABS, evBits))
|
if (!isBitSet(EV_ABS, evBits))
|
||||||
{
|
{
|
||||||
close(linjs.fd);
|
close(linjs.fd);
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
@@ -283,7 +283,8 @@ GLFWbool _glfwInitJoysticksLinux(void)
|
|||||||
|
|
||||||
// Continue without device connection notifications if inotify fails
|
// 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");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
@@ -333,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)
|
||||||
@@ -342,6 +341,9 @@ void _glfwTerminateJoysticksLinux(void)
|
|||||||
|
|
||||||
close(_glfw.linjs.inotify);
|
close(_glfw.linjs.inotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.linjs.regexCompiled)
|
||||||
|
regfree(&_glfw.linjs.regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwDetectJoystickConnectionLinux(void)
|
void _glfwDetectJoystickConnectionLinux(void)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ typedef struct _GLFWlibraryLinux
|
|||||||
int inotify;
|
int inotify;
|
||||||
int watch;
|
int watch;
|
||||||
regex_t regex;
|
regex_t regex;
|
||||||
|
GLFWbool regexCompiled;
|
||||||
GLFWbool dropped;
|
GLFWbool dropped;
|
||||||
} _GLFWlibraryLinux;
|
} _GLFWlibraryLinux;
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -81,11 +81,10 @@ static void swapIntervalNSGL(int interval)
|
|||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
if (window)
|
assert(window != NULL);
|
||||||
{
|
|
||||||
[window->context.nsgl.object setValues:&interval
|
[window->context.nsgl.object setValues:&interval
|
||||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||||
}
|
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
@@ -162,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)
|
||||||
|
|||||||
+14
-8
@@ -73,18 +73,30 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
int attribs[40];
|
int attribs[40];
|
||||||
int values[sizeof(attribs) / sizeof(attribs[0])];
|
int values[sizeof(attribs) / sizeof(attribs[0])];
|
||||||
|
|
||||||
|
nativeCount = DescribePixelFormat(window->context.wgl.dc,
|
||||||
|
1,
|
||||||
|
sizeof(PIXELFORMATDESCRIPTOR),
|
||||||
|
NULL);
|
||||||
|
|
||||||
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;
|
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||||
|
int extensionCount;
|
||||||
|
|
||||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||||
1, 0, 1, &attrib, &nativeCount))
|
1, 0, 1, &attrib, &extensionCount))
|
||||||
{
|
{
|
||||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||||
"WGL: Failed to retrieve pixel format attribute");
|
"WGL: Failed to retrieve pixel format attribute");
|
||||||
return 0;
|
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);
|
||||||
@@ -122,13 +134,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
addAttrib(WGL_COLORSPACE_EXT);
|
addAttrib(WGL_COLORSPACE_EXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
nativeCount = DescribePixelFormat(window->context.wgl.dc,
|
|
||||||
1,
|
|
||||||
sizeof(PIXELFORMATDESCRIPTOR),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
|
|
||||||
@@ -345,6 +350,7 @@ static void swapBuffersWGL(_GLFWwindow* window)
|
|||||||
static void swapIntervalWGL(int interval)
|
static void swapIntervalWGL(int interval)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
window->context.wgl.interval = interval;
|
window->context.wgl.interval = interval;
|
||||||
|
|
||||||
|
|||||||
@@ -736,6 +736,13 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)
|
if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)
|
||||||
dpad |= GLFW_HAT_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);
|
_glfwInputJoystickHat(js, 0, dpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,6 +347,8 @@ typedef struct _GLFWlibraryWin32
|
|||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
// The window whose disabled cursor mode is active
|
// The window whose disabled cursor mode is active
|
||||||
_GLFWwindow* disabledCursorWindow;
|
_GLFWwindow* disabledCursorWindow;
|
||||||
|
// The window the cursor is captured in
|
||||||
|
_GLFWwindow* capturedCursorWindow;
|
||||||
RAWINPUT* rawInput;
|
RAWINPUT* rawInput;
|
||||||
int rawInputSize;
|
int rawInputSize;
|
||||||
UINT mouseTrailSize;
|
UINT mouseTrailSize;
|
||||||
|
|||||||
+109
-82
@@ -186,53 +186,38 @@ static HICON createIcon(const GLFWimage* image,
|
|||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate content area size to full window size according to styles and DPI
|
|
||||||
//
|
|
||||||
static void getFullWindowSize(DWORD style, DWORD exStyle,
|
|
||||||
int contentWidth, int contentHeight,
|
|
||||||
int* fullWidth, int* fullHeight,
|
|
||||||
UINT dpi)
|
|
||||||
{
|
|
||||||
RECT rect = { 0, 0, contentWidth, contentHeight };
|
|
||||||
|
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
|
||||||
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
|
|
||||||
else
|
|
||||||
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
|
||||||
|
|
||||||
*fullWidth = rect.right - rect.left;
|
|
||||||
*fullHeight = rect.bottom - rect.top;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enforce the content area aspect ratio based on which edge is being dragged
|
// Enforce the content area aspect ratio based on which edge is being dragged
|
||||||
//
|
//
|
||||||
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
|
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
|
||||||
{
|
{
|
||||||
int xoff, yoff;
|
RECT frame = {0};
|
||||||
UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
|
||||||
const float ratio = (float) window->numer / (float) window->denom;
|
const float ratio = (float) window->numer / (float) window->denom;
|
||||||
|
const DWORD style = getWindowStyle(window);
|
||||||
|
const DWORD exStyle = getWindowExStyle(window);
|
||||||
|
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
dpi = GetDpiForWindow(window->win32.handle);
|
{
|
||||||
|
AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle,
|
||||||
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
|
GetDpiForWindow(window->win32.handle));
|
||||||
0, 0, &xoff, &yoff, dpi);
|
}
|
||||||
|
else
|
||||||
|
AdjustWindowRectEx(&frame, style, FALSE, exStyle);
|
||||||
|
|
||||||
if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT ||
|
if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT ||
|
||||||
edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT)
|
edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT)
|
||||||
{
|
{
|
||||||
area->bottom = area->top + yoff +
|
area->bottom = area->top + (frame.bottom - frame.top) +
|
||||||
(int) ((area->right - area->left - xoff) / ratio);
|
(int) (((area->right - area->left) - (frame.right - frame.left)) / ratio);
|
||||||
}
|
}
|
||||||
else if (edge == WMSZ_TOPLEFT || edge == WMSZ_TOPRIGHT)
|
else if (edge == WMSZ_TOPLEFT || edge == WMSZ_TOPRIGHT)
|
||||||
{
|
{
|
||||||
area->top = area->bottom - yoff -
|
area->top = area->bottom - (frame.bottom - frame.top) -
|
||||||
(int) ((area->right - area->left - xoff) / ratio);
|
(int) (((area->right - area->left) - (frame.right - frame.left)) / ratio);
|
||||||
}
|
}
|
||||||
else if (edge == WMSZ_TOP || edge == WMSZ_BOTTOM)
|
else if (edge == WMSZ_TOP || edge == WMSZ_BOTTOM)
|
||||||
{
|
{
|
||||||
area->right = area->left + xoff +
|
area->right = area->left + (frame.right - frame.left) +
|
||||||
(int) ((area->bottom - area->top - yoff) * ratio);
|
(int) (((area->bottom - area->top) - (frame.bottom - frame.top)) * ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,20 +236,24 @@ static void updateCursorImage(_GLFWwindow* window)
|
|||||||
SetCursor(NULL);
|
SetCursor(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the cursor clip rect
|
// Sets the cursor clip rect to the window content area
|
||||||
//
|
//
|
||||||
static void updateClipRect(_GLFWwindow* window)
|
static void captureCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window)
|
RECT clipRect;
|
||||||
{
|
GetClientRect(window->win32.handle, &clipRect);
|
||||||
RECT clipRect;
|
ClientToScreen(window->win32.handle, (POINT*) &clipRect.left);
|
||||||
GetClientRect(window->win32.handle, &clipRect);
|
ClientToScreen(window->win32.handle, (POINT*) &clipRect.right);
|
||||||
ClientToScreen(window->win32.handle, (POINT*) &clipRect.left);
|
ClipCursor(&clipRect);
|
||||||
ClientToScreen(window->win32.handle, (POINT*) &clipRect.right);
|
_glfw.win32.capturedCursorWindow = window;
|
||||||
ClipCursor(&clipRect);
|
}
|
||||||
}
|
|
||||||
else
|
// Disabled clip cursor
|
||||||
ClipCursor(NULL);
|
//
|
||||||
|
static void releaseCursor(void)
|
||||||
|
{
|
||||||
|
ClipCursor(NULL);
|
||||||
|
_glfw.win32.capturedCursorWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables WM_INPUT messages for the mouse for the specified window
|
// Enables WM_INPUT messages for the mouse for the specified window
|
||||||
@@ -303,7 +292,7 @@ static void disableCursor(_GLFWwindow* window)
|
|||||||
&_glfw.win32.restoreCursorPosY);
|
&_glfw.win32.restoreCursorPosY);
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
_glfwCenterCursorInContentArea(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
updateClipRect(window);
|
captureCursor(window);
|
||||||
|
|
||||||
if (window->rawMouseMotion)
|
if (window->rawMouseMotion)
|
||||||
enableRawMouseMotion(window);
|
enableRawMouseMotion(window);
|
||||||
@@ -317,7 +306,7 @@ static void enableCursor(_GLFWwindow* window)
|
|||||||
disableRawMouseMotion(window);
|
disableRawMouseMotion(window);
|
||||||
|
|
||||||
_glfw.win32.disabledCursorWindow = NULL;
|
_glfw.win32.disabledCursorWindow = NULL;
|
||||||
updateClipRect(NULL);
|
releaseCursor();
|
||||||
_glfwPlatformSetCursorPos(window,
|
_glfwPlatformSetCursorPos(window,
|
||||||
_glfw.win32.restoreCursorPosX,
|
_glfw.win32.restoreCursorPosX,
|
||||||
_glfw.win32.restoreCursorPosY);
|
_glfw.win32.restoreCursorPosY);
|
||||||
@@ -1033,8 +1022,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
(window->win32.maximized &&
|
(window->win32.maximized &&
|
||||||
wParam != SIZE_RESTORED);
|
wParam != SIZE_RESTORED);
|
||||||
|
|
||||||
if (_glfw.win32.disabledCursorWindow == window)
|
if (_glfw.win32.capturedCursorWindow == window)
|
||||||
updateClipRect(window);
|
captureCursor(window);
|
||||||
|
|
||||||
if (window->win32.iconified != iconified)
|
if (window->win32.iconified != iconified)
|
||||||
_glfwInputWindowIconify(window, iconified);
|
_glfwInputWindowIconify(window, iconified);
|
||||||
@@ -1069,8 +1058,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
{
|
{
|
||||||
if (_glfw.win32.disabledCursorWindow == window)
|
if (_glfw.win32.capturedCursorWindow == window)
|
||||||
updateClipRect(window);
|
captureCursor(window);
|
||||||
|
|
||||||
// NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as
|
// NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as
|
||||||
// those macros do not handle negative window positions correctly
|
// those macros do not handle negative window positions correctly
|
||||||
@@ -1094,31 +1083,34 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_GETMINMAXINFO:
|
case WM_GETMINMAXINFO:
|
||||||
{
|
{
|
||||||
int xoff, yoff;
|
RECT frame = {0};
|
||||||
UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
|
||||||
MINMAXINFO* mmi = (MINMAXINFO*) lParam;
|
MINMAXINFO* mmi = (MINMAXINFO*) lParam;
|
||||||
|
const DWORD style = getWindowStyle(window);
|
||||||
|
const DWORD exStyle = getWindowExStyle(window);
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
dpi = GetDpiForWindow(window->win32.handle);
|
{
|
||||||
|
AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle,
|
||||||
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
|
GetDpiForWindow(window->win32.handle));
|
||||||
0, 0, &xoff, &yoff, dpi);
|
}
|
||||||
|
else
|
||||||
|
AdjustWindowRectEx(&frame, style, FALSE, exStyle);
|
||||||
|
|
||||||
if (window->minwidth != GLFW_DONT_CARE &&
|
if (window->minwidth != GLFW_DONT_CARE &&
|
||||||
window->minheight != GLFW_DONT_CARE)
|
window->minheight != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
mmi->ptMinTrackSize.x = window->minwidth + xoff;
|
mmi->ptMinTrackSize.x = window->minwidth + frame.right - frame.left;
|
||||||
mmi->ptMinTrackSize.y = window->minheight + yoff;
|
mmi->ptMinTrackSize.y = window->minheight + frame.bottom - frame.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->maxwidth != GLFW_DONT_CARE &&
|
if (window->maxwidth != GLFW_DONT_CARE &&
|
||||||
window->maxheight != GLFW_DONT_CARE)
|
window->maxheight != GLFW_DONT_CARE)
|
||||||
{
|
{
|
||||||
mmi->ptMaxTrackSize.x = window->maxwidth + xoff;
|
mmi->ptMaxTrackSize.x = window->maxwidth + frame.right - frame.left;
|
||||||
mmi->ptMaxTrackSize.y = window->maxheight + yoff;
|
mmi->ptMaxTrackSize.y = window->maxheight + frame.bottom - frame.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window->decorated)
|
if (!window->decorated)
|
||||||
@@ -1277,7 +1269,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
int xpos, ypos, fullWidth, fullHeight;
|
int frameX, frameY, frameWidth, frameHeight;
|
||||||
WCHAR* wideTitle;
|
WCHAR* wideTitle;
|
||||||
DWORD style = getWindowStyle(window);
|
DWORD style = getWindowStyle(window);
|
||||||
DWORD exStyle = getWindowExStyle(window);
|
DWORD exStyle = getWindowExStyle(window);
|
||||||
@@ -1290,24 +1282,25 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
// NOTE: This window placement is temporary and approximate, as the
|
// NOTE: This window placement is temporary and approximate, as the
|
||||||
// correct position and size cannot be known until the monitor
|
// correct position and size cannot be known until the monitor
|
||||||
// video mode has been picked in _glfwSetVideoModeWin32
|
// video mode has been picked in _glfwSetVideoModeWin32
|
||||||
xpos = mi.rcMonitor.left;
|
frameX = mi.rcMonitor.left;
|
||||||
ypos = mi.rcMonitor.top;
|
frameY = mi.rcMonitor.top;
|
||||||
fullWidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
frameWidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
||||||
fullHeight = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
frameHeight = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xpos = CW_USEDEFAULT;
|
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
||||||
ypos = CW_USEDEFAULT;
|
|
||||||
|
|
||||||
window->win32.maximized = wndconfig->maximized;
|
window->win32.maximized = wndconfig->maximized;
|
||||||
if (wndconfig->maximized)
|
if (wndconfig->maximized)
|
||||||
style |= WS_MAXIMIZE;
|
style |= WS_MAXIMIZE;
|
||||||
|
|
||||||
getFullWindowSize(style, exStyle,
|
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
||||||
wndconfig->width, wndconfig->height,
|
|
||||||
&fullWidth, &fullHeight,
|
frameX = CW_USEDEFAULT;
|
||||||
USER_DEFAULT_SCREEN_DPI);
|
frameY = CW_USEDEFAULT;
|
||||||
|
frameWidth = rect.right - rect.left;
|
||||||
|
frameHeight = rect.bottom - rect.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title);
|
wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title);
|
||||||
@@ -1318,8 +1311,8 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
_GLFW_WNDCLASSNAME,
|
_GLFW_WNDCLASSNAME,
|
||||||
wideTitle,
|
wideTitle,
|
||||||
style,
|
style,
|
||||||
xpos, ypos,
|
frameX, frameY,
|
||||||
fullWidth, fullHeight,
|
frameWidth, frameHeight,
|
||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
NULL, // No window menu
|
NULL, // No window menu
|
||||||
_glfw.win32.instance,
|
_glfw.win32.instance,
|
||||||
@@ -1540,7 +1533,10 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
window->context.destroy(window);
|
window->context.destroy(window);
|
||||||
|
|
||||||
if (_glfw.win32.disabledCursorWindow == window)
|
if (_glfw.win32.disabledCursorWindow == window)
|
||||||
_glfw.win32.disabledCursorWindow = NULL;
|
enableCursor(window);
|
||||||
|
|
||||||
|
if (_glfw.win32.capturedCursorWindow == window)
|
||||||
|
releaseCursor();
|
||||||
|
|
||||||
if (window->win32.handle)
|
if (window->win32.handle)
|
||||||
{
|
{
|
||||||
@@ -2117,7 +2113,7 @@ void _glfwPlatformWaitEvents(void)
|
|||||||
|
|
||||||
void _glfwPlatformWaitEventsTimeout(double timeout)
|
void _glfwPlatformWaitEventsTimeout(double timeout)
|
||||||
{
|
{
|
||||||
MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLEVENTS);
|
MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLINPUT);
|
||||||
|
|
||||||
_glfwPlatformPollEvents();
|
_glfwPlatformPollEvents();
|
||||||
}
|
}
|
||||||
@@ -2156,27 +2152,58 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
|||||||
|
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
||||||
{
|
{
|
||||||
if (mode == GLFW_CURSOR_DISABLED)
|
if (_glfwPlatformWindowFocused(window))
|
||||||
{
|
{
|
||||||
if (_glfwPlatformWindowFocused(window))
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
disableCursor(window);
|
{
|
||||||
|
_glfwPlatformGetCursorPos(window,
|
||||||
|
&_glfw.win32.restoreCursorPosX,
|
||||||
|
&_glfw.win32.restoreCursorPosY);
|
||||||
|
_glfwCenterCursorInContentArea(window);
|
||||||
|
if (window->rawMouseMotion)
|
||||||
|
enableRawMouseMotion(window);
|
||||||
|
}
|
||||||
|
else if (_glfw.win32.disabledCursorWindow == window)
|
||||||
|
{
|
||||||
|
if (window->rawMouseMotion)
|
||||||
|
disableRawMouseMotion(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
|
captureCursor(window);
|
||||||
|
else
|
||||||
|
releaseCursor();
|
||||||
|
|
||||||
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
|
_glfw.win32.disabledCursorWindow = window;
|
||||||
|
else if (_glfw.win32.disabledCursorWindow == window)
|
||||||
|
{
|
||||||
|
_glfw.win32.disabledCursorWindow = NULL;
|
||||||
|
_glfwPlatformSetCursorPos(window,
|
||||||
|
_glfw.win32.restoreCursorPosX,
|
||||||
|
_glfw.win32.restoreCursorPosY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (_glfw.win32.disabledCursorWindow == window)
|
|
||||||
enableCursor(window);
|
if (cursorInContentArea(window))
|
||||||
else if (cursorInContentArea(window))
|
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
+1
-1
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+201
-40
@@ -40,6 +40,7 @@
|
|||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
static void wmBaseHandlePing(void* userData,
|
static void wmBaseHandlePing(void* userData,
|
||||||
struct xdg_wm_base* wmBase,
|
struct xdg_wm_base* wmBase,
|
||||||
@@ -61,10 +62,9 @@ static void registryHandleGlobal(void* userData,
|
|||||||
{
|
{
|
||||||
if (strcmp(interface, "wl_compositor") == 0)
|
if (strcmp(interface, "wl_compositor") == 0)
|
||||||
{
|
{
|
||||||
_glfw.wl.compositorVersion = _glfw_min(3, version);
|
|
||||||
_glfw.wl.compositor =
|
_glfw.wl.compositor =
|
||||||
wl_registry_bind(registry, name, &wl_compositor_interface,
|
wl_registry_bind(registry, name, &wl_compositor_interface,
|
||||||
_glfw.wl.compositorVersion);
|
_glfw_min(3, version));
|
||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_subcompositor") == 0)
|
else if (strcmp(interface, "wl_subcompositor") == 0)
|
||||||
{
|
{
|
||||||
@@ -84,10 +84,9 @@ static void registryHandleGlobal(void* userData,
|
|||||||
{
|
{
|
||||||
if (!_glfw.wl.seat)
|
if (!_glfw.wl.seat)
|
||||||
{
|
{
|
||||||
_glfw.wl.seatVersion = _glfw_min(4, version);
|
|
||||||
_glfw.wl.seat =
|
_glfw.wl.seat =
|
||||||
wl_registry_bind(registry, name, &wl_seat_interface,
|
wl_registry_bind(registry, name, &wl_seat_interface,
|
||||||
_glfw.wl.seatVersion);
|
_glfw_min(4, version));
|
||||||
_glfwAddSeatListenerWayland(_glfw.wl.seat);
|
_glfwAddSeatListenerWayland(_glfw.wl.seat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,6 +164,36 @@ static const struct wl_registry_listener registryListener =
|
|||||||
registryHandleGlobalRemove
|
registryHandleGlobalRemove
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void libdecorHandleError(struct libdecor* context,
|
||||||
|
enum libdecor_error error,
|
||||||
|
const char* message)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: libdecor error %u: %s",
|
||||||
|
error, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// Create key code translation tables
|
||||||
//
|
//
|
||||||
static void createKeyTables(void)
|
static void createKeyTables(void)
|
||||||
@@ -300,6 +329,38 @@ static void createKeyTables(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GLFWbool loadCursorTheme(void)
|
||||||
|
{
|
||||||
|
int cursorSize = 16;
|
||||||
|
|
||||||
|
const char* sizeString = getenv("XCURSOR_SIZE");
|
||||||
|
if (sizeString)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
const long cursorSizeLong = strtol(sizeString, NULL, 10);
|
||||||
|
if (errno == 0 && cursorSizeLong > 0 && cursorSizeLong < INT_MAX)
|
||||||
|
cursorSize = (int) cursorSizeLong;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* themeName = getenv("XCURSOR_THEME");
|
||||||
|
|
||||||
|
_glfw.wl.cursorTheme = wl_cursor_theme_load(themeName, cursorSize, _glfw.wl.shm);
|
||||||
|
if (!_glfw.wl.cursorTheme)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to load default cursor theme");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this happens to be NULL, we just fallback to the scale=1 version.
|
||||||
|
_glfw.wl.cursorThemeHiDPI =
|
||||||
|
wl_cursor_theme_load(themeName, cursorSize * 2, _glfw.wl.shm);
|
||||||
|
|
||||||
|
_glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor);
|
||||||
|
_glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
@@ -307,16 +368,12 @@ static void createKeyTables(void)
|
|||||||
|
|
||||||
int _glfwPlatformInit(void)
|
int _glfwPlatformInit(void)
|
||||||
{
|
{
|
||||||
const char* cursorTheme;
|
|
||||||
const char* cursorSizeStr;
|
|
||||||
char* cursorSizeEnd;
|
|
||||||
long cursorSizeLong;
|
|
||||||
int cursorSize;
|
|
||||||
|
|
||||||
// These must be set before any failure checks
|
// These must be set before any failure checks
|
||||||
_glfw.wl.timerfd = -1;
|
_glfw.wl.keyRepeatTimerfd = -1;
|
||||||
_glfw.wl.cursorTimerfd = -1;
|
_glfw.wl.cursorTimerfd = -1;
|
||||||
|
|
||||||
|
_glfw.wl.tag = glfwGetVersionString();
|
||||||
|
|
||||||
_glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
|
_glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
|
||||||
if (!_glfw.wl.cursor.handle)
|
if (!_glfw.wl.cursor.handle)
|
||||||
{
|
{
|
||||||
@@ -407,6 +464,93 @@ int _glfwPlatformInit(void)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.hints.init.wl.libdecorMode == GLFW_WAYLAND_PREFER_LIBDECOR)
|
||||||
|
_glfw.wl.libdecor.handle = _glfw_dlopen("libdecor-0.so.0");
|
||||||
|
|
||||||
|
if (_glfw.wl.libdecor.handle)
|
||||||
|
{
|
||||||
|
_glfw.wl.libdecor.libdecor_new_ = (PFN_libdecor_new)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_new");
|
||||||
|
_glfw.wl.libdecor.libdecor_unref_ = (PFN_libdecor_unref)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_unref");
|
||||||
|
_glfw.wl.libdecor.libdecor_get_fd_ = (PFN_libdecor_get_fd)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_get_fd");
|
||||||
|
_glfw.wl.libdecor.libdecor_dispatch_ = (PFN_libdecor_dispatch)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_dispatch");
|
||||||
|
_glfw.wl.libdecor.libdecor_decorate_ = (PFN_libdecor_decorate)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_decorate");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_unref_ = (PFN_libdecor_frame_unref)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unref");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_app_id_ = (PFN_libdecor_frame_set_app_id)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_app_id");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_title_ = (PFN_libdecor_frame_set_title)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_title");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_minimized_ = (PFN_libdecor_frame_set_minimized)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_minimized");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_fullscreen_ = (PFN_libdecor_frame_set_fullscreen)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_fullscreen");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_unset_fullscreen_ = (PFN_libdecor_frame_unset_fullscreen)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unset_fullscreen");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_map_ = (PFN_libdecor_frame_map)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_map");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_commit_ = (PFN_libdecor_frame_commit)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_commit");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_min_content_size_ = (PFN_libdecor_frame_set_min_content_size)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_min_content_size");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_max_content_size_ = (PFN_libdecor_frame_set_max_content_size)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_max_content_size");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_maximized_ = (PFN_libdecor_frame_set_maximized)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_maximized");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_unset_maximized_ = (PFN_libdecor_frame_unset_maximized)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unset_maximized");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_capabilities_ = (PFN_libdecor_frame_set_capabilities)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_capabilities");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_unset_capabilities_ = (PFN_libdecor_frame_unset_capabilities)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unset_capabilities");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_set_visibility_ = (PFN_libdecor_frame_set_visibility)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_visibility");
|
||||||
|
_glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ = (PFN_libdecor_frame_get_xdg_toplevel)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_get_xdg_toplevel");
|
||||||
|
_glfw.wl.libdecor.libdecor_configuration_get_content_size_ = (PFN_libdecor_configuration_get_content_size)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_configuration_get_content_size");
|
||||||
|
_glfw.wl.libdecor.libdecor_configuration_get_window_state_ = (PFN_libdecor_configuration_get_window_state)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_configuration_get_window_state");
|
||||||
|
_glfw.wl.libdecor.libdecor_state_new_ = (PFN_libdecor_state_new)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_state_new");
|
||||||
|
_glfw.wl.libdecor.libdecor_state_free_ = (PFN_libdecor_state_free)
|
||||||
|
_glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_state_free");
|
||||||
|
|
||||||
|
if (!_glfw.wl.libdecor.libdecor_new_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_unref_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_get_fd_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_dispatch_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_decorate_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_unref_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_app_id_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_title_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_minimized_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_fullscreen_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_unset_fullscreen_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_map_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_commit_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_min_content_size_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_max_content_size_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_maximized_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_unset_maximized_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_capabilities_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_unset_capabilities_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_set_visibility_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_configuration_get_content_size_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_configuration_get_window_state_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_state_new_ ||
|
||||||
|
!_glfw.wl.libdecor.libdecor_state_free_)
|
||||||
|
{
|
||||||
|
_glfw_dlclose(_glfw.wl.libdecor.handle);
|
||||||
|
memset(&_glfw.wl.libdecor, 0, sizeof(_glfw.wl.libdecor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
|
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
|
||||||
wl_registry_add_listener(_glfw.wl.registry, ®istryListener, NULL);
|
wl_registry_add_listener(_glfw.wl.registry, ®istryListener, NULL);
|
||||||
|
|
||||||
@@ -433,9 +577,28 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
_glfwInitTimerPOSIX();
|
_glfwInitTimerPOSIX();
|
||||||
|
|
||||||
|
if (_glfw.wl.libdecor.handle)
|
||||||
|
{
|
||||||
|
_glfw.wl.libdecor.context = libdecor_new(_glfw.wl.display, &libdecorInterface);
|
||||||
|
if (_glfw.wl.libdecor.context)
|
||||||
|
{
|
||||||
|
// 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
|
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
||||||
if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
|
if (wl_seat_get_version(_glfw.wl.seat) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
|
||||||
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
{
|
||||||
|
_glfw.wl.keyRepeatTimerfd =
|
||||||
|
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_glfw.wl.wmBase)
|
if (!_glfw.wl.wmBase)
|
||||||
@@ -445,34 +608,16 @@ int _glfwPlatformInit(void)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.wl.pointer && _glfw.wl.shm)
|
if (!_glfw.wl.shm)
|
||||||
{
|
{
|
||||||
cursorTheme = getenv("XCURSOR_THEME");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
cursorSizeStr = getenv("XCURSOR_SIZE");
|
"Wayland: Failed to find wl_shm in your compositor");
|
||||||
cursorSize = 32;
|
return GLFW_FALSE;
|
||||||
if (cursorSizeStr)
|
|
||||||
{
|
|
||||||
errno = 0;
|
|
||||||
cursorSizeLong = strtol(cursorSizeStr, &cursorSizeEnd, 10);
|
|
||||||
if (!*cursorSizeEnd && !errno && cursorSizeLong > 0 && cursorSizeLong <= INT_MAX)
|
|
||||||
cursorSize = (int)cursorSizeLong;
|
|
||||||
}
|
|
||||||
_glfw.wl.cursorTheme =
|
|
||||||
wl_cursor_theme_load(cursorTheme, cursorSize, _glfw.wl.shm);
|
|
||||||
if (!_glfw.wl.cursorTheme)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: Failed to load default cursor theme");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
// If this happens to be NULL, we just fallback to the scale=1 version.
|
|
||||||
_glfw.wl.cursorThemeHiDPI =
|
|
||||||
wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm);
|
|
||||||
_glfw.wl.cursorSurface =
|
|
||||||
wl_compositor_create_surface(_glfw.wl.compositor);
|
|
||||||
_glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!loadCursorTheme())
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)
|
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)
|
||||||
{
|
{
|
||||||
_glfw.wl.dataDevice =
|
_glfw.wl.dataDevice =
|
||||||
@@ -492,6 +637,22 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfwTerminateEGL();
|
_glfwTerminateEGL();
|
||||||
_glfwTerminateOSMesa();
|
_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)
|
||||||
|
_glfwPlatformWaitEvents();
|
||||||
|
|
||||||
|
libdecor_unref(_glfw.wl.libdecor.context);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.wl.libdecor.handle)
|
||||||
|
{
|
||||||
|
_glfw_dlclose(_glfw.wl.libdecor.handle);
|
||||||
|
_glfw.wl.libdecor.handle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.wl.egl.handle)
|
if (_glfw.wl.egl.handle)
|
||||||
{
|
{
|
||||||
_glfw_dlclose(_glfw.wl.egl.handle);
|
_glfw_dlclose(_glfw.wl.egl.handle);
|
||||||
@@ -571,8 +732,8 @@ void _glfwPlatformTerminate(void)
|
|||||||
wl_display_disconnect(_glfw.wl.display);
|
wl_display_disconnect(_glfw.wl.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.wl.timerfd >= 0)
|
if (_glfw.wl.keyRepeatTimerfd >= 0)
|
||||||
close(_glfw.wl.timerfd);
|
close(_glfw.wl.keyRepeatTimerfd);
|
||||||
if (_glfw.wl.cursorTimerfd >= 0)
|
if (_glfw.wl.cursorTimerfd >= 0)
|
||||||
close(_glfw.wl.cursorTimerfd);
|
close(_glfw.wl.cursorTimerfd);
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -110,14 +110,15 @@ static void outputHandleScale(void* userData,
|
|||||||
{
|
{
|
||||||
struct _GLFWmonitor* monitor = userData;
|
struct _GLFWmonitor* monitor = userData;
|
||||||
|
|
||||||
monitor->wl.scale = factor;
|
monitor->wl.contentScale = factor;
|
||||||
|
|
||||||
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < window->wl.monitorsCount; i++)
|
for (int i = 0; i < window->wl.scaleCount; i++)
|
||||||
{
|
{
|
||||||
if (window->wl.monitors[i] == monitor)
|
if (window->wl.scales[i].output == monitor->wl.output)
|
||||||
{
|
{
|
||||||
|
window->wl.scales[i].factor = monitor->wl.contentScale;
|
||||||
_glfwUpdateContentScaleWayland(window);
|
_glfwUpdateContentScaleWayland(window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -183,10 +184,11 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
|||||||
|
|
||||||
// The actual name of this output will be set in the geometry handler
|
// The actual name of this output will be set in the geometry handler
|
||||||
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
|
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
|
||||||
monitor->wl.scale = 1;
|
monitor->wl.contentScale = 1;
|
||||||
monitor->wl.output = output;
|
monitor->wl.output = output;
|
||||||
monitor->wl.name = name;
|
monitor->wl.name = name;
|
||||||
|
|
||||||
|
wl_proxy_set_tag((struct wl_proxy*) output, &_glfw.wl.tag);
|
||||||
wl_output_add_listener(output, &outputListener, monitor);
|
wl_output_add_listener(output, &outputListener, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,9 +215,9 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
|
|||||||
float* xscale, float* yscale)
|
float* xscale, float* yscale)
|
||||||
{
|
{
|
||||||
if (xscale)
|
if (xscale)
|
||||||
*xscale = (float) monitor->wl.scale;
|
*xscale = (float) monitor->wl.contentScale;
|
||||||
if (yscale)
|
if (yscale)
|
||||||
*yscale = (float) monitor->wl.scale;
|
*yscale = (float) monitor->wl.contentScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
|
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
|
||||||
|
|||||||
+179
-22
@@ -29,6 +29,8 @@
|
|||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
typedef struct VkWaylandSurfaceCreateInfoKHR
|
typedef struct VkWaylandSurfaceCreateInfoKHR
|
||||||
@@ -146,13 +148,129 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
|
|||||||
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
||||||
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
||||||
|
|
||||||
|
struct libdecor;
|
||||||
|
struct libdecor_frame;
|
||||||
|
struct libdecor_state;
|
||||||
|
struct libdecor_configuration;
|
||||||
|
|
||||||
|
enum libdecor_error
|
||||||
|
{
|
||||||
|
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
|
||||||
|
LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum libdecor_window_state
|
||||||
|
{
|
||||||
|
LIBDECOR_WINDOW_STATE_NONE = 0,
|
||||||
|
LIBDECOR_WINDOW_STATE_ACTIVE = 1,
|
||||||
|
LIBDECOR_WINDOW_STATE_MAXIMIZED = 2,
|
||||||
|
LIBDECOR_WINDOW_STATE_FULLSCREEN = 4,
|
||||||
|
LIBDECOR_WINDOW_STATE_TILED_LEFT = 8,
|
||||||
|
LIBDECOR_WINDOW_STATE_TILED_RIGHT = 16,
|
||||||
|
LIBDECOR_WINDOW_STATE_TILED_TOP = 32,
|
||||||
|
LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 64
|
||||||
|
};
|
||||||
|
|
||||||
|
enum libdecor_capabilities
|
||||||
|
{
|
||||||
|
LIBDECOR_ACTION_MOVE = 1,
|
||||||
|
LIBDECOR_ACTION_RESIZE = 2,
|
||||||
|
LIBDECOR_ACTION_MINIMIZE = 4,
|
||||||
|
LIBDECOR_ACTION_FULLSCREEN = 8,
|
||||||
|
LIBDECOR_ACTION_CLOSE = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
struct libdecor_interface
|
||||||
|
{
|
||||||
|
void (* error)(struct libdecor*,enum libdecor_error,const char*);
|
||||||
|
void (* reserved0)(void);
|
||||||
|
void (* reserved1)(void);
|
||||||
|
void (* reserved2)(void);
|
||||||
|
void (* reserved3)(void);
|
||||||
|
void (* reserved4)(void);
|
||||||
|
void (* reserved5)(void);
|
||||||
|
void (* reserved6)(void);
|
||||||
|
void (* reserved7)(void);
|
||||||
|
void (* reserved8)(void);
|
||||||
|
void (* reserved9)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct libdecor_frame_interface
|
||||||
|
{
|
||||||
|
void (* configure)(struct libdecor_frame*,struct libdecor_configuration*,void*);
|
||||||
|
void (* close)(struct libdecor_frame*,void*);
|
||||||
|
void (* commit)(struct libdecor_frame*,void*);
|
||||||
|
void (* dismiss_popup)(struct libdecor_frame*,const char*,void*);
|
||||||
|
void (* reserved0)(void);
|
||||||
|
void (* reserved1)(void);
|
||||||
|
void (* reserved2)(void);
|
||||||
|
void (* reserved3)(void);
|
||||||
|
void (* reserved4)(void);
|
||||||
|
void (* reserved5)(void);
|
||||||
|
void (* reserved6)(void);
|
||||||
|
void (* reserved7)(void);
|
||||||
|
void (* reserved8)(void);
|
||||||
|
void (* reserved9)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct libdecor* (* PFN_libdecor_new)(struct wl_display*,const struct libdecor_interface*);
|
||||||
|
typedef void (* PFN_libdecor_unref)(struct libdecor*);
|
||||||
|
typedef int (* PFN_libdecor_get_fd)(struct libdecor*);
|
||||||
|
typedef int (* PFN_libdecor_dispatch)(struct libdecor*,int);
|
||||||
|
typedef struct libdecor_frame* (* PFN_libdecor_decorate)(struct libdecor*,struct wl_surface*,const struct libdecor_frame_interface*,void*);
|
||||||
|
typedef void (* PFN_libdecor_frame_unref)(struct libdecor_frame*);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_app_id)(struct libdecor_frame*,const char*);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_title)(struct libdecor_frame*,const char*);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_minimized)(struct libdecor_frame*);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_fullscreen)(struct libdecor_frame*,struct wl_output*);
|
||||||
|
typedef void (* PFN_libdecor_frame_unset_fullscreen)(struct libdecor_frame*);
|
||||||
|
typedef void (* PFN_libdecor_frame_map)(struct libdecor_frame*);
|
||||||
|
typedef void (* PFN_libdecor_frame_commit)(struct libdecor_frame*,struct libdecor_state*,struct libdecor_configuration*);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_min_content_size)(struct libdecor_frame*,int,int);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_max_content_size)(struct libdecor_frame*,int,int);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_maximized)(struct libdecor_frame*);
|
||||||
|
typedef void (* PFN_libdecor_frame_unset_maximized)(struct libdecor_frame*);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
|
||||||
|
typedef void (* PFN_libdecor_frame_unset_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
|
||||||
|
typedef void (* PFN_libdecor_frame_set_visibility)(struct libdecor_frame*,bool visible);
|
||||||
|
typedef struct xdg_toplevel* (* PFN_libdecor_frame_get_xdg_toplevel)(struct libdecor_frame*);
|
||||||
|
typedef bool (* PFN_libdecor_configuration_get_content_size)(struct libdecor_configuration*,struct libdecor_frame*,int*,int*);
|
||||||
|
typedef bool (* PFN_libdecor_configuration_get_window_state)(struct libdecor_configuration*,enum libdecor_window_state*);
|
||||||
|
typedef struct libdecor_state* (* PFN_libdecor_state_new)(int,int);
|
||||||
|
typedef void (* PFN_libdecor_state_free)(struct libdecor_state*);
|
||||||
|
#define libdecor_new _glfw.wl.libdecor.libdecor_new_
|
||||||
|
#define libdecor_unref _glfw.wl.libdecor.libdecor_unref_
|
||||||
|
#define libdecor_get_fd _glfw.wl.libdecor.libdecor_get_fd_
|
||||||
|
#define libdecor_dispatch _glfw.wl.libdecor.libdecor_dispatch_
|
||||||
|
#define libdecor_decorate _glfw.wl.libdecor.libdecor_decorate_
|
||||||
|
#define libdecor_frame_unref _glfw.wl.libdecor.libdecor_frame_unref_
|
||||||
|
#define libdecor_frame_set_app_id _glfw.wl.libdecor.libdecor_frame_set_app_id_
|
||||||
|
#define libdecor_frame_set_title _glfw.wl.libdecor.libdecor_frame_set_title_
|
||||||
|
#define libdecor_frame_set_minimized _glfw.wl.libdecor.libdecor_frame_set_minimized_
|
||||||
|
#define libdecor_frame_set_fullscreen _glfw.wl.libdecor.libdecor_frame_set_fullscreen_
|
||||||
|
#define libdecor_frame_unset_fullscreen _glfw.wl.libdecor.libdecor_frame_unset_fullscreen_
|
||||||
|
#define libdecor_frame_map _glfw.wl.libdecor.libdecor_frame_map_
|
||||||
|
#define libdecor_frame_commit _glfw.wl.libdecor.libdecor_frame_commit_
|
||||||
|
#define libdecor_frame_set_min_content_size _glfw.wl.libdecor.libdecor_frame_set_min_content_size_
|
||||||
|
#define libdecor_frame_set_max_content_size _glfw.wl.libdecor.libdecor_frame_set_max_content_size_
|
||||||
|
#define libdecor_frame_set_maximized _glfw.wl.libdecor.libdecor_frame_set_maximized_
|
||||||
|
#define libdecor_frame_unset_maximized _glfw.wl.libdecor.libdecor_frame_unset_maximized_
|
||||||
|
#define libdecor_frame_set_capabilities _glfw.wl.libdecor.libdecor_frame_set_capabilities_
|
||||||
|
#define libdecor_frame_unset_capabilities _glfw.wl.libdecor.libdecor_frame_unset_capabilities_
|
||||||
|
#define libdecor_frame_set_visibility _glfw.wl.libdecor.libdecor_frame_set_visibility_
|
||||||
|
#define libdecor_frame_get_xdg_toplevel _glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_
|
||||||
|
#define libdecor_configuration_get_content_size _glfw.wl.libdecor.libdecor_configuration_get_content_size_
|
||||||
|
#define libdecor_configuration_get_window_state _glfw.wl.libdecor.libdecor_configuration_get_window_state_
|
||||||
|
#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
|
||||||
|
#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
|
||||||
|
|
||||||
typedef enum _GLFWdecorationSideWayland
|
typedef enum _GLFWdecorationSideWayland
|
||||||
{
|
{
|
||||||
mainWindow,
|
GLFW_MAIN_WINDOW,
|
||||||
topDecoration,
|
GLFW_TOP_DECORATION,
|
||||||
leftDecoration,
|
GLFW_LEFT_DECORATION,
|
||||||
rightDecoration,
|
GLFW_RIGHT_DECORATION,
|
||||||
bottomDecoration,
|
GLFW_BOTTOM_DECORATION
|
||||||
} _GLFWdecorationSideWayland;
|
} _GLFWdecorationSideWayland;
|
||||||
|
|
||||||
typedef struct _GLFWdecorationWayland
|
typedef struct _GLFWdecorationWayland
|
||||||
@@ -169,6 +287,12 @@ typedef struct _GLFWofferWayland
|
|||||||
GLFWbool text_uri_list;
|
GLFWbool text_uri_list;
|
||||||
} _GLFWofferWayland;
|
} _GLFWofferWayland;
|
||||||
|
|
||||||
|
typedef struct _GLFWscaleWayland
|
||||||
|
{
|
||||||
|
struct wl_output* output;
|
||||||
|
int factor;
|
||||||
|
} _GLFWscaleWayland;
|
||||||
|
|
||||||
// Wayland-specific per-window data
|
// Wayland-specific per-window data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWwindowWayland
|
typedef struct _GLFWwindowWayland
|
||||||
@@ -202,6 +326,11 @@ typedef struct _GLFWwindowWayland
|
|||||||
uint32_t decorationMode;
|
uint32_t decorationMode;
|
||||||
} xdg;
|
} xdg;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct libdecor_frame* frame;
|
||||||
|
int mode;
|
||||||
|
} libdecor;
|
||||||
|
|
||||||
_GLFWcursor* currentCursor;
|
_GLFWcursor* currentCursor;
|
||||||
double cursorPosX, cursorPosY;
|
double cursorPosX, cursorPosY;
|
||||||
|
|
||||||
@@ -209,15 +338,13 @@ typedef struct _GLFWwindowWayland
|
|||||||
|
|
||||||
// We need to track the monitors the window spans on to calculate the
|
// We need to track the monitors the window spans on to calculate the
|
||||||
// optimal scaling factor.
|
// optimal scaling factor.
|
||||||
int scale;
|
int contentScale;
|
||||||
_GLFWmonitor** monitors;
|
_GLFWscaleWayland* scales;
|
||||||
int monitorsCount;
|
int scaleCount;
|
||||||
int monitorsSize;
|
int scaleSize;
|
||||||
|
|
||||||
struct {
|
struct zwp_relative_pointer_v1* relativePointer;
|
||||||
struct zwp_relative_pointer_v1* relativePointer;
|
struct zwp_locked_pointer_v1* lockedPointer;
|
||||||
struct zwp_locked_pointer_v1* lockedPointer;
|
|
||||||
} pointerLock;
|
|
||||||
|
|
||||||
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
||||||
|
|
||||||
@@ -259,8 +386,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
_GLFWwindow* dragFocus;
|
_GLFWwindow* dragFocus;
|
||||||
uint32_t dragSerial;
|
uint32_t dragSerial;
|
||||||
|
|
||||||
int compositorVersion;
|
const char* tag;
|
||||||
int seatVersion;
|
|
||||||
|
|
||||||
struct wl_cursor_theme* cursorTheme;
|
struct wl_cursor_theme* cursorTheme;
|
||||||
struct wl_cursor_theme* cursorThemeHiDPI;
|
struct wl_cursor_theme* cursorThemeHiDPI;
|
||||||
@@ -270,12 +396,12 @@ typedef struct _GLFWlibraryWayland
|
|||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
uint32_t pointerEnterSerial;
|
uint32_t pointerEnterSerial;
|
||||||
|
|
||||||
int32_t keyboardRepeatRate;
|
int keyRepeatTimerfd;
|
||||||
int32_t keyboardRepeatDelay;
|
int32_t keyRepeatRate;
|
||||||
int keyboardLastKey;
|
int32_t keyRepeatDelay;
|
||||||
int keyboardLastScancode;
|
int keyRepeatScancode;
|
||||||
|
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
int timerfd;
|
|
||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
char keynames[GLFW_KEY_LAST + 1][5];
|
char keynames[GLFW_KEY_LAST + 1][5];
|
||||||
@@ -337,6 +463,38 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_wl_egl_window_destroy window_destroy;
|
PFN_wl_egl_window_destroy window_destroy;
|
||||||
PFN_wl_egl_window_resize window_resize;
|
PFN_wl_egl_window_resize window_resize;
|
||||||
} egl;
|
} egl;
|
||||||
|
|
||||||
|
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_;
|
||||||
|
PFN_libdecor_dispatch libdecor_dispatch_;
|
||||||
|
PFN_libdecor_decorate libdecor_decorate_;
|
||||||
|
PFN_libdecor_frame_unref libdecor_frame_unref_;
|
||||||
|
PFN_libdecor_frame_set_app_id libdecor_frame_set_app_id_;
|
||||||
|
PFN_libdecor_frame_set_title libdecor_frame_set_title_;
|
||||||
|
PFN_libdecor_frame_set_minimized libdecor_frame_set_minimized_;
|
||||||
|
PFN_libdecor_frame_set_fullscreen libdecor_frame_set_fullscreen_;
|
||||||
|
PFN_libdecor_frame_unset_fullscreen libdecor_frame_unset_fullscreen_;
|
||||||
|
PFN_libdecor_frame_map libdecor_frame_map_;
|
||||||
|
PFN_libdecor_frame_commit libdecor_frame_commit_;
|
||||||
|
PFN_libdecor_frame_set_min_content_size libdecor_frame_set_min_content_size_;
|
||||||
|
PFN_libdecor_frame_set_max_content_size libdecor_frame_set_max_content_size_;
|
||||||
|
PFN_libdecor_frame_set_maximized libdecor_frame_set_maximized_;
|
||||||
|
PFN_libdecor_frame_unset_maximized libdecor_frame_unset_maximized_;
|
||||||
|
PFN_libdecor_frame_set_capabilities libdecor_frame_set_capabilities_;
|
||||||
|
PFN_libdecor_frame_unset_capabilities libdecor_frame_unset_capabilities_;
|
||||||
|
PFN_libdecor_frame_set_visibility libdecor_frame_set_visibility_;
|
||||||
|
PFN_libdecor_frame_get_xdg_toplevel libdecor_frame_get_xdg_toplevel_;
|
||||||
|
PFN_libdecor_configuration_get_content_size libdecor_configuration_get_content_size_;
|
||||||
|
PFN_libdecor_configuration_get_window_state libdecor_configuration_get_window_state_;
|
||||||
|
PFN_libdecor_state_new libdecor_state_new_;
|
||||||
|
PFN_libdecor_state_free libdecor_state_free_;
|
||||||
|
} libdecor;
|
||||||
} _GLFWlibraryWayland;
|
} _GLFWlibraryWayland;
|
||||||
|
|
||||||
// Wayland-specific per-monitor data
|
// Wayland-specific per-monitor data
|
||||||
@@ -349,7 +507,7 @@ typedef struct _GLFWmonitorWayland
|
|||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int scale;
|
int contentScale;
|
||||||
} _GLFWmonitorWayland;
|
} _GLFWmonitorWayland;
|
||||||
|
|
||||||
// Wayland-specific per-cursor data
|
// Wayland-specific per-cursor data
|
||||||
@@ -366,7 +524,6 @@ typedef struct _GLFWcursorWayland
|
|||||||
|
|
||||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
||||||
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
|
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
|
||||||
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode);
|
|
||||||
|
|
||||||
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
|
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
|
||||||
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
|
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
|
||||||
|
|||||||
+622
-366
File diff suppressed because it is too large
Load Diff
+85
-22
@@ -321,6 +321,11 @@ static void updateNormalHints(_GLFWwindow* window, int width, int height)
|
|||||||
{
|
{
|
||||||
XSizeHints* hints = XAllocSizeHints();
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
|
|
||||||
|
long supplied;
|
||||||
|
XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied);
|
||||||
|
|
||||||
|
hints->flags &= ~(PMinSize | PMaxSize | PAspect);
|
||||||
|
|
||||||
if (!window->monitor)
|
if (!window->monitor)
|
||||||
{
|
{
|
||||||
if (window->resizable)
|
if (window->resizable)
|
||||||
@@ -357,9 +362,6 @@ static void updateNormalHints(_GLFWwindow* window, int width, int height)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hints->flags |= PWinGravity;
|
|
||||||
hints->win_gravity = StaticGravity;
|
|
||||||
|
|
||||||
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||||
XFree(hints);
|
XFree(hints);
|
||||||
}
|
}
|
||||||
@@ -523,6 +525,25 @@ static void updateCursorImage(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grabs the cursor and confines it to the window
|
||||||
|
//
|
||||||
|
static void captureCursor(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
|
||||||
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||||
|
GrabModeAsync, GrabModeAsync,
|
||||||
|
window->x11.handle,
|
||||||
|
None,
|
||||||
|
CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ungrabs the cursor
|
||||||
|
//
|
||||||
|
static void releaseCursor(void)
|
||||||
|
{
|
||||||
|
XUngrabPointer(_glfw.x11.display, CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
// Enable XI2 raw mouse motion events
|
// Enable XI2 raw mouse motion events
|
||||||
//
|
//
|
||||||
static void enableRawMouseMotion(_GLFWwindow* window)
|
static void enableRawMouseMotion(_GLFWwindow* window)
|
||||||
@@ -565,12 +586,7 @@ static void disableCursor(_GLFWwindow* window)
|
|||||||
&_glfw.x11.restoreCursorPosY);
|
&_glfw.x11.restoreCursorPosY);
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
_glfwCenterCursorInContentArea(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
|
captureCursor(window);
|
||||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
|
||||||
GrabModeAsync, GrabModeAsync,
|
|
||||||
window->x11.handle,
|
|
||||||
_glfw.x11.hiddenCursorHandle,
|
|
||||||
CurrentTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit disabled cursor mode for the specified window
|
// Exit disabled cursor mode for the specified window
|
||||||
@@ -581,7 +597,7 @@ static void enableCursor(_GLFWwindow* window)
|
|||||||
disableRawMouseMotion(window);
|
disableRawMouseMotion(window);
|
||||||
|
|
||||||
_glfw.x11.disabledCursorWindow = NULL;
|
_glfw.x11.disabledCursorWindow = NULL;
|
||||||
XUngrabPointer(_glfw.x11.display, CurrentTime);
|
releaseCursor();
|
||||||
_glfwPlatformSetCursorPos(window,
|
_glfwPlatformSetCursorPos(window,
|
||||||
_glfw.x11.restoreCursorPosX,
|
_glfw.x11.restoreCursorPosX,
|
||||||
_glfw.x11.restoreCursorPosY);
|
_glfw.x11.restoreCursorPosY);
|
||||||
@@ -726,7 +742,28 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
XFree(hints);
|
XFree(hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNormalHints(window, width, height);
|
// Set ICCCM WM_NORMAL_HINTS property
|
||||||
|
{
|
||||||
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
|
if (!hints)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate size hints");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wndconfig->resizable)
|
||||||
|
{
|
||||||
|
hints->flags |= (PMinSize | PMaxSize);
|
||||||
|
hints->min_width = hints->max_width = width;
|
||||||
|
hints->min_height = hints->max_height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
hints->flags |= PWinGravity;
|
||||||
|
hints->win_gravity = StaticGravity;
|
||||||
|
|
||||||
|
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||||
|
XFree(hints);
|
||||||
|
}
|
||||||
|
|
||||||
// Set ICCCM WM_CLASS property
|
// Set ICCCM WM_CLASS property
|
||||||
{
|
{
|
||||||
@@ -2044,7 +2081,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.disabledCursorWindow == window)
|
if (_glfw.x11.disabledCursorWindow == window)
|
||||||
_glfw.x11.disabledCursorWindow = NULL;
|
enableCursor(window);
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
releaseMonitor(window);
|
releaseMonitor(window);
|
||||||
@@ -2851,16 +2888,40 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
|||||||
|
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
||||||
{
|
{
|
||||||
if (mode == GLFW_CURSOR_DISABLED)
|
if (_glfwPlatformWindowFocused(window))
|
||||||
{
|
{
|
||||||
if (_glfwPlatformWindowFocused(window))
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
disableCursor(window);
|
{
|
||||||
}
|
_glfwPlatformGetCursorPos(window,
|
||||||
else if (_glfw.x11.disabledCursorWindow == window)
|
&_glfw.x11.restoreCursorPosX,
|
||||||
enableCursor(window);
|
&_glfw.x11.restoreCursorPosY);
|
||||||
else
|
_glfwCenterCursorInContentArea(window);
|
||||||
updateCursorImage(window);
|
if (window->rawMouseMotion)
|
||||||
|
enableRawMouseMotion(window);
|
||||||
|
}
|
||||||
|
else if (_glfw.x11.disabledCursorWindow == window)
|
||||||
|
{
|
||||||
|
if (window->rawMouseMotion)
|
||||||
|
disableRawMouseMotion(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
|
captureCursor(window);
|
||||||
|
else
|
||||||
|
releaseCursor();
|
||||||
|
|
||||||
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
|
_glfw.x11.disabledCursorWindow = window;
|
||||||
|
else if (_glfw.x11.disabledCursorWindow == window)
|
||||||
|
{
|
||||||
|
_glfw.x11.disabledCursorWindow = NULL;
|
||||||
|
_glfwPlatformSetCursorPos(window,
|
||||||
|
_glfw.x11.restoreCursorPosX,
|
||||||
|
_glfw.x11.restoreCursorPosY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCursorImage(window);
|
||||||
XFlush(_glfw.x11.display);
|
XFlush(_glfw.x11.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2869,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)
|
||||||
|
|||||||
+24
-14
@@ -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)
|
||||||
@@ -621,7 +631,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
glfwMakeContextCurrent(slots[i].window);
|
glfwMakeContextCurrent(slots[i].window);
|
||||||
gladLoadGL(glfwGetProcAddress);
|
gladLoadGL(glfwGetProcAddress);
|
||||||
glfwSwapInterval(1);
|
glfwSwapBuffers(slots[i].window);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Main loop starting\n");
|
printf("Main loop starting\n");
|
||||||
|
|||||||
+32
-4
@@ -230,9 +230,10 @@ static void list_vulkan_instance_layers(void)
|
|||||||
|
|
||||||
for (i = 0; i < lp_count; i++)
|
for (i = 0; i < lp_count; i++)
|
||||||
{
|
{
|
||||||
printf(" %s (v%u) \"%s\"\n",
|
printf(" %s (spec version %u.%u) \"%s\"\n",
|
||||||
lp[i].layerName,
|
lp[i].layerName,
|
||||||
lp[i].specVersion >> 22,
|
VK_VERSION_MAJOR(lp[i].specVersion),
|
||||||
|
VK_VERSION_MINOR(lp[i].specVersion),
|
||||||
lp[i].description);
|
lp[i].description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,9 +260,10 @@ static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice devi
|
|||||||
|
|
||||||
for (i = 0; i < lp_count; i++)
|
for (i = 0; i < lp_count; i++)
|
||||||
{
|
{
|
||||||
printf(" %s (v%u) \"%s\"\n",
|
printf(" %s (spec version %u.%u) \"%s\"\n",
|
||||||
lp[i].layerName,
|
lp[i].layerName,
|
||||||
lp[i].specVersion >> 22,
|
VK_VERSION_MAJOR(lp[i].specVersion),
|
||||||
|
VK_VERSION_MINOR(lp[i].specVersion),
|
||||||
lp[i].description);
|
lp[i].description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,6 +755,17 @@ int main(int argc, char** argv)
|
|||||||
if (list_extensions)
|
if (list_extensions)
|
||||||
list_context_extensions(client, major, minor);
|
list_context_extensions(client, major, minor);
|
||||||
|
|
||||||
|
glfwDestroyWindow(window);
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
|
|
||||||
|
window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
glfwTerminate();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
printf("Vulkan loader: %s\n",
|
printf("Vulkan loader: %s\n",
|
||||||
glfwVulkanSupported() ? "available" : "missing");
|
glfwVulkanSupported() ? "available" : "missing");
|
||||||
|
|
||||||
@@ -851,6 +864,19 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (re)
|
||||||
|
{
|
||||||
|
VkSurfaceKHR surface = VK_NULL_HANDLE;
|
||||||
|
|
||||||
|
if (glfwCreateWindowSurface(instance, window, NULL, &surface) == VK_SUCCESS)
|
||||||
|
{
|
||||||
|
printf("Vulkan window surface created successfully\n");
|
||||||
|
vkDestroySurfaceKHR(instance, surface, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("Failed to create Vulkan window surface\n");
|
||||||
|
}
|
||||||
|
|
||||||
free((void*) re);
|
free((void*) re);
|
||||||
|
|
||||||
gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance);
|
gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance);
|
||||||
@@ -937,6 +963,8 @@ int main(int argc, char** argv)
|
|||||||
vkDestroyInstance(instance, NULL);
|
vkDestroyInstance(instance, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glfwDestroyWindow(window);
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user