Compare commits

...

76 Commits

Author SHA1 Message Date
Camilla Löwy d3b73abba0 Add missing changelog entries
(cherry picked from commit fb0f2f92a3)
2021-10-28 13:24:20 +02:00
Camilla Löwy fbdb08c43e Fix some spelling errors in changelog
(cherry picked from commit 83d3fb08ec)
2021-10-28 13:18:38 +02:00
Camilla Löwy 71316f843c Update changelog and add credit
Related to #1980

(cherry picked from commit 999962bd2f)
2021-10-28 12:40:42 +02:00
Josh Codd 472d45c07b Cocoa: Fix deprecation of kIOMasterPortDefault
This adds a workaround for kIOMasterPortDefault having been deprecated
in favor of kIOMainPortDefault in macOS 12.0.

Closes #1980

(cherry picked from commit f75c251dec)
2021-10-28 12:39:39 +02:00
Camilla Löwy 85f37ada6d Move list of contributors to separate file
Fixes #1839

(cherry picked from commit 53d7622a3a)
2021-10-28 12:33:40 +02:00
Camilla Löwy b77a9b1d0d Fix GLFW_INCLUDE_GLEXT being ignored for glcorearb
The GLFW_INCLUDE_GLCOREARB branch was left out when GLFW_INCLUDE_GLEXT
was originally added, for reasons that are lost to history.  The current
versions of these headers seem to co-exist just fine.

Issue reported on IRC.

(cherry picked from commit 309d79376f)
2021-10-28 12:31:02 +02:00
Ioannis Tsakpinis db85858062 Fix context API checks in native access functions
(cherry picked from commit 727db55c3a)
2021-10-28 12:29:57 +02:00
Camilla Löwy ca676357c0 Win32: Remove timeGetTime fallback for timer
The performance counter API is guaranteed to succeed on Windows XP and
later so there is no need for a fallback.

This removes our last dependency on winmm.

(cherry picked from commit b6834bf2a1)
2021-10-28 12:24:38 +02:00
Camilla Löwy 4ea7485fbe Remove blank line before the end of some structs
(cherry picked from commit efe764b492)
2021-10-28 12:14:58 +02:00
Camilla Löwy 73b6754a67 Document possible native access function errors
(cherry picked from commit 983c44b255)
2021-10-28 12:13:36 +02:00
Camilla Löwy 2d3ce6eaae Make native access functions verify context API
The native access functions for context handles did not verify that the
context had been created with the same API the function was for.

This makes these functions emit GLFW_NO_WINDOW_CONTEXT on API mismatch.

(cherry picked from commit cca9008db2)
2021-10-28 12:13:19 +02:00
Camilla Löwy cec0b33ee1 Remove Doxyfile tags obsoleted by Doxygen 1.9.2
Fixes #1932
2021-10-17 20:34:05 +02:00
Camilla Löwy 9400bc9f35 Remove potentially incorrect claim
(cherry picked from commit 4be0444ee6)
2021-10-13 23:11:53 +02:00
Camilla Löwy 1a7e4da343 Fix docs for Windows monitor size calculation
This sentence was truncated by 951a9583fa
and then not updated when content scale support was added with
16bf872117.

(cherry picked from commit 6a20053102)
2021-10-13 23:11:48 +02:00
Camilla Löwy 95df61e5ed Cocoa: Fix unresponsive cursor after cursor warp
This is a companion to 157ebb80aa and
fixes the same issue for calls to glfwSetCursorPos.

Related to #1962

(cherry picked from commit 6ed5294223)
2021-10-13 23:11:00 +02:00
Ioannis Tsakpinis c32fefc6a0 Cocoa: Fix unresponsive cursor after ungrab
There is a suppression interval (0.25 seconds by default) after a call
to CGWarpMouseCursorPosition, during which local hardware events
(keyboard and mouse) are ignored. GLFW already calls
CGEventSourceSetLocalEventsSuppressionInterval with a value of 0.0, but
it doesn't help in this case, there is still a short delay before the
cursor can be moved. Moving the CGAssociateMouseAndMouseCursorPosition
call after the cursor position has been restored, fixes the issue.

Closes #1962

(cherry picked from commit 157ebb80aa)
2021-10-13 23:10:15 +02:00
Waris Boonyasiriwat 6bb5f5d59d Wayland: Fix cursor offset when shape changes
The Wayland protocol spec[1] states that set_cursor must be called
with the serial number of the enter event.  However, GLFW is passing in
the serial number of the latest received event, which does not meet the
protocol spec.

[1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer

As a result, set_cursor calls were simply ignored by the compositor.

This fix complies with the protocol more closely by specifically caching
the enter event serial, and using it for all set_cursor calls.

Fixes #1706
Closes #1899

(cherry picked from commit e7758c506d)
2021-10-13 23:06:40 +02:00
Koray Kilinc 33ff23dc07 Wayland: Fix some keys not repeating
According to the libxkbcommon documentation[1], xkb_keymap_key_repeats
requires keymap and keycode as input:

int xkb_keymap_key_repeats( struct xkb_keymap * keymap,
			    xkb_keycode_t key)

However, in inputChar in wl_input.c we are passing in xkb_keysym_t,
which was a type mismatch.

This results in some keys not repeating when they should and vice versa.

[1] https://xkbcommon.org/doc/current/group__components.html#ga9d7f998efeca98b3afc7c257bbac90a8

Closes #1908.

(cherry picked from commit 216d5e8402)
2021-09-01 19:47:59 +02:00
Camilla Löwy cf70b10692 Remove truism from end of gamepad mapping regexp
The rest of the line is guaranteed to either contain or not contain
characters.

(cherry picked from commit 7c25dff002)
2021-08-27 17:22:05 +02:00
Camilla Löwy 0a3fb9940f Simplify CMake if-statement variable references
Variables in CMake if-statements (and only in if-statements) do not need
to be explicitly dereferenced; a thing I did not always know.

(cherry picked from commit daed5edd6e)
2021-08-27 17:22:01 +02:00
Camilla Löwy c113c59926 Raise maximum known CMake version to 3.20
This has seemed to work well on all platforms for a while.

(cherry picked from commit d7b7c3b12a)
2021-08-27 17:21:27 +02:00
Camilla Löwy ffe0795e64 Name parameters for callback function types
Started adding these because of Doxygen warnings but it should have been
done regardless.

(cherry picked from commit 4e557437f2)
2021-08-27 17:20:08 +02:00
Richard Boldiš 1d7339f3fc Win32: Fix invalid preprocessor command 'warning'
The GCCism #warning had snuck into the Win32 platform code.

Merges #1953.

(cherry picked from commit 2ac7e20aaf)
2021-08-27 17:20:00 +02:00
Camilla Löwy 50b09938e7 X11: Fix function returning before cleanup
The _glfwPlatformSetWindowFloating function would return without freeing
the state array if the window was already in the requested state.

(cherry picked from commit 071d7c0f46)
2021-08-27 17:19:46 +02:00
Camilla Löwy 123643df2d Remove unneccessary quotes in CMake conditions
(cherry picked from commit 87d5646f5d)
2021-08-27 17:16:56 +02:00
Camilla Löwy ab5f006cff Update comment for msvcrt CMake option
(cherry picked from commit 9a0e88a016)
2021-08-27 17:14:15 +02:00
Camilla Löwy 74a8ba26c3 Simplify parsing of default gamepad mappings
The outer glfwUpdateGamepadMappings function is now bypassed when
parsing the default gamepad mappings.  The data in mappings.h does not
contain any comments or line breaks.  Also this is done before joystick
support has been initialized, so there is no need to look for matching
devices.

Finally, the array of default mappings is pre-allocated.  This has no
measurable performance impact but does generate a lot of calls, which
won't be nice for a user provided custom allocator to deal with.

(cherry picked from commit 201400b974)
2021-08-27 17:13:12 +02:00
Camilla Löwy 929286ca47 Update gamepad mappings from upstream
(cherry picked from commit afa78b4270)
2021-08-27 17:13:01 +02:00
Camilla Löwy d3317b4937 Add gamepad mapping filtering by backend
This fixes gamepad mappings being included in GLFW binaries that would
then never use them because they were for a different platform.

(cherry picked from commit 0c90e1a33f)
2021-08-03 16:01:03 +02:00
Camilla Löwy b3b82cdd78 Add custom target for updating gamepad mappings
(cherry picked from commit 01778329ec)
2021-08-03 16:00:30 +02:00
Camilla Löwy 20a7962a9b Improve error description for invalid scancodes
(cherry picked from commit 56092814f3)
2021-08-03 15:59:59 +02:00
Camilla Löwy 44ad296813 Expand list of distro derivatives slightly
(cherry picked from commit 3dc7349c35)
2021-08-03 15:59:24 +02:00
Camilla Löwy 1b0eac9c58 Add Fedora package names to compilation guide
(cherry picked from commit 9e1ee3f263)
2021-08-03 15:46:11 +02:00
Camilla Löwy 65c36563f6 Update changelog
Related to #1840.

(cherry picked from commit ab34cc51c6)
2021-08-03 15:43:49 +02:00
Stephen Gowen 1e98fc325d Cocoa: Fix macro redefinition warning
This avoids generating a macro redefinition warning when the
GL_SILENCE_DEPRECATION macro has been defined for the whole of a larger
project.

Closes #1840.

(cherry picked from commit 1d88a2e3d6)
2021-08-03 15:43:16 +02:00
Camilla Löwy 545b6c7970 Cocoa: Fix MoltenVK layer scale out of sync
The contents scale of the hosted CAMetalLayer created for MoltenVK was
updated only after the GLFW content scale and framebuffer size events
were emitted, causing the layer to get out of sync with the monitor the
window was on.

(cherry picked from commit 076bfd55be)
2021-08-03 15:43:03 +02:00
Camilla Löwy a7202e2341 Cocoa: Remove calls to -update on nil
These calls have no effect unless the context was created with NSGL.

(cherry picked from commit 836e709503)
2021-08-03 15:41:57 +02:00
Camilla Löwy 9a5511b311 Improve library compilation guide somewhat
Related to #1931.

(cherry picked from commit 3b95970482)
2021-08-03 14:31:31 +02:00
Camilla Löwy a18f4e50b0 Add credit
Related to #1931.

(cherry picked from commit b6f7ead3c5)
2021-08-03 14:04:52 +02:00
David V. McKay 3bf580ad1d realizing "as you would" is platform dependent
specified "for linux or unix" and added a bit about using Visual Studio on Windows.

(cherry picked from commit 1a5e07fd4b)
2021-08-03 14:04:48 +02:00
David V. McKay 014ce9c74f Clarify "as you would" for beginners.
fixes #1088

(cherry picked from commit f010d8b77d)
2021-08-03 14:04:45 +02:00
Camilla Löwy 8f0198e82e Remove errors for gamepad element mismatch
Because there are controllers in the wild using the same hardware ID
despite having different numbers of buttons and axes, an error message
was triggered that was only expected for a corrupted mapping database.

This removes the error for now, in preparation for better error handling
for gamepad mappings overall.

Fixes #1763.

(cherry picked from commit 6876cf8d7e)
2021-08-03 14:04:01 +02:00
A. Tombs bd346b64d6 Consistent subsections in compile guide
In the compile guide, the "Dependencies for Linux and OSMesa" section
looks to be one level too high in the hierarchy. I've moved it to be in
line with the similarly-named sub-sub-sections.

Closes #1923.

(cherry picked from commit 52d8347d34)
2021-08-03 14:03:20 +02:00
Camilla Löwy d61f7225d1 Wayland: Fix missing constant on FreeBSD
On FreeBSD O_CLOEXEC is only available when _POSIX_C_SOURCE >= 200809.
O_CLOEXEC is in turn required by the epollshim header.

Issue reported on IRC.

(cherry picked from commit a89fcd20d8)
2021-08-03 14:03:01 +02:00
Camilla Löwy 813edfa494 Wayland: Fix case of epollshim find module name
This fixes a warning during the configuration step of CMake.

(cherry picked from commit 5b73fc8b80)
2021-06-25 00:23:11 +02:00
Camilla Löwy b1a8bc5d69 Add missing changelog entry
Related to #1843.

(cherry picked from commit 6f7c61c6b3)
2021-06-25 00:23:11 +02:00
Camilla Löwy e04cd8283e Add notes on getting the HDC of a window on Win32
Related to #1913.

(cherry picked from commit 15e05adf67)
2021-06-25 00:23:11 +02:00
Camilla Löwy db34aea144 Fix some documentation URLs still using http:
Some URLs in the documentation were overlooked during the switch to
https: for the GLFW website.  This updates those and a few third-party
URLs.

(cherry picked from commit 787295b3af)
2021-06-25 00:23:11 +02:00
Camilla Löwy 6518847f4d Update IRC network to Libera.Chat
The `#glfw` IRC channel is moving to the Libera.Chat network due to the
recent takeover of the Freenode network.

(cherry picked from commit 78380c7761)
2021-06-25 00:23:11 +02:00
Camilla Löwy 5ecf2cbdbf Add 'latest' branch to all CI builds
With 3.4, the tip of the 'latest' branch will be a merge commit for
3.3-stable and the main branch, and not simply a fast-foward to an
already tested commit.

This sets up a tiny additional safety net before that merge.

(cherry picked from commit 3b13228650)
2021-06-25 00:23:10 +02:00
Camilla Löwy 45d1f547cd Move VS 2019 builds from AppVeyor to GH Actions
GitHub runners unfortunately do not come with MinGW or VS 2010
pre-installed, so moving those builds will be more involved.  MinGW-w64
is not a good replacement for MinGW as it is far more complete.

This gives at least some feedback for all supported platforms via the
GitHub Actions system.

(cherry picked from commit 4e788fc6dc)
2021-06-25 00:23:10 +02:00
Camilla Löwy 4e1aeb899c Add CI dependency still needed by stable branch
The main branch no longer needs the extra-cmake-modules package but the
stable branch still does.
2021-06-25 00:22:04 +02:00
Camilla Löwy 8bf39cf1f4 Migrate from Travis CI to GitHub Actions
The old Travis CI .org service has been throttled for a while now and is
said to be shutting down completely next week.

This migrates the Travis CI build jobs to GitHub Actions, with minor
changes.

- The trailing whitespace detection has been removed for now.
- The libegl1-mesa-dev dependency for Wayland has been removed as it
  appears to no longer be necessary for building.

(cherry picked from commit 5a6001a83b)
2021-06-15 18:08:32 +02:00
Camilla Löwy 45336c1104 Fix numeric conversion warnings in example
(cherry picked from commit df15a33e10)
2021-06-15 18:07:46 +02:00
Camilla Löwy 163fa83fac EGL: Fix creation of single-buffered windows
The EGL backend ignored the state of GLFW_DOUBLEBUFFER and always
created a double-buffered EGL window.

This sets the EGL_RENDER_BUFFER attribute at EGL window creation
appropriately.

Fixes #1843.

(cherry picked from commit 114776a246)
2021-06-15 18:07:38 +02:00
Camilla Löwy 6769ffcd0f Move single/double-buffer filtering to backends
There is no need to enumerate framebuffer configs that will just be
filtered out later by the GLFW_DOUBLEBUFFER hard constraint.

(cherry picked from commit fd79b02840)
2021-06-15 18:07:28 +02:00
Camilla Löwy 07c29d1c1c Skip initial buffer swap when single-buffered
This skips the buffer swap after the initial glClear performed during
window creation, if the window is single-buffered.  This call confused
apitrace into thinking the window was double-buffered.

Fixes #1873.

(cherry picked from commit 184377b493)
2021-06-15 18:06:46 +02:00
Camilla Löwy 508e24c01c Add tracking of single-/double-buffering
This adds the state part of 04f21abb52
(Make GLFW_DOUBLEBUFFER a window attribute), but without the associated
API change, because this is needed by later bug fixes that will go into
the stable branch.
2021-06-15 18:04:05 +02:00
Camilla Löwy e756ae1d85 Make monitor and joystick names static strings
Related to #478.

(cherry picked from commit da236ba807)
2021-06-09 18:37:31 +02:00
Camilla Löwy 020ce99170 Remove claim that EGL is not supported on macOS
(cherry picked from commit a39115a27b)
2021-06-09 18:36:42 +02:00
Camilla Löwy a149810df9 Clarify documentation for hints
(cherry picked from commit bbbbd3e870)
2021-06-09 18:36:13 +02:00
Camilla Löwy 2a5038e4e9 Fix header version macro descriptions in docs
(cherry picked from commit e17ffcd0db)
2021-06-09 18:33:44 +02:00
Camilla Löwy 728aaccbbb Win32: Always define UNICODE and _UNICODE
(cherry picked from commit 9a3a8bc267)
2021-06-09 18:32:24 +02:00
Camilla Löwy 52b2775c2e Win32: Fix macros being enabled for other backends
_UNICODE should not be defined for other backends even when built on
Windows.

(cherry picked from commit a646f51bca)
2021-06-09 18:32:10 +02:00
Camilla Löwy 30b02dd709 Fix description of video mode ordering in docs
The two final sorting criteria were not included in the documentation.

Fixes #1889.

(cherry picked from commit 0e9ec7788b)
2021-06-09 18:32:05 +02:00
Konstantin Podsvirov 9ef9b1361a Fix hardcoded runtime destination in CMake install
Closes #1883.
Closes #1884.

(cherry picked from commit e3f916808d)
2021-06-09 18:31:56 +02:00
Camilla Löwy 5dd6716ee9 Win32: Fix compilation with standalone LLVM
The /clang: suffix passed to Clang-CL was accidentally also passed to
the regular standalone Clang, which caused compilation to fail.  We now
pass /W3 to Clang-CL, which it interprets as -Wall.

The _CRT_SECURE_NO_WARNINGS macro is now defined for both Clang and
Clang-CL.

The /entry: flag passed to link.exe is now also passed to lld-link,
letting the windows subsystem tests and examples link.

Fixes #1807.
Closes #1824.
Closes #1874.

(cherry picked from commit 061a0263a9)
2021-06-09 18:31:39 +02:00
Camilla Löwy 3cded29c2f Replace GL_ARB_debug_output in comments
(cherry picked from commit 85bce8a8ea)
2021-06-09 18:26:39 +02:00
Camilla Löwy 583dcbcc19 Replace GL_ARB_debug_output in context guide
New code should use GL_KHR_debug instead but it's not as good an example
to use in this case as the symbols it adds has no suffixes.

(cherry picked from commit ec621a00bd)
2021-06-09 18:26:36 +02:00
Camilla Löwy bcaf8daa72 Fix grammar in MoltenVK support docs
(cherry picked from commit 4c90e21e8f)
2021-06-09 18:25:09 +02:00
Camilla Löwy 658744e222 Update USE_MSVC_RUNTIME_LIBRARY_DLL for CMake 3.15
This makes USE_MSVC_RUNTIME_LIBRARY_DLL update the directory scope
CMAKE_MSVC_RUNTIME_LIBRARY variable instead of CMAKE_C_FLAGS on CMake
3.15 and later.

Solution proposed by @moritz-h.

Fixes #1783.
Closes #1796.

(cherry picked from commit f4a7329604)
2021-06-09 18:24:31 +02:00
Camilla Löwy 713711f5e9 Start 3.3.5 2021-04-08 20:48:17 +02:00
Camilla Löwy 814b7929c5 Add issue number to changelog
Related to #1863.

(cherry picked from commit 33cd8b865d)
2021-03-21 23:23:17 +01:00
Camilla Löwy b39c02b118 Win32: Add warning when option will have no effect
The GPU driver only looks in the executable for the symbol requesting
the high-performance GPU, so enabling them when buidling GLFW as a DLL
will have no effect.

(cherry picked from commit 52ba8c7f07)
2021-03-21 23:23:17 +01:00
Camilla Löwy 0f46d089e8 X11: Fix attribs not applied on leaving fullscreen
If the GLFW_DECORATED and/or GLFW_FLOATING window attributes were
changed while in fullscreen mode, the changes did not take effect when
the window entered windowed mode.

Bug reported on the GLFW forum.
https://discourse.glfw.org/t/turning-on-off-window-decorations-while-in-full-screen-wont-work-properly/1780

(cherry picked from commit 4afa227a05)
2021-03-19 16:18:12 +01:00
Camilla Löwy b8202d9ca3 Start 3.3.4 2021-02-23 21:23:46 +01:00
58 changed files with 1811 additions and 1189 deletions
+3 -16
View File
@@ -1,10 +1,10 @@
image: image:
- Visual Studio 2015 - Visual Studio 2015
- Visual Studio 2019
branches: branches:
only: only:
- ci - ci
- master - master
- latest
- 3.3-stable - 3.3-stable
skip_tags: true skip_tags: true
environment: environment:
@@ -21,26 +21,13 @@ environment:
- GENERATOR: Visual Studio 10 2010 - GENERATOR: Visual Studio 10 2010
BUILD_SHARED_LIBS: OFF BUILD_SHARED_LIBS: OFF
CFLAGS: /WX CFLAGS: /WX
- GENERATOR: Visual Studio 16 2019
BUILD_SHARED_LIBS: ON
CFLAGS: /WX
- GENERATOR: Visual Studio 16 2019
BUILD_SHARED_LIBS: OFF
CFLAGS: /WX
matrix: matrix:
fast_finish: true fast_finish: true
exclude:
- image: Visual Studio 2015
GENERATOR: Visual Studio 16 2019
- image: Visual Studio 2019
GENERATOR: Visual Studio 10 2010
- image: Visual Studio 2019
GENERATOR: MinGW Makefiles
for: for:
- -
matrix: matrix:
except: only:
- GENERATOR: Visual Studio 10 2010 - GENERATOR: MinGW Makefiles
build_script: build_script:
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin% - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
+116
View File
@@ -0,0 +1,116 @@
name: Build
on:
pull_request:
push:
branches: [ ci, master, latest, 3.3-stable ]
permissions:
statuses: write
contents: read
jobs:
build-linux-x11-clang:
name: X11 (Linux, Clang)
runs-on: ubuntu-latest
env:
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- name: Configure static library
run: cmake -S . -B build-static
- name: Build static library
run: cmake --build build-static --parallel
- name: Configure shared library
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel
build-linux-wayland-clang:
name: Wayland (Linux, Clang)
runs-on: ubuntu-latest
env:
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev extra-cmake-modules
- name: Configure static library
run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON
- name: Build static library
run: cmake --build build-static --parallel
- name: Configure shared library
run: cmake -S . -B build-shared -D GLFW_USE_WAYLAND=ON -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel
build-linux-null-clang:
name: Null (Linux, Clang)
runs-on: ubuntu-latest
env:
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install libosmesa6-dev
- name: Configure static library
run: cmake -S . -B build-static -D GLFW_USE_OSMESA=ON
- name: Build static library
run: cmake --build build-static --parallel
- name: Configure shared library
run: cmake -S . -B build-shared -D GLFW_USE_OSMESA=ON -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel
build-macos-cocoa-clang:
name: Cocoa (macOS, Clang)
runs-on: macos-latest
env:
CFLAGS: -Werror
MACOSX_DEPLOYMENT_TARGET: 10.8
steps:
- uses: actions/checkout@v2
- name: Configure static library
run: cmake -S . -B build-static
- name: Build static library
run: cmake --build build-static --parallel
- name: Configure shared library
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel
build-windows-win32-vs2019:
name: Win32 (Windows, VS2019)
runs-on: windows-latest
env:
CFLAGS: /WX
steps:
- uses: actions/checkout@v2
- name: Configure static library
run: cmake -S . -B build-static -G "Visual Studio 16 2019"
- name: Build static library
run: cmake --build build-static --parallel
- name: Configure shared library
run: cmake -S . -B build-shared -G "Visual Studio 16 2019" -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel
-114
View File
@@ -1,114 +0,0 @@
language: c
compiler: clang
branches:
only:
- ci
- master
- 3.3-stable
matrix:
include:
- os: linux
dist: xenial
name: "X11 shared library"
addons:
apt:
packages:
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev
env:
- BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror
- os: linux
dist: xenial
name: "X11 static library"
addons:
apt:
packages:
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev
env:
- BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror
- os: linux
dist: focal
name: "Wayland shared library"
addons:
apt:
packages:
- extra-cmake-modules
- wayland-protocols
- libwayland-dev
- libxkbcommon-dev
- libegl1-mesa-dev
env:
- USE_WAYLAND=ON
- BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror
- os: linux
dist: focal
name: "Wayland static library"
addons:
apt:
packages:
- extra-cmake-modules
- wayland-protocols
- libwayland-dev
- libxkbcommon-dev
- libegl1-mesa-dev
env:
- USE_WAYLAND=ON
- BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror
- os: linux
dist: bionic
name: "Null shared library"
addons:
apt:
packages:
- libosmesa6-dev
env:
- BUILD_SHARED_LIBS=ON
- USE_OSMESA=ON
- CFLAGS=-Werror
- os: linux
dist: bionic
name: "Null static library"
addons:
apt:
packages:
- libosmesa6-dev
env:
- BUILD_SHARED_LIBS=OFF
- USE_OSMESA=ON
- CFLAGS=-Werror
- os: osx
name: "Cocoa shared library"
env:
- BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror
- MACOSX_DEPLOYMENT_TARGET=10.8
- os: osx
name: "Cocoa static library"
env:
- BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror
- MACOSX_DEPLOYMENT_TARGET=10.8
script:
- if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then
echo Trailing whitespace found, aborting;
exit 1;
fi
- mkdir build
- cd build
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} -DGLFW_USE_OSMESA=${USE_OSMESA} ..
- cmake --build .
notifications:
email:
recipients:
- ci@glfw.org
on_success: never
on_failure: always
+17 -2
View File
@@ -23,8 +23,23 @@ endif()
file(STRINGS "${source_path}" lines) file(STRINGS "${source_path}" lines)
foreach(line ${lines}) foreach(line ${lines})
if ("${line}" MATCHES "^[0-9a-fA-F].*$") if (line MATCHES "^[0-9a-fA-F]")
set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n") if (line MATCHES "platform:Windows")
if (GLFW_WIN32_MAPPINGS)
set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\n")
endif()
set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\"${line}\",")
elseif (line MATCHES "platform:Mac OS X")
if (GLFW_COCOA_MAPPINGS)
set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\n")
endif()
set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\"${line}\",")
elseif (line MATCHES "platform:Linux")
if (GLFW_LINUX_MAPPINGS)
set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\n")
endif()
set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\"${line}\",")
endif()
endif() endif()
endforeach() endforeach()
+1 -1
View File
@@ -13,5 +13,5 @@ if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS)
mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES) mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)
+12 -7
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
project(GLFW VERSION 3.3.3 LANGUAGES C) project(GLFW VERSION 3.3.5 LANGUAGES C)
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
@@ -67,7 +67,8 @@ if (GLFW_BUILD_DOCS)
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set compiler specific flags # Apply Microsoft C runtime library option
# This is here because it also applies to tests and examples
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (MSVC) if (MSVC)
if (MSVC90) if (MSVC90)
@@ -80,22 +81,26 @@ if (MSVC)
# Workaround for VS 2008 not shipping with stdint.h # Workaround for VS 2008 not shipping with stdint.h
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008") list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
endif() endif()
endif()
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
if (CMAKE_VERSION VERSION_LESS 3.15)
foreach (flag CMAKE_C_FLAGS foreach (flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO) CMAKE_C_FLAGS_RELWITHDEBINFO)
if (${flag} MATCHES "/MD") if (flag MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif() endif()
if (${flag} MATCHES "/MDd") if (flag MATCHES "/MDd")
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
endif() endif()
endforeach() endforeach()
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif() endif()
endif() endif()
@@ -264,7 +269,7 @@ if (_GLFW_WAYLAND)
check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H) check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H)
check_function_exists(memfd_create HAVE_MEMFD_CREATE) check_function_exists(memfd_create HAVE_MEMFD_CREATE)
if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(EpollShim) find_package(EpollShim)
if (EPOLLSHIM_FOUND) if (EPOLLSHIM_FOUND)
list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}") list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}")
+220
View File
@@ -0,0 +1,220 @@
# Acknowledgements
GLFW exists because people around the world donated their time and lent their
skills. This list only includes contributions to the main repository and
excludes other invaluable contributions like language bindings and text and
video tutorials.
- Bobyshev Alexander
- Laurent Aphecetche
- Matt Arsenault
- ashishgamedev
- David Avedissian
- Keith Bauer
- John Bartholomew
- Coşku Baş
- Niklas Behrens
- Andrew Belt
- Nevyn Bengtsson
- Niklas Bergström
- Denis Bernard
- Doug Binks
- blanco
- Waris Boonyasiriwat
- Kyle Brenneman
- Rok Breulj
- Kai Burjack
- Martin Capitanio
- Nicolas Caramelli
- David Carlier
- Arturo Castro
- Chi-kwan Chan
- Joseph Chua
- Ian Clarkson
- Michał Cichoń
- Lambert Clara
- Anna Clarke
- Josh Codd
- Yaron Cohen-Tal
- Omar Cornut
- Andrew Corrigan
- Bailey Cosier
- Noel Cower
- CuriouserThing
- Jason Daly
- Jarrod Davis
- Olivier Delannoy
- Paul R. Deppe
- Michael Dickens
- Роман Донченко
- Mario Dorn
- Wolfgang Draxinger
- Jonathan Dummer
- Ralph Eastwood
- Fredrik Ehnbom
- Robin Eklind
- Siavash Eliasi
- TheExileFox
- Felipe Ferreira
- Michael Fogleman
- Gerald Franz
- Mário Freitas
- GeO4d
- Marcus Geelnard
- Charles Giessen
- Ryan C. Gordon
- Stephen Gowen
- Kovid Goyal
- Eloi Marín Gratacós
- Stefan Gustavson
- Jonathan Hale
- hdf89shfdfs
- Sylvain Hellegouarch
- Matthew Henry
- heromyth
- Lucas Hinderberger
- Paul Holden
- Warren Hu
- Charles Huber
- IntellectualKitty
- Aaron Jacobs
- Erik S. V. Jansson
- Toni Jovanoski
- Arseny Kapoulkine
- Cem Karan
- Osman Keskin
- Koray Kilinc
- Josh Kilmer
- Byunghoon Kim
- Cameron King
- Peter Knut
- Christoph Kubisch
- Yuri Kunde Schlesner
- Rokas Kupstys
- Konstantin Käfer
- Eric Larson
- Francis Lecavalier
- Jong Won Lee
- Robin Leffmann
- Glenn Lewis
- Shane Liesegang
- Anders Lindqvist
- Leon Linhart
- Marco Lizza
- Eyal Lotem
- Aaron Loucks
- Luflosi
- lukect
- Tristam MacDonald
- Hans Mackowiak
- Дмитри Малышев
- Zbigniew Mandziejewicz
- Adam Marcus
- Célestin Marot
- Kyle McDonald
- David V. McKay
- David Medlock
- Bryce Mehring
- Jonathan Mercier
- Marcel Metz
- Liam Middlebrook
- Ave Milia
- Jonathan Miller
- Kenneth Miller
- Bruce Mitchener
- Jack Moffitt
- Jeff Molofee
- Alexander Monakov
- Pierre Morel
- Jon Morton
- Pierre Moulon
- Martins Mozeiko
- Julian Møller
- ndogxj
- Kristian Nielsen
- Kamil Nowakowski
- onox
- Denis Ovod
- Ozzy
- Andri Pálsson
- Peoro
- Braden Pellett
- Christopher Pelloux
- Arturo J. Pérez
- Vladimir Perminov
- Anthony Pesch
- Orson Peters
- Emmanuel Gil Peyrot
- Cyril Pichard
- Keith Pitt
- Stanislav Podgorskiy
- Konstantin Podsvirov
- Nathan Poirier
- Alexandre Pretyman
- Pablo Prietz
- przemekmirek
- pthom
- Guillaume Racicot
- Philip Rideout
- Eddie Ringle
- Max Risuhin
- Jorge Rodriguez
- Luca Rood
- Ed Ropple
- Aleksey Rybalkin
- Mikko Rytkönen
- Riku Salminen
- Brandon Schaefer
- Sebastian Schuberth
- Christian Sdunek
- Matt Sealey
- Steve Sexton
- Arkady Shapkin
- Ali Sherief
- Yoshiki Shibukawa
- Dmitri Shuralyov
- Daniel Skorupski
- Bradley Smith
- Cliff Smolinsky
- Patrick Snape
- Erlend Sogge Heggen
- Julian Squires
- Johannes Stein
- Pontus Stenetorp
- Michael Stocker
- Justin Stoecker
- Elviss Strazdins
- Paul Sultana
- Nathan Sweet
- TTK-Bandit
- Sergey Tikhomirov
- Arthur Tombs
- Ioannis Tsakpinis
- Samuli Tuomola
- Matthew Turner
- urraka
- Elias Vanderstuyft
- Stef Velzel
- Jari Vetoniemi
- Ricardo Vieira
- Nicholas Vitovitch
- Simon Voordouw
- Corentin Wallez
- Torsten Walluhn
- Patrick Walton
- Xo Wang
- Jay Weisskopf
- Frank Wille
- Richard A. Wilkes
- Tatsuya Yatagawa
- Ryogo Yoshimura
- Lukas Zanner
- Andrey Zholos
- Aihui Zhu
- Santi Zupancic
- Jonas Ådahl
- Lasse Öörni
- Leonard König
- All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement
+39 -268
View File
@@ -1,6 +1,6 @@
# GLFW # GLFW
[![Build status](https://travis-ci.org/glfw/glfw.svg?branch=master)](https://travis-ci.org/glfw/glfw) [![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions)
[![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw) [![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw)
[![Coverity Scan](https://scan.coverity.com/projects/4884/badge.svg)](https://scan.coverity.com/projects/glfw-glfw) [![Coverity Scan](https://scan.coverity.com/projects/4884/badge.svg)](https://scan.coverity.com/projects/glfw-glfw)
@@ -14,18 +14,18 @@ GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On
Linux both X11 and Wayland are supported. Linux both X11 and Wayland are supported.
GLFW is licensed under the [zlib/libpng GLFW is licensed under the [zlib/libpng
license](http://www.glfw.org/license.html). license](https://www.glfw.org/license.html).
You can [download](http://www.glfw.org/download.html) the latest stable release You can [download](https://www.glfw.org/download.html) the latest stable release
as source or Windows binaries, or fetch the `latest` branch from GitHub. Each as source or Windows binaries, or fetch the `latest` branch from GitHub. Each
release starting with 3.0 also has a corresponding [annotated release starting with 3.0 also has a corresponding [annotated
tag](https://github.com/glfw/glfw/releases) with source and binary archives. tag](https://github.com/glfw/glfw/releases) with source and binary archives.
The [documentation](http://www.glfw.org/docs/latest/) is available online and is The [documentation](https://www.glfw.org/docs/latest/) is available online and is
included in all source and binary archives. See the [release included in all source and binary archives. See the [release
notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and
deprecations in the latest release. For more details see the [version deprecations in the latest release. For more details see the [version
history](http://www.glfw.org/changelog.html). history](https://www.glfw.org/changelog.html).
The `master` branch is the stable integration branch and _should_ always compile The `master` branch is the stable integration branch and _should_ always compile
and run on all supported platforms, although details of newly added features may and run on all supported platforms, although details of newly added features may
@@ -34,11 +34,16 @@ fixes live in [other branches](https://github.com/glfw/glfw/branches/all) until
they are stable enough to merge. they are stable enough to merge.
If you are new to GLFW, you may find the If you are new to GLFW, you may find the
[tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If [tutorial](https://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If
you have used GLFW 2 in the past, there is a [transition you have used GLFW 2 in the past, there is a [transition
guide](http://www.glfw.org/docs/latest/moving.html) for moving to the GLFW guide](https://www.glfw.org/docs/latest/moving.html) for moving to the GLFW
3 API. 3 API.
GLFW exists because of the contributions of [many people](CONTRIBUTORS.md)
around the world, whether by reporting bugs, providing community support, adding
features, reviewing or testing code, debugging, proofreading docs, suggesting
features or fixing bugs.
## Compiling GLFW ## Compiling GLFW
@@ -52,16 +57,16 @@ MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
and Clang. It will likely compile in other environments as well, but this is and Clang. It will likely compile in other environments as well, but this is
not regularly tested. not regularly tested.
There are [pre-compiled Windows binaries](http://www.glfw.org/download.html) There are [pre-compiled Windows binaries](https://www.glfw.org/download.html)
available for all supported compilers. available for all supported compilers.
See the [compilation guide](http://www.glfw.org/docs/latest/compile.html) for See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
more information about how to compile GLFW yourself. more information about how to compile GLFW yourself.
## Using GLFW ## Using GLFW
See the [documentation](http://www.glfw.org/docs/latest/) for tutorials, guides See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides
and the API reference. and the API reference.
@@ -79,7 +84,7 @@ Unix-like systems running the X Window System are supported even without
a desktop environment or modern extensions, although some features require a desktop environment or modern extensions, although some features require
a running window or clipboard manager. The OSMesa backend requires Mesa 6.3. a running window or clipboard manager. The OSMesa backend requires Mesa 6.3.
See the [compatibility guide](http://www.glfw.org/docs/latest/compat.html) See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html)
in the documentation for more information. in the documentation for more information.
@@ -104,7 +109,7 @@ located in the `deps/` directory.
- [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI - [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can
find that tool. find that tool.
@@ -118,57 +123,36 @@ information on what to include when reporting a bug.
## Changelog ## Changelog
- Bugfix: Some extension loader headers did not prevent default OpenGL header - Updated gamepad mappings from upstream
inclusion (#1695) - Bugfix: Buffers were swapped at creation on single-buffered windows (#1873)
- [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are - Bugfix: Gamepad mapping updates could spam `GLFW_INVALID_VALUE` due to
opaque (#1512) incompatible controllers sharing hardware ID (#1763)
- [Win32] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 - Bugfix: Native access functions for context handles did not check that the API matched
- [Win32] Bugfix: Monitor functions could return invalid values after - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
configuration change (#1761) later (#1783,#1796)
- [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775) - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
- [Win32] Bugfix: Duplicate size events were not filtered (#1610) - [Cocoa] Bugfix: The MoltenVK layer contents scale was updated only after
- [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes related events were emitted
(#1582) - [Cocoa] Bugfix: Moving the cursor programmatically would freeze it for
- [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than a fraction of a second (#1962)
Windows 10 version 1703 (#1511) - [Cocoa] Bugfix: `kIOMasterPortDefault` was deprecated in macOS 12.0 (#1980)
- [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [X11] Bugfix: Changing `GLFW_FLOATING` could leak memory
- [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 - [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908)
(#1635) - [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899)
- [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays - [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
could leak memory - [NSGL] Bugfix: Defining `GL_SILENCE_DEPRECATION` externally caused
- [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787) a duplicate definition warning (#1840)
- [Cocoa] Bugfix: Duplicate video modes were not filtered out (#1830) - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
- [Cocoa] Bugfix: Menubar was not clickable on macOS 10.15+ until it lost and
regained focus (#1648,#1802)
- [Cocoa] Bugfix: Monitor name query could segfault on macOS 11 (#1809,#1833)
- [Cocoa] Bugfix: The install name of the installed dylib was relative (#1504)
- [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
- [X11] Bugfix: Xlib errors caused by other parts of the application could be
reported as GLFW errors
- [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633)
- [X11] Bugfix: XKB path used keysyms instead of physical locations for
non-printable keys (#1598)
- [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout
combinaitons (#1598)
- [X11] Bugfix: Keys pressed simultaneously with others were not always
reported (#1112,#1415,#1472,#1616)
- [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704)
- [Wayland] Bugfix: Retrieving partial framebuffer size would segfault
- [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms
(#1463)
- [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong worder
(#1798)
- [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792)
## Contact ## Contact
On [glfw.org](http://www.glfw.org/) you can find the latest version of GLFW, as On [glfw.org](https://www.glfw.org/) you can find the latest version of GLFW, as
well as news, documentation and other information about the project. well as news, documentation and other information about the project.
If you have questions related to the use of GLFW, we have a If you have questions related to the use of GLFW, we have a
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on [forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
[Freenode](http://freenode.net/). [Libera.Chat](https://libera.chat/).
If you have a bug to report, a patch to submit or a feature you'd like to If you have a bug to report, a patch to submit or a feature you'd like to
request, please file it in the request, please file it in the
@@ -177,216 +161,3 @@ request, please file it in the
Finally, if you're interested in helping out with the development of GLFW or Finally, if you're interested in helping out with the development of GLFW or
porting it to your favorite platform, join us on the forum, GitHub or IRC. porting it to your favorite platform, join us on the forum, GitHub or IRC.
## Acknowledgements
GLFW exists because people around the world donated their time and lent their
skills.
- Bobyshev Alexander
- Laurent Aphecetche
- Matt Arsenault
- ashishgamedev
- David Avedissian
- Keith Bauer
- John Bartholomew
- Coşku Baş
- Niklas Behrens
- Andrew Belt
- Nevyn Bengtsson
- Niklas Bergström
- Denis Bernard
- Doug Binks
- blanco
- Kyle Brenneman
- Rok Breulj
- Kai Burjack
- Martin Capitanio
- Nicolas Caramelli
- David Carlier
- Arturo Castro
- Chi-kwan Chan
- Ian Clarkson
- Michał Cichoń
- Lambert Clara
- Anna Clarke
- Yaron Cohen-Tal
- Omar Cornut
- Andrew Corrigan
- Bailey Cosier
- Noel Cower
- Jason Daly
- Jarrod Davis
- Olivier Delannoy
- Paul R. Deppe
- Michael Dickens
- Роман Донченко
- Mario Dorn
- Wolfgang Draxinger
- Jonathan Dummer
- Ralph Eastwood
- Fredrik Ehnbom
- Robin Eklind
- Siavash Eliasi
- Felipe Ferreira
- Michael Fogleman
- Gerald Franz
- Mário Freitas
- GeO4d
- Marcus Geelnard
- Charles Giessen
- Ryan C. Gordon
- Stephen Gowen
- Kovid Goyal
- Eloi Marín Gratacós
- Stefan Gustavson
- Jonathan Hale
- hdf89shfdfs
- Sylvain Hellegouarch
- Matthew Henry
- heromyth
- Lucas Hinderberger
- Paul Holden
- Warren Hu
- Charles Huber
- IntellectualKitty
- Aaron Jacobs
- Erik S. V. Jansson
- Toni Jovanoski
- Arseny Kapoulkine
- Cem Karan
- Osman Keskin
- Josh Kilmer
- Byunghoon Kim
- Cameron King
- Peter Knut
- Christoph Kubisch
- Yuri Kunde Schlesner
- Rokas Kupstys
- Konstantin Käfer
- Eric Larson
- Francis Lecavalier
- Jong Won Lee
- Robin Leffmann
- Glenn Lewis
- Shane Liesegang
- Anders Lindqvist
- Leon Linhart
- Marco Lizza
- Eyal Lotem
- Aaron Loucks
- Luflosi
- lukect
- Tristam MacDonald
- Hans Mackowiak
- Дмитри Малышев
- Zbigniew Mandziejewicz
- Adam Marcus
- Célestin Marot
- Kyle McDonald
- David Medlock
- Bryce Mehring
- Jonathan Mercier
- Marcel Metz
- Liam Middlebrook
- Ave Milia
- Jonathan Miller
- Kenneth Miller
- Bruce Mitchener
- Jack Moffitt
- Jeff Molofee
- Alexander Monakov
- Pierre Morel
- Jon Morton
- Pierre Moulon
- Martins Mozeiko
- Julian Møller
- ndogxj
- Kristian Nielsen
- Kamil Nowakowski
- onox
- Denis Ovod
- Ozzy
- Andri Pálsson
- Peoro
- Braden Pellett
- Christopher Pelloux
- Arturo J. Pérez
- Vladimir Perminov
- Anthony Pesch
- Orson Peters
- Emmanuel Gil Peyrot
- Cyril Pichard
- Keith Pitt
- Stanislav Podgorskiy
- Konstantin Podsvirov
- Nathan Poirier
- Alexandre Pretyman
- Pablo Prietz
- przemekmirek
- pthom
- Guillaume Racicot
- Philip Rideout
- Eddie Ringle
- Max Risuhin
- Jorge Rodriguez
- Luca Rood
- Ed Ropple
- Aleksey Rybalkin
- Mikko Rytkönen
- Riku Salminen
- Brandon Schaefer
- Sebastian Schuberth
- Christian Sdunek
- Matt Sealey
- Steve Sexton
- Arkady Shapkin
- Ali Sherief
- Yoshiki Shibukawa
- Dmitri Shuralyov
- Daniel Skorupski
- Bradley Smith
- Cliff Smolinsky
- Patrick Snape
- Erlend Sogge Heggen
- Julian Squires
- Johannes Stein
- Pontus Stenetorp
- Michael Stocker
- Justin Stoecker
- Elviss Strazdins
- Paul Sultana
- Nathan Sweet
- TTK-Bandit
- Sergey Tikhomirov
- Arthur Tombs
- Ioannis Tsakpinis
- Samuli Tuomola
- Matthew Turner
- urraka
- Elias Vanderstuyft
- Stef Velzel
- Jari Vetoniemi
- Ricardo Vieira
- Nicholas Vitovitch
- Simon Voordouw
- Corentin Wallez
- Torsten Walluhn
- Patrick Walton
- Xo Wang
- Waris
- Jay Weisskopf
- Frank Wille
- Richard A. Wilkes
- Tatsuya Yatagawa
- Ryogo Yoshimura
- Lukas Zanner
- Andrey Zholos
- Aihui Zhu
- Santi Zupancic
- Jonas Ådahl
- Lasse Öörni
- Leonard König
- All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement
+1 -1
View File
@@ -24,7 +24,7 @@ section](https://discourse.glfw.org/c/support) of the forum, under the [Stack
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
Stack Exchange or in the IRC channel `#glfw` on Stack Exchange or in the IRC channel `#glfw` on
[Freenode](http://freenode.net/). [Libera.Chat](https://libera.chat/).
Questions about the design or implementation of GLFW or about future plans Questions about the design or implementation of GLFW or about future plans
should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
-20
View File
@@ -208,13 +208,6 @@ ALIASES = "thread_safety=@par Thread safety^^" \
"macos=__macOS:__" \ "macos=__macOS:__" \
"linux=__Linux:__" "linux=__Linux:__"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding
# "class=itcl::class" will allow you to use the command class in the
# itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C. # sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list # For instance, some of the names that are used will be different. The list
@@ -854,12 +847,6 @@ VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all # In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index. # classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that # The IGNORE_PREFIX tag can be used to specify one or more prefixes that
@@ -1367,13 +1354,6 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO LATEX_HIDE_INDICES = NO
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the # The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
# http://en.wikipedia.org/wiki/BibTeX for more info. # http://en.wikipedia.org/wiki/BibTeX for more info.
+2 -2
View File
@@ -1,11 +1,11 @@
# Support resources # Support resources
See the [latest documentation](http://www.glfw.org/docs/latest/) for tutorials, See the [latest documentation](https://www.glfw.org/docs/latest/) for tutorials,
guides and the API reference. guides and the API reference.
If you have questions about using GLFW, we have a If you have questions about using GLFW, we have a
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on [forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
[Freenode](http://freenode.net/). [Libera.Chat](https://libera.chat/).
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues). Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
Please check the [contribution Please check the [contribution
+206 -131
View File
@@ -10,165 +10,171 @@ build applications that use GLFW, see @ref build_guide.
@section compile_cmake Using CMake @section compile_cmake Using CMake
@note GLFW behaves like most other libraries that use CMake so this guide mostly
describes the basic configure/generate/compile sequence. If you are already
familiar with this from other projects, you may want to focus on the @ref
compile_deps and @ref compile_options sections for GLFW-specific information.
GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles
for a particular development environment. If you are on a Unix-like system such for your chosen development environment. To compile GLFW, first generate these
as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or files with CMake and then use them to compile the GLFW library.
Homebrew, you can install its CMake package. If not, you can download
installers for Windows and macOS from the
[CMake website](https://cmake.org/).
@note CMake only generates project files or makefiles. It does not compile the If you are on Windows and macOS you can
actual GLFW library. To compile GLFW, first generate these files for your [download CMake](https://cmake.org/download/) from their site.
chosen development environment and then use them to compile the actual GLFW
library. If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have
a package system like Fink, MacPorts or Homebrew, you can install its CMake
package.
CMake is a complex tool and this guide will only show a few of the possible ways
to set up and compile GLFW. The CMake project has their own much more detailed
[CMake user guide](https://cmake.org/cmake/help/latest/guide/user-interaction/)
that includes everything in this guide not specific to GLFW. It may be a useful
companion to this one.
@subsection compile_deps Dependencies @subsection compile_deps Installing dependencies
Once you have installed CMake, make sure that all other dependencies are The C/C++ development environments in Visual Studio, Xcode and MinGW come with
available. On some platforms, GLFW needs a few additional packages to be all necessary dependencies for compiling GLFW, but on Unix-like systems like
installed. See the section for your chosen platform and development environment Linux and FreeBSD you will need a few extra packages.
below.
@subsubsection compile_deps_msvc Dependencies for Visual C++ on Windows @subsubsection compile_deps_x11 Dependencies for X11 on Unix-like systems
The Windows SDK bundled with Visual C++ already contains all the necessary To compile GLFW for X11, you need to have the X11 development packages
headers, link libraries and tools except for CMake. Move on to @ref installed. They are not needed to build or run programs that use GLFW.
compile_generate.
On Debian and derivates like Ubuntu and Linux Mint the `xorg-dev` meta-package
@subsubsection compile_deps_mingw Dependencies for MinGW or MinGW-w64 on Windows pulls in the development packages for all of X11.
Both the MinGW and the MinGW-w64 packages already contain all the necessary
headers, link libraries and tools except for CMake. Move on to @ref
compile_generate.
@subsubsection compile_deps_mingw_cross Dependencies for MinGW or MinGW-w64 cross-compilation
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
like Ubuntu have the `mingw-w64` package for both.
GLFW has CMake toolchain files in the `CMake/` directory that set up
cross-compilation of Windows binaries. To use these files you add an option
when running `cmake` to generate the project files or makefiles:
@code{.sh} @code{.sh}
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> . sudo apt install xorg-dev
@endcode @endcode
The exact toolchain file to use depends on the prefix used by the MinGW or On Fedora and derivatives like Red Hat the X11 extension packages
MinGW-w64 binaries on your system. You can usually see this in the /usr `libXcursor-devel`, `libXi-devel`, `libXinerama-devel` and `libXrandr-devel`
directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages required by GLFW pull in all its other dependencies.
have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct
invocation would be:
@code{.sh} @code{.sh}
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake . sudo dnf install libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
@endcode @endcode
For more details see the article On FreeBSD the X11 headers are installed along the end-user X11 packages, so if
[CMake Cross Compiling](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling) on you have an X server running you should have the headers as well. If not,
the CMake wiki. install the `xorgproto` package.
Once you have this set up, move on to @ref compile_generate. @code{.sh}
pkg install xorgproto
@endcode
On Cygwin the `xorgproto` package in the Devel section of the GUI installer will
install the headers and other development related files for all of X11.
Once you have the required depdendencies, move on to @ref compile_generate.
@subsubsection compile_deps_xcode Dependencies for Xcode on macOS @subsubsection compile_deps_wayland Dependencies for Wayland on Unix-like systems
Xcode comes with all necessary tools except for CMake. The required headers To compile GLFW for Wayland, you need to have the Wayland and xkbcommon
and libraries are included in the core macOS frameworks. Xcode can be development packages installed. They are not needed to build or run programs
downloaded from the Mac App Store or from the ADC Member Center. that use GLFW.
Once you have Xcode installed, move on to @ref compile_generate. On Debian and derivates like Ubuntu and Linux Mint you will need the `libwayland-dev`,
`libxkbcommon-dev`, `wayland-protocols` and `extra-cmake-modules` packages.
@code{.sh}
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
@endcode
@subsubsection compile_deps_x11 Dependencies for Linux and X11 On Fedora and derivatives like Red Hat you will need the `wayland-devel`,
`libxkbcommon-devel`, `wayland-protocols-devel` and `extra-cmake-modules` packages.
To compile GLFW for X11, you need to have the X11 packages installed, as well as @code{.sh}
the basic development tools like GCC and make. For example, on Ubuntu and other sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules
distributions based on Debian GNU/Linux, you need to install the `xorg-dev` @endcode
package, which pulls in all X.org header packages.
Once you have installed the necessary packages, move on to @ref On FreeBSD you will need the `wayland`, `libxkbcommon`, `wayland-protocols` and
compile_generate. `kf5-extra-cmake-modules` packages.
@code{.sh}
pkg install wayland libxkbcommon wayland-protocols kf5-extra-cmake-modules
@endcode
@subsubsection compile_deps_wayland Dependencies for Linux and Wayland Once you have the required depdendencies, move on to @ref compile_generate.
To compile GLFW for Wayland, you need to have the Wayland packages installed,
as well as the basic development tools like GCC and make. For example, on
Ubuntu and other distributions based on Debian GNU/Linux, you need to install
the `libwayland-dev` package, which contains all Wayland headers and pulls in
wayland-scanner, as well as the `wayland-protocols` and `extra-cmake-modules`
packages.
Once you have installed the necessary packages, move on to @ref
compile_generate.
@subsection compile_deps_osmesa Dependencies for Linux and OSMesa
To compile GLFW for OSMesa, you need to install the OSMesa library and header
packages. For example, on Ubuntu and other distributions based on Debian
GNU/Linux, you need to install the `libosmesa6-dev` package. The OSMesa library
is required at runtime for context creation and is loaded on demand.
Once you have installed the necessary packages, move on to @ref
compile_generate.
@subsection compile_generate Generating build files with CMake @subsection compile_generate Generating build files with CMake
Once you have all necessary dependencies it is time to generate the project Once you have all necessary dependencies it is time to generate the project
files or makefiles for your development environment. CMake needs to know two files or makefiles for your development environment. CMake needs two paths for
paths for this: the path to the _root_ directory of the GLFW source tree (i.e. this:
_not_ the `src` subdirectory) and the target path for the generated files and
compiled binaries. If these are the same, it is called an in-tree build,
otherwise it is called an out-of-tree build.
One of several advantages of out-of-tree builds is that you can generate files - the path to the root directory of the GLFW source tree (not its `src`
and compile for different development environments using a single source tree. subdirectory)
- the path to the directory where the generated build files and compiled
binaries will be placed
@note This section is about generating the project files or makefiles necessary If these are the same, it is called an in-tree build, otherwise it is called an
to compile the GLFW library, not about compiling the actual library. out-of-tree build.
Out-of-tree builds are recommended as they avoid cluttering up the source tree.
They also allow you to have several build directories for different
configurations all using the same source tree.
A common pattern when building a single configuration is to have a build
directory named `build` in the root of the source tree.
@subsubsection compile_generate_cli Generating files with the CMake command-line tool @subsubsection compile_generate_gui Generating files with the CMake GUI
To make an in-tree build, enter the _root_ directory of the GLFW source tree Start the CMake GUI and set the paths to the source and build directories
(i.e. _not_ the `src` subdirectory) and run CMake. The current directory is described above. Then press _Configure_ and _Generate_.
used as target path, while the path provided as an argument is used to find the
source tree.
@code{.sh} If you wish change any CMake variables in the list, press _Configure_ and then
cd <glfw-root-dir> _Generate_ to have the new values take effect. The variable list will be
cmake . populated after the first configure step.
@endcode
To make an out-of-tree build, make a directory outside of the source tree, enter By default GLFW will use X11 on Linux and other Unix-like systems other
it and run CMake with the (relative or absolute) path to the root of the source than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` option in the
tree as an argument. GLFW section of the variable list, then apply the new value as described above.
@code{.sh}
mkdir glfw-build
cd glfw-build
cmake <glfw-root-dir>
@endcode
Once you have generated the project files or makefiles for your chosen Once you have generated the project files or makefiles for your chosen
development environment, move on to @ref compile_compile. development environment, move on to @ref compile_compile.
@subsubsection compile_generate_gui Generating files with the CMake GUI @subsubsection compile_generate_cli Generating files with the CMake command-line tool
If you are using the GUI version, choose the root of the GLFW source tree as To make a build directory, pass the source and build directories to the `cmake`
source location and the same directory or another, empty directory as the command. These can be relative or absolute paths. The build directory is
destination for binaries. Choose _Configure_, change any options you wish to, created if it doesn't already exist.
_Configure_ again to let the changes take effect and then _Generate_.
@code{.sh}
cmake -S path/to/glfw -B path/to/build
@endcode
It is common to name the build directory `build` and place it in the root of the
source tree when only planning to build a single configuration.
@code{.sh}
cd path/to/glfw
cmake -S . -B build
@endcode
Without other flags these will generate Visual Studio project files on Windows
and makefiles on other platforms. You can choose other targets using the `-G`
flag.
@code{.sh}
cmake -S path/to/glfw -B path/to/build -G Xcode
@endcode
By default GLFW will use X11 on Linux and other Unix-like systems other
than macOS. To use Wayland instead, set the `GLFW_USE_WAYLAND` CMake option.
@code{.sh}
cmake -S path/to/glfw -B path/to/build -D GLFW_USE_WAYLAND=1
@endcode
Once you have generated the project files or makefiles for your chosen Once you have generated the project files or makefiles for your chosen
development environment, move on to @ref compile_compile. development environment, move on to @ref compile_compile.
@@ -178,13 +184,39 @@ development environment, move on to @ref compile_compile.
You should now have all required dependencies and the project files or makefiles You should now have all required dependencies and the project files or makefiles
necessary to compile GLFW. Go ahead and compile the actual GLFW library with necessary to compile GLFW. Go ahead and compile the actual GLFW library with
these files, as you would with any other project. these files as you would with any other project.
Once the GLFW library is compiled, you are ready to build your applications, With Visual Studio open `GLFW.sln` and use the Build menu. With Xcode open
`GLFW.xcodeproj` and use the Project menu.
With Linux, macOS and other forms of Unix, run `make`.
@code{.sh}
cd path/to/build
make
@endcode
With MinGW, it is `mingw32-make`.
@code{.sh}
cd path/to/build
mingw32-make
@endcode
Any CMake build directory can also be built with the `cmake` command and the
`--build` flag.
@code{.sh}
cmake --build path/to/build
@endcode
This will run the platform specific build tool the directory was generated for.
Once the GLFW library is compiled you are ready to build your application,
linking it to the GLFW library. See @ref build_guide for more information. linking it to the GLFW library. See @ref build_guide for more information.
@subsection compile_options CMake options @section compile_options CMake options
The CMake files for GLFW provide a number of options, although not all are The CMake files for GLFW provide a number of options, although not all are
available on all supported platforms. Some of these are de facto standards available on all supported platforms. Some of these are de facto standards
@@ -200,15 +232,16 @@ Finally, if you don't want to use any GUI, you can set options from the `cmake`
command-line with the `-D` flag. command-line with the `-D` flag.
@code{.sh} @code{.sh}
cmake -DBUILD_SHARED_LIBS=ON . cmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ON
@endcode @endcode
@subsubsection compile_options_shared Shared CMake options @subsection compile_options_shared Shared CMake options
@anchor BUILD_SHARED_LIBS @anchor BUILD_SHARED_LIBS
__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static __BUILD_SHARED_LIBS__ determines whether GLFW is built as a static
library or as a DLL / shared library / dynamic library. library or as a DLL / shared library / dynamic library. This is disabled by
default, producing a static GLFW library.
@anchor GLFW_BUILD_EXAMPLES @anchor GLFW_BUILD_EXAMPLES
__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built __GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
@@ -220,33 +253,80 @@ built along with the library.
@anchor GLFW_BUILD_DOCS @anchor GLFW_BUILD_DOCS
__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along __GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
with the library. with the library. This is enabled by default if
[Doxygen](https://www.doxygen.nl/) is found by CMake during configuration.
@anchor GLFW_VULKAN_STATIC @anchor GLFW_VULKAN_STATIC
__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked __GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
directly with the application. directly with the application. This is disabled by default.
@subsubsection compile_options_win32 Windows specific CMake options @subsection compile_options_win32 Windows specific CMake options
@anchor USE_MSVC_RUNTIME_LIBRARY_DLL @anchor USE_MSVC_RUNTIME_LIBRARY_DLL
__USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the
static library version of the Visual C++ runtime library. If set to `ON`, the static library version of the Visual C++ runtime library. When enabled, the
DLL version of the Visual C++ library is used. DLL version of the Visual C++ library is used. This is enabled by default.
On CMake 3.15 and later you can set the standard CMake
[CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)
variable instead of this GLFW-specific option.
@anchor GLFW_USE_HYBRID_HPG @anchor GLFW_USE_HYBRID_HPG
__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and __GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the `AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols
need to be exported by the EXE to be detected by the driver, so the override need to be exported by the EXE to be detected by the driver, so the override
will not work if GLFW is built as a DLL. will not work if GLFW is built as a DLL. This is disabled by default, letting
the operating system and driver decide.
@subsection compile_options_wayland Wayland specific CMake options
@anchor GLFW_USE_WAYLAND
__GLFW_USE_WAYLAND__ determines whether to compile the library for Wayland.
This option is only available on Linux and other Unix-like systems other than
macOS. This is disabled by default.
@section compile_mingw_cross Cross-compilation with CMake and MinGW
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
like Ubuntu have the `mingw-w64` package for both.
GLFW has CMake toolchain files in the `CMake` subdirectory that set up
cross-compilation of Windows binaries. To use these files you set the
`CMAKE_TOOLCHAIN_FILE` CMake variable with the `-D` flag add an option when
configuring and generating the build files.
@code{.sh}
cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file
@endcode
The exact toolchain file to use depends on the prefix used by the MinGW or
MinGW-w64 binaries on your system. You can usually see this in the /usr
directory. For example, both the Ubuntu and Cygwin MinGW-w64 packages have
`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
would be:
@code{.sh}
cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake
@endcode
The path to the toolchain file is relative to the path to the GLFW source tree
passed to the `-S` flag, not to the current directory.
For more details see the
[CMake toolchain guide](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html).
@section compile_manual Compiling GLFW manually @section compile_manual Compiling GLFW manually
If you wish to compile GLFW without its CMake build environment then you will If you wish to compile GLFW without its CMake build environment then you will
have to do at least some of the platform detection yourself. GLFW needs have to do at least some of the platform detection yourself. GLFW needs
a configuration macro to be defined in order to know what window system it's a configuration macro to be defined in order to know what window system it is
being compiled for and also has optional, platform-specific ones for various being compiled for and also has optional, platform-specific ones for various
features. features.
@@ -278,11 +358,6 @@ of @b _GLFW_VULKAN_LIBRARY, @b _GLFW_EGL_LIBRARY, @b _GLFW_GLX_LIBRARY, @b
_GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b _GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b
_GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names. _GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names.
For the EGL context creation API, the following options are available:
- @b _GLFW_USE_EGLPLATFORM_H to use an existing `EGL/eglplatform.h` header file
for native handle types (fallback)
@note None of the @ref build_macros may be defined during the compilation of @note None of the @ref build_macros may be defined during the compilation of
GLFW. If you define any of these in your build files, make sure they are not GLFW. If you define any of these in your build files, make sure they are not
applied to the GLFW sources. applied to the GLFW sources.
+18 -18
View File
@@ -142,9 +142,9 @@ as extensions until they become obsolete.
An extension is defined by: An extension is defined by:
- An extension name (e.g. `GL_ARB_debug_output`) - An extension name (e.g. `GL_ARB_gl_spirv`)
- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`) - New OpenGL tokens (e.g. `GL_SPIR_V_BINARY_ARB`)
- New OpenGL functions (e.g. `glGetDebugMessageLogARB`) - New OpenGL functions (e.g. `glSpecializeShaderARB`)
Note the `ARB` affix, which stands for Architecture Review Board and is used Note the `ARB` affix, which stands for Architecture Review Board and is used
for official extensions. The extension above was created by the ARB, but there for official extensions. The extension above was created by the ARB, but there
@@ -229,9 +229,9 @@ To check whether a specific extension is supported, use the `GLAD_GL_xxx`
booleans. booleans.
@code @code
if (GLAD_GL_ARB_debug_output) if (GLAD_GL_ARB_gl_spirv)
{ {
// Use GL_ARB_debug_output // Use GL_ARB_gl_spirv
} }
@endcode @endcode
@@ -263,8 +263,8 @@ included in your development environment may be several years out of date and
may not include the extensions you wish to use. may not include the extensions you wish to use.
The header defines function pointer types for all functions of all extensions it The header defines function pointer types for all functions of all extensions it
supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for supports. These have names like `PFNGLSPECIALIZESHADERARBPROC` (for
`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer `glSpecializeShaderARB`), i.e. the name is made uppercase and `PFN` (pointer
to function) and `PROC` (procedure) are added to the ends. to function) and `PROC` (procedure) are added to the ends.
To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including
@@ -284,7 +284,7 @@ is necessary to check at run-time whether the context supports the extension.
This is done with @ref glfwExtensionSupported. This is done with @ref glfwExtensionSupported.
@code @code
if (glfwExtensionSupported("GL_ARB_debug_output")) if (glfwExtensionSupported("GL_ARB_gl_spirv"))
{ {
// The extension is supported by the current context // The extension is supported by the current context
} }
@@ -303,7 +303,7 @@ your operating system, making it necessary to fetch them at run time. You can
retrieve pointers to these functions with @ref glfwGetProcAddress. retrieve pointers to these functions with @ref glfwGetProcAddress.
@code @code
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB"); PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB");
@endcode @endcode
In general, you should avoid giving the function pointer variables the (exact) In general, you should avoid giving the function pointer variables the (exact)
@@ -317,28 +317,28 @@ when used together.
#define GLFW_INCLUDE_GLEXT #define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#define glGetDebugMessageLogARB pfnGetDebugMessageLog #define glSpecializeShaderARB pfnSpecializeShaderARB
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog; PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB;
// Flag indicating whether the extension is supported // Flag indicating whether the extension is supported
int has_ARB_debug_output = 0; int has_ARB_gl_spirv = 0;
void load_extensions(void) void load_extensions(void)
{ {
if (glfwExtensionSupported("GL_ARB_debug_output")) if (glfwExtensionSupported("GL_ARB_gl_spirv"))
{ {
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC) pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC)
glfwGetProcAddress("glGetDebugMessageLogARB"); glfwGetProcAddress("glSpecializeShaderARB");
has_ARB_debug_output = 1; has_ARB_gl_spirv = 1;
} }
} }
void some_function(void) void some_function(void)
{ {
if (has_ARB_debug_output) if (has_ARB_gl_spirv)
{ {
// Now the extension function can be called as usual // Now the extension function can be called as usual
glGetDebugMessageLogARB(...); glSpecializeShaderARB(...);
} }
} }
@endcode @endcode
+5
View File
@@ -794,6 +794,11 @@ glfwUpdateGamepadMappings(mappings);
This function supports everything from single lines up to and including the This function supports everything from single lines up to and including the
unmodified contents of the whole `gamecontrollerdb.txt` file. unmodified contents of the whole `gamecontrollerdb.txt` file.
If you are compiling GLFW from source with CMake you can update the built-in mappings by
building the _update_mappings_ target. This runs the `GenerateMappings.cmake` CMake
script, which downloads `gamecontrollerdb.txt` and regenerates the `mappings.h` header
file.
Below is a description of the mapping format. Please keep in mind that __this Below is a description of the mapping format. Please keep in mind that __this
description is not authoritative__. The format is defined by the SDL and description is not authoritative__. The format is defined by the SDL and
SDL_GameControllerDB projects and their documentation and code takes precedence. SDL_GameControllerDB projects and their documentation and code takes precedence.
+1 -1
View File
@@ -86,7 +86,7 @@ Setting these hints requires no platform specific headers or functions.
@anchor GLFW_JOYSTICK_HAT_BUTTONS @anchor GLFW_JOYSTICK_HAT_BUTTONS
__GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as __GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as
buttons, for compatibility with earlier versions of GLFW that did not have @ref buttons, for compatibility with earlier versions of GLFW that did not have @ref
glfwGetJoystickHats. Set this with @ref glfwInitHint. glfwGetJoystickHats. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
@subsubsection init_hints_osx macOS specific init hints @subsubsection init_hints_osx macOS specific init hints
+33 -52
View File
@@ -236,7 +236,8 @@ does not affect window decorations. Possible values are `GLFW_TRUE` and
@anchor GLFW_FOCUS_ON_SHOW_hint @anchor GLFW_FOCUS_ON_SHOW_hint
__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input __GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input
focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and
`GLFW_FALSE`.
@anchor GLFW_SCALE_TO_MONITOR @anchor GLFW_SCALE_TO_MONITOR
__GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be __GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be
@@ -271,7 +272,6 @@ __GLFW_ACCUM_ALPHA_BITS__ specify the desired bit depths of the various
components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the
application has no preference. application has no preference.
@par
Accumulation buffers are a legacy OpenGL feature and should not be used in new Accumulation buffers are a legacy OpenGL feature and should not be used in new
code. code.
@@ -279,7 +279,6 @@ code.
__GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value __GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value
of `GLFW_DONT_CARE` means the application has no preference. of `GLFW_DONT_CARE` means the application has no preference.
@par
Auxiliary buffers are a legacy OpenGL feature and should not be used in new Auxiliary buffers are a legacy OpenGL feature and should not be used in new
code. code.
@@ -296,14 +295,12 @@ the application has no preference.
__GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable. __GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable.
Possible values are `GLFW_TRUE` and `GLFW_FALSE`. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
@par @note __OpenGL:__ If enabled and supported by the system, the
__OpenGL:__ If enabled and supported by the system, the `GL_FRAMEBUFFER_SRGB` `GL_FRAMEBUFFER_SRGB` enable will control sRGB rendering. By default, sRGB
enable will control sRGB rendering. By default, sRGB rendering will be rendering will be disabled.
disabled.
@par @note __OpenGL ES:__ If enabled and supported by the system, the context will
__OpenGL ES:__ If enabled and supported by the system, the context will always always have sRGB rendering enabled.
have sRGB rendering enabled.
@anchor GLFW_DOUBLEBUFFER @anchor GLFW_DOUBLEBUFFER
__GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double __GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double
@@ -332,28 +329,22 @@ create the context. Possible values are `GLFW_NATIVE_CONTEXT_API`,
`GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard `GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard
constraint. If no client API is requested, this hint is ignored. constraint. If no client API is requested, this hint is ignored.
@par An [extension loader library](@ref context_glext_auto) that assumes it knows
@macos The EGL API is not available on this platform and requests to use it which API was used to create the current context may fail if you change this
will fail. hint. This can be resolved by having it load functions via @ref
glfwGetProcAddress.
@par @note @wayland The EGL API _is_ the native context creation API, so this hint
__Wayland:__ The EGL API _is_ the native context creation API, so this hint
will have no effect. will have no effect.
@par @note @x11 On some Linux systems, creating contexts via both the native and EGL
__OSMesa:__ As its name implies, an OpenGL context created with OSMesa does not APIs in a single process will cause the application to segfault. Stick to one
update the window contents when its buffers are swapped. Use OpenGL functions API or the other on Linux for now.
or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer and @ref
glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
@note An OpenGL extension loader library that assumes it knows which context @note __OSMesa:__ As its name implies, an OpenGL context created with OSMesa
creation API is used on a given platform may fail if you change this hint. This does not update the window contents when its buffers are swapped. Use OpenGL
can be resolved by having it load via @ref glfwGetProcAddress, which always uses functions or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer
the selected API. and @ref glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
@bug On some Linux systems, creating contexts via both the native and EGL APIs
in a single process will cause the application to segfault. Stick to one API or
the other on Linux for now.
@anchor GLFW_CONTEXT_VERSION_MAJOR_hint @anchor GLFW_CONTEXT_VERSION_MAJOR_hint
@anchor GLFW_CONTEXT_VERSION_MINOR_hint @anchor GLFW_CONTEXT_VERSION_MINOR_hint
@@ -361,27 +352,24 @@ __GLFW_CONTEXT_VERSION_MAJOR__ and __GLFW_CONTEXT_VERSION_MINOR__ specify the
client API version that the created context must be compatible with. The exact client API version that the created context must be compatible with. The exact
behavior of these hints depend on the requested client API. behavior of these hints depend on the requested client API.
@note Do not confuse these hints with `GLFW_VERSION_MAJOR` and
`GLFW_VERSION_MINOR`, which provide the API version of the GLFW header.
@par
__OpenGL:__ These hints are not hard constraints, but creation will fail if the
OpenGL version of the created context is less than the one requested. It is
therefore perfectly safe to use the default of version 1.0 for legacy code and
you will still get backwards-compatible contexts of version 3.0 and above when
available.
@par
While there is no way to ask the driver for a context of the highest supported While there is no way to ask the driver for a context of the highest supported
version, GLFW will attempt to provide this when you ask for a version 1.0 version, GLFW will attempt to provide this when you ask for a version 1.0
context, which is the default for these hints. context, which is the default for these hints.
@par Do not confuse these hints with @ref GLFW_VERSION_MAJOR and @ref
__OpenGL ES:__ These hints are not hard constraints, but creation will fail if GLFW_VERSION_MINOR, which provide the API version of the GLFW header.
the OpenGL ES version of the created context is less than the one requested.
Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, @note __OpenGL:__ These hints are not hard constraints, but creation will fail
and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, if the OpenGL version of the created context is less than the one requested. It
but OpenGL ES 2.0 is not backward compatible with 1.x. is therefore perfectly safe to use the default of version 1.0 for legacy code
and you will still get backwards-compatible contexts of version 3.0 and above
when available.
@note __OpenGL ES:__ These hints are not hard constraints, but creation will
fail if the OpenGL ES version of the created context is less than the one
requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was
requested, and vice versa. This is because OpenGL ES 3.x is backward compatible
with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
@note @macos The OS only supports forward-compatible core profile contexts for @note @macos The OS only supports forward-compatible core profile contexts for
OpenGL versions 3.2 and later. Before creating an OpenGL context of version OpenGL versions 3.2 and later. Before creating an OpenGL context of version
@@ -396,7 +384,6 @@ forward-compatible, i.e. one where all functionality deprecated in the requested
version of OpenGL is removed. This must only be used if the requested OpenGL version of OpenGL is removed. This must only be used if the requested OpenGL
version is 3.0 or above. If OpenGL ES is requested, this hint is ignored. version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.
@par
Forward-compatibility is described in detail in the Forward-compatibility is described in detail in the
[OpenGL Reference Manual](https://www.opengl.org/registry/). [OpenGL Reference Manual](https://www.opengl.org/registry/).
@@ -405,7 +392,6 @@ __GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created
in debug mode, which may provide additional error and diagnostic reporting in debug mode, which may provide additional error and diagnostic reporting
functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
@par
Debug contexts for OpenGL and OpenGL ES are described in detail by the Debug contexts for OpenGL and OpenGL ES are described in detail by the
[GL_KHR_debug](https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt) [GL_KHR_debug](https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt)
extension. extension.
@@ -418,7 +404,6 @@ a specific profile. If requesting an OpenGL version below 3.2,
`GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint `GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint
is ignored. is ignored.
@par
OpenGL profiles are described in detail in the OpenGL profiles are described in detail in the
[OpenGL Reference Manual](https://www.opengl.org/registry/). [OpenGL Reference Manual](https://www.opengl.org/registry/).
@@ -438,7 +423,6 @@ the pipeline will be flushed whenever the context is released from being the
current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will
not be flushed on release. not be flushed on release.
@par
Context release behaviors are described in detail by the Context release behaviors are described in detail by the
[GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt) [GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt)
extension. extension.
@@ -448,7 +432,6 @@ __GLFW_CONTEXT_NO_ERROR__ specifies whether errors should be generated by the
context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled,
situations that would have generated errors instead cause undefined behavior. situations that would have generated errors instead cause undefined behavior.
@par
The no error mode for OpenGL and OpenGL ES is described in detail by the The no error mode for OpenGL and OpenGL ES is described in detail by the
[GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt) [GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt)
extension. extension.
@@ -474,12 +457,10 @@ run on the discrete GPU. This only affects systems with both integrated and
discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is
ignored on other platforms. ignored on other platforms.
@par
Simpler programs and tools may want to enable this to save power, while games Simpler programs and tools may want to enable this to save power, while games
and other applications performing advanced rendering will want to leave it and other applications performing advanced rendering will want to leave it
disabled. disabled.
@par
A bundled application that wishes to participate in Automatic Graphics Switching A bundled application that wishes to participate in Automatic Graphics Switching
should also declare this in its `Info.plist` by setting the should also declare this in its `Info.plist` by setting the
`NSSupportsAutomaticGraphicsSwitching` key to `true`. `NSSupportsAutomaticGraphicsSwitching` key to `true`.
+7 -2
View File
@@ -7,7 +7,8 @@ if (MATH_LIBRARY)
link_libraries("${MATH_LIBRARY}") link_libraries("${MATH_LIBRARY}")
endif() endif()
if (MSVC) # Workaround for the MS CRT deprecating parts of the standard library
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif() endif()
@@ -62,9 +63,13 @@ if (GLFW_USE_OSMESA)
endif() endif()
if (MSVC) if (MSVC)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables # Tell MSVC to use main instead of WinMain
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup") LINK_FLAGS "/ENTRY:mainCRTStartup")
elseif (CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
# Tell Clang using MS CRT to use main instead of WinMain
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
LINK_FLAGS "-Wl,/entry:mainCRTStartup")
endif() endif()
if (APPLE) if (APPLE)
+5 -5
View File
@@ -292,12 +292,12 @@ static void generate_heightmap__circle(float* center_x, float* center_y,
{ {
float sign; float sign;
/* random value for element in between [0-1.0] */ /* random value for element in between [0-1.0] */
*center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); *center_x = (MAP_SIZE * rand()) / (float) RAND_MAX;
*center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); *center_y = (MAP_SIZE * rand()) / (float) RAND_MAX;
*size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX); *size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX;
sign = (1.0f * rand()) / (1.0f * RAND_MAX); sign = (1.0f * rand()) / (float) RAND_MAX;
sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f; sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f;
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX); *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX;
} }
/* Run the specified number of iterations of the generation process for the /* Run the specified number of iterations of the generation process for the
+46 -44
View File
@@ -190,6 +190,9 @@ extern "C" {
#else /*__APPLE__*/ #else /*__APPLE__*/
#include <GL/glcorearb.h> #include <GL/glcorearb.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GL/glext.h>
#endif
#endif /*__APPLE__*/ #endif /*__APPLE__*/
@@ -276,26 +279,27 @@ extern "C" {
/*! @name GLFW version macros /*! @name GLFW version macros
* @{ */ * @{ */
/*! @brief The major version number of the GLFW library. /*! @brief The major version number of the GLFW header.
* *
* This is incremented when the API is changed in non-compatible ways. * The major version number of the GLFW header. This is incremented when the
* API is changed in non-compatible ways.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_MAJOR 3 #define GLFW_VERSION_MAJOR 3
/*! @brief The minor version number of the GLFW library. /*! @brief The minor version number of the GLFW header.
* *
* This is incremented when features are added to the API but it remains * The minor version number of the GLFW header. This is incremented when
* backward-compatible. * features are added to the API but it remains backward-compatible.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_MINOR 3 #define GLFW_VERSION_MINOR 3
/*! @brief The revision number of the GLFW library. /*! @brief The revision number of the GLFW header.
* *
* This is incremented when a bug fix release is made that does not contain any * The revision number of the GLFW header. This is incremented when a bug fix
* API changes. * release is made that does not contain any API changes.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_REVISION 3 #define GLFW_VERSION_REVISION 5
/*! @} */ /*! @} */
/*! @brief One. /*! @brief One.
@@ -1215,7 +1219,7 @@ typedef struct GLFWcursor GLFWcursor;
* *
* @ingroup init * @ingroup init
*/ */
typedef void (* GLFWerrorfun)(int,const char*); typedef void (* GLFWerrorfun)(int error_code, const char* description);
/*! @brief The function pointer type for window position callbacks. /*! @brief The function pointer type for window position callbacks.
* *
@@ -1238,7 +1242,7 @@ typedef void (* GLFWerrorfun)(int,const char*);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
/*! @brief The function pointer type for window size callbacks. /*! @brief The function pointer type for window size callbacks.
* *
@@ -1260,7 +1264,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
/*! @brief The function pointer type for window close callbacks. /*! @brief The function pointer type for window close callbacks.
* *
@@ -1280,7 +1284,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowclosefun)(GLFWwindow*); typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
/*! @brief The function pointer type for window content refresh callbacks. /*! @brief The function pointer type for window content refresh callbacks.
* *
@@ -1300,7 +1304,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
/*! @brief The function pointer type for window focus callbacks. /*! @brief The function pointer type for window focus callbacks.
* *
@@ -1321,7 +1325,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
/*! @brief The function pointer type for window iconify callbacks. /*! @brief The function pointer type for window iconify callbacks.
* *
@@ -1342,7 +1346,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
/*! @brief The function pointer type for window maximize callbacks. /*! @brief The function pointer type for window maximize callbacks.
* *
@@ -1363,7 +1367,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
/*! @brief The function pointer type for framebuffer size callbacks. /*! @brief The function pointer type for framebuffer size callbacks.
* *
@@ -1384,7 +1388,7 @@ typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);
/*! @brief The function pointer type for window content scale callbacks. /*! @brief The function pointer type for window content scale callbacks.
* *
@@ -1405,7 +1409,7 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
* *
* @ingroup window * @ingroup window
*/ */
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);
/*! @brief The function pointer type for mouse button callbacks. /*! @brief The function pointer type for mouse button callbacks.
* *
@@ -1431,7 +1435,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
/*! @brief The function pointer type for cursor position callbacks. /*! @brief The function pointer type for cursor position callbacks.
* *
@@ -1454,7 +1458,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
/*! @brief The function pointer type for cursor enter/leave callbacks. /*! @brief The function pointer type for cursor enter/leave callbacks.
* *
@@ -1475,7 +1479,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
/*! @brief The function pointer type for scroll callbacks. /*! @brief The function pointer type for scroll callbacks.
* *
@@ -1496,7 +1500,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);
/*! @brief The function pointer type for keyboard key callbacks. /*! @brief The function pointer type for keyboard key callbacks.
* *
@@ -1522,7 +1526,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);
/*! @brief The function pointer type for Unicode character callbacks. /*! @brief The function pointer type for Unicode character callbacks.
* *
@@ -1543,7 +1547,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
/*! @brief The function pointer type for Unicode character with modifiers /*! @brief The function pointer type for Unicode character with modifiers
* callbacks. * callbacks.
@@ -1570,7 +1574,7 @@ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);
/*! @brief The function pointer type for path drop callbacks. /*! @brief The function pointer type for path drop callbacks.
* *
@@ -1594,7 +1598,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]); typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);
/*! @brief The function pointer type for monitor configuration callbacks. /*! @brief The function pointer type for monitor configuration callbacks.
* *
@@ -1615,7 +1619,7 @@ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
* *
* @ingroup monitor * @ingroup monitor
*/ */
typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
/*! @brief The function pointer type for joystick configuration callbacks. /*! @brief The function pointer type for joystick configuration callbacks.
* *
@@ -1636,7 +1640,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
* *
* @ingroup input * @ingroup input
*/ */
typedef void (* GLFWjoystickfun)(int,int); typedef void (* GLFWjoystickfun)(int jid, int event);
/*! @brief Video mode type. /*! @brief Video mode type.
* *
@@ -2124,8 +2128,8 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark @win32 calculates the returned physical size from the * @remark @win32 On Windows 8 and earlier the physical size is calculated from
* current resolution and system DPI instead of querying the monitor EDID data. * the current resolution and system DPI instead of querying the monitor EDID data.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@@ -2279,8 +2283,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
* *
* This function returns an array of all video modes supported by the specified * This function returns an array of all video modes supported by the specified
* monitor. The returned array is sorted in ascending order, first by color * monitor. The returned array is sorted in ascending order, first by color
* bit depth (the sum of all channel depths) and then by resolution area (the * bit depth (the sum of all channel depths), then by resolution area (the
* product of width and height). * product of width and height), then resolution width and finally by refresh
* rate.
* *
* @param[in] monitor The monitor to query. * @param[in] monitor The monitor to query.
* @param[out] count Where to store the number of video modes in the returned * @param[out] count Where to store the number of video modes in the returned
@@ -5656,13 +5661,11 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
* This function returns whether the Vulkan loader and any minimally functional * This function returns whether the Vulkan loader and any minimally functional
* ICD have been found. * ICD have been found.
* *
* The availability of a Vulkan loader and even an ICD does not by itself * The availability of a Vulkan loader and even an ICD does not by itself guarantee that
* guarantee that surface creation or even instance creation is possible. * surface creation or even instance creation is possible. Call @ref
* For example, on Fermi systems Nvidia will install an ICD that provides no * glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan
* actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check * surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to
* whether the extensions necessary for Vulkan surface creation are available * check whether a queue family of a physical device supports image presentation.
* and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
* family of a physical device supports image presentation.
* *
* @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
* otherwise. * otherwise.
@@ -5708,9 +5711,8 @@ GLFWAPI int glfwVulkanSupported(void);
* returned array, as it is an error to specify an extension more than once in * returned array, as it is an error to specify an extension more than once in
* the `VkInstanceCreateInfo` struct. * the `VkInstanceCreateInfo` struct.
* *
* @remark @macos This function currently supports either the * @remark @macos GLFW currently supports both the `VK_MVK_macos_surface` and
* `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface` * the newer `VK_EXT_metal_surface` extensions.
* extension.
* *
* @pointer_lifetime The returned array is allocated and freed by GLFW. You * @pointer_lifetime The returned array is allocated and freed by GLFW. You
* should not free it yourself. It is guaranteed to be valid only until the * should not free it yourself. It is guaranteed to be valid only until the
@@ -5793,7 +5795,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* *
* @remark @macos This function currently always returns `GLFW_TRUE`, as the * @remark @macos This function currently always returns `GLFW_TRUE`, as the
* `VK_MVK_macos_surface` extension does not provide * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
* a `vkGetPhysicalDevice*PresentationSupport` type function. * a `vkGetPhysicalDevice*PresentationSupport` type function.
* *
* @thread_safety This function may be called from any thread. For * @thread_safety This function may be called from any thread. For
+71 -2
View File
@@ -83,8 +83,8 @@ extern "C" {
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_ARB_debug_output // example to allow applications to correctly declare a GL_KHR_debug callback)
// callback) but windows.h assumes no one will define APIENTRY before it does // but windows.h assumes no one will define APIENTRY before it does
#if defined(GLFW_APIENTRY_DEFINED) #if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY #undef APIENTRY
#undef GLFW_APIENTRY_DEFINED #undef GLFW_APIENTRY_DEFINED
@@ -132,6 +132,8 @@ extern "C" {
* of the specified monitor, or `NULL` if an [error](@ref error_handling) * of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred. * occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -147,6 +149,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -161,6 +165,16 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
* @return The `HWND` of the specified window, or `NULL` if an * @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -177,6 +191,17 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
* @return The `HGLRC` of the specified window, or `NULL` if an * @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -193,6 +218,8 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
* @return The `CGDirectDisplayID` of the specified monitor, or * @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred. * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -207,6 +234,8 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
* @return The `NSWindow` of the specified window, or `nil` if an * @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -223,6 +252,9 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
* @return The `NSOpenGLContext` of the specified window, or `nil` if an * @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -239,6 +271,8 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
* @return The `Display` used by GLFW, or `NULL` if an * @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -253,6 +287,8 @@ GLFWAPI Display* glfwGetX11Display(void);
* @return The `RRCrtc` of the specified monitor, or `None` if an * @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -267,6 +303,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
* @return The `RROutput` of the specified monitor, or `None` if an * @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -281,6 +319,8 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
* @return The `Window` of the specified window, or `None` if an * @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -347,6 +387,9 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
* @return The `GLXContext` of the specified window, or `NULL` if an * @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -361,6 +404,9 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @return The `GLXWindow` of the specified window, or `None` if an * @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -377,6 +423,8 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
* @return The `struct wl_display*` used by GLFW, or `NULL` if an * @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -391,6 +439,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an * @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -405,6 +455,8 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
* @return The main `struct wl_surface*` of the specified window, or `NULL` if * @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred. * an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -421,6 +473,8 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -435,6 +489,9 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -449,6 +506,9 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -472,6 +532,9 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -493,6 +556,9 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
@@ -507,6 +573,9 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
* @return The `OSMesaContext` of the specified window, or `NULL` if an * @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
+21 -16
View File
@@ -5,6 +5,15 @@ set(common_HEADERS internal.h mappings.h
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c) set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c)
add_custom_target(update_mappings
COMMAND "${CMAKE_COMMAND}" -P "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake" mappings.h.in mappings.h
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Updating gamepad mappings from upstream repository"
SOURCES mappings.h.in "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake"
VERBATIM)
set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
if (_GLFW_COCOA) if (_GLFW_COCOA)
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h
posix_thread.h nsgl_context.h egl_context.h osmesa_context.h) posix_thread.h nsgl_context.h egl_context.h osmesa_context.h)
@@ -121,22 +130,18 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
endif() endif()
# Enable a reasonable set of warnings # Enable a reasonable set of warnings
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR # NOTE: The order matters here, Clang-CL matches both MSVC and Clang
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR if (MSVC)
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
if (CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
# Tell Clang-CL that this is a Clang flag
target_compile_options(glfw PRIVATE "/clang:-Wall")
else()
target_compile_options(glfw PRIVATE "-Wall")
endif()
elseif (MSVC)
target_compile_options(glfw PRIVATE "/W3") target_compile_options(glfw PRIVATE "/W3")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(glfw PRIVATE "-Wall")
endif() endif()
if (WIN32) if (_GLFW_WIN32)
target_compile_definitions(glfw PRIVATE _UNICODE) target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
endif() endif()
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before # HACK: When building on MinGW, WINVER and UNICODE need to be defined before
@@ -144,7 +149,7 @@ endif()
# win32_platform.h. We define them here until a saner solution can be found # win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
if (MINGW) if (MINGW)
target_compile_definitions(glfw PRIVATE UNICODE WINVER=0x0501) target_compile_definitions(glfw PRIVATE WINVER=0x0501)
endif() endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
@@ -176,14 +181,14 @@ if (BUILD_SHARED_LIBS)
endif() endif()
endif() endif()
if (MSVC) if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
endif() endif()
if (GLFW_INSTALL) if (GLFW_INSTALL)
install(TARGETS glfw install(TARGETS glfw
EXPORT glfwTargets EXPORT glfwTargets
RUNTIME DESTINATION "bin" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif() endif()
+1
View File
@@ -33,6 +33,7 @@
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; } #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; }
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X" #define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
#define GLFW_BUILD_COCOA_MAPPINGS
// Cocoa-specific per-joystick data // Cocoa-specific per-joystick data
// //
+6 -6
View File
@@ -58,12 +58,12 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
io_service_t service; io_service_t service;
CFDictionaryRef info; CFDictionaryRef info;
if (IOServiceGetMatchingServices(kIOMasterPortDefault, if (IOServiceGetMatchingServices(kIOMainPortDefault,
IOServiceMatching("IODisplayConnect"), IOServiceMatching("IODisplayConnect"),
&it) != 0) &it) != 0)
{ {
// This may happen if a desktop Mac is running headless // This may happen if a desktop Mac is running headless
return NULL; return _glfw_strdup("Display");
} }
while ((service = IOIteratorNext(it)) != 0) while ((service = IOIteratorNext(it)) != 0)
@@ -101,7 +101,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to find service port for display"); "Cocoa: Failed to find service port for display");
return NULL; return _glfw_strdup("Display");
} }
CFDictionaryRef names = CFDictionaryRef names =
@@ -114,7 +114,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
{ {
// This may happen if a desktop Mac is running headless // This may happen if a desktop Mac is running headless
CFRelease(info); CFRelease(info);
return NULL; return _glfw_strdup("Display");
} }
const CFIndex size = const CFIndex size =
@@ -231,7 +231,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
io_iterator_t it; io_iterator_t it;
io_service_t service; io_service_t service;
if (IOServiceGetMatchingServices(kIOMasterPortDefault, if (IOServiceGetMatchingServices(kIOMainPortDefault,
IOServiceMatching("IOFramebuffer"), IOServiceMatching("IOFramebuffer"),
&it) != 0) &it) != 0)
{ {
@@ -356,7 +356,7 @@ void _glfwPollMonitorsNS(void)
const CGSize size = CGDisplayScreenSize(displays[i]); const CGSize size = CGDisplayScreenSize(displays[i]);
char* name = getMonitorName(displays[i], screen); char* name = getMonitorName(displays[i], screen);
if (!name) if (!name)
name = _glfw_strdup("Unknown"); continue;
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height); _GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
monitor->ns.displayID = displays[i]; monitor->ns.displayID = displays[i];
+9 -5
View File
@@ -31,7 +31,9 @@
// NOTE: All of NSGL was deprecated in the 10.14 SDK // NOTE: All of NSGL was deprecated in the 10.14 SDK
// This disables the pointless warnings for every symbol we use // This disables the pointless warnings for every symbol we use
#ifndef GL_SILENCE_DEPRECATION
#define GL_SILENCE_DEPRECATION #define GL_SILENCE_DEPRECATION
#endif
#if defined(__OBJC__) #if defined(__OBJC__)
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@@ -39,6 +41,13 @@
typedef void* id; typedef void* id;
#endif #endif
// NOTE: Many Cocoa enum values have been renamed and we need to build across
// SDK versions where one is unavailable or the other deprecated
// We use the newer names in code and these macros to handle compatibility
#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000
#define kIOMainPortDefault kIOMasterPortDefault
#endif
// NOTE: Many Cocoa enum values have been renamed and we need to build across // NOTE: Many Cocoa enum values have been renamed and we need to build across
// SDK versions where one is unavailable or the other deprecated // SDK versions where one is unavailable or the other deprecated
// We use the newer names in code and these macros to handle compatibility // We use the newer names in code and these macros to handle compatibility
@@ -133,7 +142,6 @@ typedef struct _GLFWwindowNS
// since the last cursor motion event was processed // since the last cursor motion event was processed
// This is kept to counteract Cocoa doing the same internally // This is kept to counteract Cocoa doing the same internally
double cursorWarpDeltaX, cursorWarpDeltaY; double cursorWarpDeltaX, cursorWarpDeltaY;
} _GLFWwindowNS; } _GLFWwindowNS;
// Cocoa-specific global data // Cocoa-specific global data
@@ -168,7 +176,6 @@ typedef struct _GLFWlibraryNS
PFN_LMGetKbdType GetKbdType; PFN_LMGetKbdType GetKbdType;
CFStringRef kPropertyUnicodeKeyLayoutData; CFStringRef kPropertyUnicodeKeyLayoutData;
} tis; } tis;
} _GLFWlibraryNS; } _GLFWlibraryNS;
// Cocoa-specific per-monitor data // Cocoa-specific per-monitor data
@@ -180,7 +187,6 @@ typedef struct _GLFWmonitorNS
uint32_t unitNumber; uint32_t unitNumber;
id screen; id screen;
double fallbackRefreshRate; double fallbackRefreshRate;
} _GLFWmonitorNS; } _GLFWmonitorNS;
// Cocoa-specific per-cursor data // Cocoa-specific per-cursor data
@@ -188,7 +194,6 @@ typedef struct _GLFWmonitorNS
typedef struct _GLFWcursorNS typedef struct _GLFWcursorNS
{ {
id object; id object;
} _GLFWcursorNS; } _GLFWcursorNS;
// Cocoa-specific global timer data // Cocoa-specific global timer data
@@ -196,7 +201,6 @@ typedef struct _GLFWcursorNS
typedef struct _GLFWtimerNS typedef struct _GLFWtimerNS
{ {
uint64_t frequency; uint64_t frequency;
} _GLFWtimerNS; } _GLFWtimerNS;
+23 -18
View File
@@ -114,10 +114,11 @@ static void updateCursorMode(_GLFWwindow* window)
else if (_glfw.ns.disabledCursorWindow == window) else if (_glfw.ns.disabledCursorWindow == window)
{ {
_glfw.ns.disabledCursorWindow = NULL; _glfw.ns.disabledCursorWindow = NULL;
CGAssociateMouseAndMouseCursorPosition(true);
_glfwPlatformSetCursorPos(window, _glfwPlatformSetCursorPos(window,
_glfw.ns.restoreCursorPosX, _glfw.ns.restoreCursorPosX,
_glfw.ns.restoreCursorPosY); _glfw.ns.restoreCursorPosY);
// NOTE: The matching CGAssociateMouseAndMouseCursorPosition call is
// made in _glfwPlatformSetCursorPos as part of a workaround
} }
if (cursorInContentArea(window)) if (cursorInContentArea(window))
@@ -243,7 +244,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidResize:(NSNotification *)notification - (void)windowDidResize:(NSNotification *)notification
{ {
if (window->context.client != GLFW_NO_API) if (window->context.source == GLFW_NATIVE_CONTEXT_API)
[window->context.nsgl.object update]; [window->context.nsgl.object update];
if (_glfw.ns.disabledCursorWindow == window) if (_glfw.ns.disabledCursorWindow == window)
@@ -278,7 +279,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidMove:(NSNotification *)notification - (void)windowDidMove:(NSNotification *)notification
{ {
if (window->context.client != GLFW_NO_API) if (window->context.source == GLFW_NATIVE_CONTEXT_API)
[window->context.nsgl.object update]; [window->context.nsgl.object update];
if (_glfw.ns.disabledCursorWindow == window) if (_glfw.ns.disabledCursorWindow == window)
@@ -397,7 +398,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)updateLayer - (void)updateLayer
{ {
if (window->context.client != GLFW_NO_API) if (window->context.source == GLFW_NATIVE_CONTEXT_API)
[window->context.nsgl.object update]; [window->context.nsgl.object update];
_glfwInputWindowDamage(window); _glfwInputWindowDamage(window);
@@ -520,6 +521,18 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
{ {
const NSRect contentRect = [window->ns.view frame]; const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
const float xscale = fbRect.size.width / contentRect.size.width;
const float yscale = fbRect.size.height / contentRect.size.height;
if (xscale != window->ns.xscale || yscale != window->ns.yscale)
{
if (window->ns.retina && window->ns.layer)
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
window->ns.xscale = xscale;
window->ns.yscale = yscale;
_glfwInputWindowContentScale(window, xscale, yscale);
}
if (fbRect.size.width != window->ns.fbWidth || if (fbRect.size.width != window->ns.fbWidth ||
fbRect.size.height != window->ns.fbHeight) fbRect.size.height != window->ns.fbHeight)
@@ -528,19 +541,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
window->ns.fbHeight = fbRect.size.height; window->ns.fbHeight = fbRect.size.height;
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
} }
const float xscale = fbRect.size.width / contentRect.size.width;
const float yscale = fbRect.size.height / contentRect.size.height;
if (xscale != window->ns.xscale || yscale != window->ns.yscale)
{
window->ns.xscale = xscale;
window->ns.yscale = yscale;
_glfwInputWindowContentScale(window, xscale, yscale);
if (window->ns.retina && window->ns.layer)
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
}
} }
- (void)drawRect:(NSRect)rect - (void)drawRect:(NSRect)rect
@@ -1524,6 +1524,11 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
_glfwTransformYNS(globalPoint.y))); _glfwTransformYNS(globalPoint.y)));
} }
// HACK: Calling this right after setting the cursor position prevents macOS
// from freezing the cursor for a fraction of a second afterwards
if (window->cursorMode != GLFW_CURSOR_DISABLED)
CGAssociateMouseAndMouseCursorPosition(true);
} // autoreleasepool } // autoreleasepool
} }
@@ -1542,7 +1547,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
if (scancode < 0 || scancode > 0xff || if (scancode < 0 || scancode > 0xff ||
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN) _glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
{ {
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
return NULL; return NULL;
} }
+3 -7
View File
@@ -196,12 +196,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
continue; continue;
} }
if (desired->doublebuffer != current->doublebuffer)
{
// Double buffering is a hard constraint
continue;
}
// Count number of missing buffers // Count number of missing buffers
{ {
missing = 0; missing = 0;
@@ -570,7 +564,9 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
window->context.getProcAddress("glClear"); window->context.getProcAddress("glClear");
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
window->context.swapBuffers(window);
if (window->doublebuffer)
window->context.swapBuffers(window);
} }
glfwMakeContextCurrent((GLFWwindow*) previous); glfwMakeContextCurrent((GLFWwindow*) previous);
+6 -3
View File
@@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
u->doublebuffer = GLFW_TRUE; u->doublebuffer = desired->doublebuffer;
u->handle = (uintptr_t) n; u->handle = (uintptr_t) n;
usableCount++; usableCount++;
@@ -596,6 +596,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR); setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
} }
if (!fbconfig->doublebuffer)
setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
setAttrib(EGL_NONE, EGL_NONE); setAttrib(EGL_NONE, EGL_NONE);
window->context.egl.surface = window->context.egl.surface =
@@ -762,7 +765,7 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT); _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_EGL_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_CONTEXT; return EGL_NO_CONTEXT;
@@ -776,7 +779,7 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE); _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_EGL_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
+2 -2
View File
@@ -80,6 +80,8 @@ typedef struct wl_egl_window* EGLNativeWindowType;
#define EGL_OPENGL_ES_API 0x30a0 #define EGL_OPENGL_ES_API 0x30a0
#define EGL_OPENGL_API 0x30a2 #define EGL_OPENGL_API 0x30a2
#define EGL_NONE 0x3038 #define EGL_NONE 0x3038
#define EGL_RENDER_BUFFER 0x3086
#define EGL_SINGLE_BUFFER 0x3085
#define EGL_EXTENSIONS 0x3055 #define EGL_EXTENSIONS 0x3055
#define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_NATIVE_VISUAL_ID 0x302e #define EGL_NATIVE_VISUAL_ID 0x302e
@@ -162,7 +164,6 @@ typedef struct _GLFWcontextEGL
EGLSurface surface; EGLSurface surface;
void* client; void* client;
} _GLFWcontextEGL; } _GLFWcontextEGL;
// EGL-specific global data // EGL-specific global data
@@ -197,7 +198,6 @@ typedef struct _GLFWlibraryEGL
PFN_eglSwapInterval SwapInterval; PFN_eglSwapInterval SwapInterval;
PFN_eglQueryString QueryString; PFN_eglQueryString QueryString;
PFN_eglGetProcAddress GetProcAddress; PFN_eglGetProcAddress GetProcAddress;
} _GLFWlibraryEGL; } _GLFWlibraryEGL;
+5 -4
View File
@@ -92,6 +92,9 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
continue; continue;
} }
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
continue;
if (desired->transparent) if (desired->transparent)
{ {
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n); XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
@@ -119,8 +122,6 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
if (getGLXFBConfigAttrib(n, GLX_STEREO)) if (getGLXFBConfigAttrib(n, GLX_STEREO))
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER))
u->doublebuffer = GLFW_TRUE;
if (_glfw.glx.ARB_multisample) if (_glfw.glx.ARB_multisample)
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES); u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
@@ -673,7 +674,7 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_NATIVE_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL; return NULL;
@@ -687,7 +688,7 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(None); _GLFW_REQUIRE_INIT_OR_RETURN(None);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_NATIVE_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return None; return None;
-2
View File
@@ -117,7 +117,6 @@ typedef struct _GLFWcontextGLX
{ {
GLXContext handle; GLXContext handle;
GLXWindow window; GLXWindow window;
} _GLFWcontextGLX; } _GLFWcontextGLX;
// GLX-specific global data // GLX-specific global data
@@ -165,7 +164,6 @@ typedef struct _GLFWlibraryGLX
GLFWbool EXT_create_context_es2_profile; GLFWbool EXT_create_context_es2_profile;
GLFWbool ARB_create_context_no_error; GLFWbool ARB_create_context_no_error;
GLFWbool ARB_context_flush_control; GLFWbool ARB_context_flush_control;
} _GLFWlibraryGLX; } _GLFWlibraryGLX;
GLFWbool _glfwInitGLX(void); GLFWbool _glfwInitGLX(void);
+2 -15
View File
@@ -28,7 +28,6 @@
//======================================================================== //========================================================================
#include "internal.h" #include "internal.h"
#include "mappings.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@@ -245,24 +244,12 @@ GLFWAPI int glfwInit(void)
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError); _glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
_glfwInitGamepadMappings();
_glfw.initialized = GLFW_TRUE; _glfw.initialized = GLFW_TRUE;
_glfw.timer.offset = _glfwPlatformGetTimerValue(); _glfw.timer.offset = _glfwPlatformGetTimerValue();
glfwDefaultWindowHints(); glfwDefaultWindowHints();
{
int i;
for (i = 0; _glfwDefaultMappings[i]; i++)
{
if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i]))
{
terminate();
return GLFW_FALSE;
}
}
}
return GLFW_TRUE; return GLFW_TRUE;
} }
+17 -14
View File
@@ -28,6 +28,7 @@
//======================================================================== //========================================================================
#include "internal.h" #include "internal.h"
#include "mappings.h"
#include <assert.h> #include <assert.h>
#include <float.h> #include <float.h>
@@ -85,25 +86,13 @@ static _GLFWmapping* findValidMapping(const _GLFWjoystick* js)
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++) for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
{ {
if (!isValidElementForJoystick(mapping->buttons + i, js)) if (!isValidElementForJoystick(mapping->buttons + i, js))
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid button in gamepad mapping %s (%s)",
mapping->guid,
mapping->name);
return NULL; return NULL;
}
} }
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++) for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
{ {
if (!isValidElementForJoystick(mapping->axes + i, js)) if (!isValidElementForJoystick(mapping->axes + i, js))
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid axis in gamepad mapping %s (%s)",
mapping->guid,
mapping->name);
return NULL; return NULL;
}
} }
} }
@@ -408,6 +397,21 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
////// GLFW internal API ////// ////// GLFW internal API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Adds the built-in set of gamepad mappings
//
void _glfwInitGamepadMappings(void)
{
size_t i;
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
_glfw.mappings = calloc(count, sizeof(_GLFWmapping));
for (i = 0; i < count; i++)
{
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
_glfw.mappingCount++;
}
}
// Returns an available joystick object with arrays and name allocated // Returns an available joystick object with arrays and name allocated
// //
_GLFWjoystick* _glfwAllocJoystick(const char* name, _GLFWjoystick* _glfwAllocJoystick(const char* name,
@@ -430,7 +434,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
js->present = GLFW_TRUE; js->present = GLFW_TRUE;
js->name = _glfw_strdup(name);
js->axes = calloc(axisCount, sizeof(float)); js->axes = calloc(axisCount, sizeof(float));
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = calloc(hatCount, 1); js->hats = calloc(hatCount, 1);
@@ -438,6 +441,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js->buttonCount = buttonCount; js->buttonCount = buttonCount;
js->hatCount = hatCount; js->hatCount = hatCount;
strncpy(js->name, name, sizeof(js->name) - 1);
strncpy(js->guid, guid, sizeof(js->guid) - 1); strncpy(js->guid, guid, sizeof(js->guid) - 1);
js->mapping = findValidMapping(js); js->mapping = findValidMapping(js);
@@ -448,7 +452,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
// //
void _glfwFreeJoystick(_GLFWjoystick* js) void _glfwFreeJoystick(_GLFWjoystick* js)
{ {
free(js->name);
free(js->axes); free(js->axes);
free(js->buttons); free(js->buttons);
free(js->hats); free(js->hats);
+4 -2
View File
@@ -375,6 +375,7 @@ struct _GLFWwindow
GLFWbool focusOnShow; GLFWbool focusOnShow;
GLFWbool shouldClose; GLFWbool shouldClose;
void* userPointer; void* userPointer;
GLFWbool doublebuffer;
GLFWvidmode videoMode; GLFWvidmode videoMode;
_GLFWmonitor* monitor; _GLFWmonitor* monitor;
_GLFWcursor* cursor; _GLFWcursor* cursor;
@@ -423,7 +424,7 @@ struct _GLFWwindow
// //
struct _GLFWmonitor struct _GLFWmonitor
{ {
char* name; char name[128];
void* userPointer; void* userPointer;
// Physical dimensions in millimeters. // Physical dimensions in millimeters.
@@ -484,7 +485,7 @@ struct _GLFWjoystick
int buttonCount; int buttonCount;
unsigned char* hats; unsigned char* hats;
int hatCount; int hatCount;
char* name; char name[128];
void* userPointer; void* userPointer;
char guid[33]; char guid[33];
_GLFWmapping* mapping; _GLFWmapping* mapping;
@@ -760,6 +761,7 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
void _glfwFreeGammaArrays(GLFWgammaramp* ramp); void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
void _glfwInitGamepadMappings(void);
_GLFWjoystick* _glfwAllocJoystick(const char* name, _GLFWjoystick* _glfwAllocJoystick(const char* name,
const char* guid, const char* guid,
int axisCount, int axisCount,
+1
View File
@@ -32,6 +32,7 @@
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs
#define _GLFW_PLATFORM_MAPPING_NAME "Linux" #define _GLFW_PLATFORM_MAPPING_NAME "Linux"
#define GLFW_BUILD_LINUX_MAPPINGS
// Linux-specific joystick data // Linux-specific joystick data
// //
+821 -296
View File
File diff suppressed because it is too large Load Diff
+12 -3
View File
@@ -31,7 +31,7 @@
// all available in SDL_GameControllerDB. Do not edit this file. Any gamepad // all available in SDL_GameControllerDB. Do not edit this file. Any gamepad
// mappings not specific to GLFW should be submitted to SDL_GameControllerDB. // mappings not specific to GLFW should be submitted to SDL_GameControllerDB.
// This file can be re-generated from mappings.h.in and the upstream // This file can be re-generated from mappings.h.in and the upstream
// gamecontrollerdb.txt with the GenerateMappings.cmake script. // gamecontrollerdb.txt with the 'update_mappings' CMake target.
//======================================================================== //========================================================================
// All gamepad mappings not labeled GLFW are copied from the // All gamepad mappings not labeled GLFW are copied from the
@@ -60,7 +60,8 @@
const char* _glfwDefaultMappings[] = const char* _glfwDefaultMappings[] =
{ {
@GLFW_GAMEPAD_MAPPINGS@ #if defined(GLFW_BUILD_WIN32_MAPPINGS)
@GLFW_WIN32_MAPPINGS@
"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
@@ -68,6 +69,14 @@ const char* _glfwDefaultMappings[] =
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
NULL #endif // GLFW_BUILD_WIN32_MAPPINGS
#if defined(GLFW_BUILD_COCOA_MAPPINGS)
@GLFW_COCOA_MAPPINGS@
#endif // GLFW_BUILD_COCOA_MAPPINGS
#if defined(GLFW_BUILD_LINUX_MAPPINGS)
@GLFW_LINUX_MAPPINGS@
#endif // GLFW_BUILD_LINUX_MAPPINGS
}; };
+1 -3
View File
@@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
monitor->widthMM = widthMM; monitor->widthMM = widthMM;
monitor->heightMM = heightMM; monitor->heightMM = heightMM;
if (name) strncpy(monitor->name, name, sizeof(monitor->name) - 1);
monitor->name = _glfw_strdup(name);
return monitor; return monitor;
} }
@@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
_glfwFreeGammaArrays(&monitor->currentRamp); _glfwFreeGammaArrays(&monitor->currentRamp);
free(monitor->modes); free(monitor->modes);
free(monitor->name);
free(monitor); free(monitor);
} }
-2
View File
@@ -44,7 +44,6 @@ typedef struct _GLFWcontextNSGL
{ {
id pixelFormat; id pixelFormat;
id object; id object;
} _GLFWcontextNSGL; } _GLFWcontextNSGL;
// NSGL-specific global data // NSGL-specific global data
@@ -53,7 +52,6 @@ typedef struct _GLFWlibraryNSGL
{ {
// dlopen handle for OpenGL.framework (for glfwGetProcAddress) // dlopen handle for OpenGL.framework (for glfwGetProcAddress)
CFBundleRef framework; CFBundleRef framework;
} _GLFWlibraryNSGL; } _GLFWlibraryNSGL;
+1 -1
View File
@@ -365,7 +365,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(nil); _GLFW_REQUIRE_INIT_OR_RETURN(nil);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_NATIVE_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return nil; return nil;
+13 -1
View File
@@ -302,6 +302,12 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width,
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return GLFW_FALSE;
}
if (!OSMesaGetColorBuffer(window->context.osmesa.handle, if (!OSMesaGetColorBuffer(window->context.osmesa.handle,
&mesaWidth, &mesaHeight, &mesaWidth, &mesaHeight,
&mesaFormat, &mesaBuffer)) &mesaFormat, &mesaBuffer))
@@ -335,6 +341,12 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle,
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return GLFW_FALSE;
}
if (!OSMesaGetDepthBuffer(window->context.osmesa.handle, if (!OSMesaGetDepthBuffer(window->context.osmesa.handle,
&mesaWidth, &mesaHeight, &mesaWidth, &mesaHeight,
&mesaBytes, &mesaBuffer)) &mesaBytes, &mesaBuffer))
@@ -361,7 +373,7 @@ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_OSMESA_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL; return NULL;
-2
View File
@@ -66,7 +66,6 @@ typedef struct _GLFWcontextOSMesa
int width; int width;
int height; int height;
void* buffer; void* buffer;
} _GLFWcontextOSMesa; } _GLFWcontextOSMesa;
// OSMesa-specific global data // OSMesa-specific global data
@@ -82,7 +81,6 @@ typedef struct _GLFWlibraryOSMesa
PFN_OSMesaGetColorBuffer GetColorBuffer; PFN_OSMesaGetColorBuffer GetColorBuffer;
PFN_OSMesaGetDepthBuffer GetDepthBuffer; PFN_OSMesaGetDepthBuffer GetDepthBuffer;
PFN_OSMesaGetProcAddress GetProcAddress; PFN_OSMesaGetProcAddress GetProcAddress;
} _GLFWlibraryOSMesa; } _GLFWlibraryOSMesa;
-2
View File
@@ -37,7 +37,6 @@ typedef struct _GLFWtlsPOSIX
{ {
GLFWbool allocated; GLFWbool allocated;
pthread_key_t key; pthread_key_t key;
} _GLFWtlsPOSIX; } _GLFWtlsPOSIX;
// POSIX-specific mutex data // POSIX-specific mutex data
@@ -46,6 +45,5 @@ typedef struct _GLFWmutexPOSIX
{ {
GLFWbool allocated; GLFWbool allocated;
pthread_mutex_t handle; pthread_mutex_t handle;
} _GLFWmutexPOSIX; } _GLFWmutexPOSIX;
-1
View File
@@ -36,7 +36,6 @@ typedef struct _GLFWtimerPOSIX
{ {
GLFWbool monotonic; GLFWbool monotonic;
uint64_t frequency; uint64_t frequency;
} _GLFWtimerPOSIX; } _GLFWtimerPOSIX;
+7 -5
View File
@@ -165,6 +165,9 @@ static int choosePixelFormat(_GLFWwindow* window,
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
continue; continue;
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
continue;
u->redBits = findAttribValue(WGL_RED_BITS_ARB); u->redBits = findAttribValue(WGL_RED_BITS_ARB);
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB); u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB); u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
@@ -182,8 +185,6 @@ static int choosePixelFormat(_GLFWwindow* window,
if (findAttribValue(WGL_STEREO_ARB)) if (findAttribValue(WGL_STEREO_ARB))
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB))
u->doublebuffer = GLFW_TRUE;
if (_glfw.wgl.ARB_multisample) if (_glfw.wgl.ARB_multisample)
u->samples = findAttribValue(WGL_SAMPLES_ARB); u->samples = findAttribValue(WGL_SAMPLES_ARB);
@@ -239,6 +240,9 @@ static int choosePixelFormat(_GLFWwindow* window,
if (pfd.iPixelType != PFD_TYPE_RGBA) if (pfd.iPixelType != PFD_TYPE_RGBA)
continue; continue;
if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer)
continue;
u->redBits = pfd.cRedBits; u->redBits = pfd.cRedBits;
u->greenBits = pfd.cGreenBits; u->greenBits = pfd.cGreenBits;
u->blueBits = pfd.cBlueBits; u->blueBits = pfd.cBlueBits;
@@ -256,8 +260,6 @@ static int choosePixelFormat(_GLFWwindow* window,
if (pfd.dwFlags & PFD_STEREO) if (pfd.dwFlags & PFD_STEREO)
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
u->doublebuffer = GLFW_TRUE;
} }
u->handle = pixelFormat; u->handle = pixelFormat;
@@ -785,7 +787,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.client == GLFW_NO_API) if (window->context.source != GLFW_NATIVE_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL; return NULL;
-2
View File
@@ -115,7 +115,6 @@ typedef struct _GLFWcontextWGL
HDC dc; HDC dc;
HGLRC handle; HGLRC handle;
int interval; int interval;
} _GLFWcontextWGL; } _GLFWcontextWGL;
// WGL-specific global data // WGL-specific global data
@@ -148,7 +147,6 @@ typedef struct _GLFWlibraryWGL
GLFWbool ARB_create_context_robustness; GLFWbool ARB_create_context_robustness;
GLFWbool ARB_create_context_no_error; GLFWbool ARB_create_context_no_error;
GLFWbool ARB_context_flush_control; GLFWbool ARB_context_flush_control;
} _GLFWlibraryWGL; } _GLFWlibraryWGL;
+4 -14
View File
@@ -39,6 +39,10 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID =
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG) #if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
#if defined(_GLFW_BUILD_DLL)
#pragma message("These symbols must be exported by the executable and have no effect in a DLL")
#endif
// Executables (but not DLLs) exporting this symbol with this value will be // Executables (but not DLLs) exporting this symbol with this value will be
// automatically directed to the high-performance GPU on Nvidia Optimus systems // automatically directed to the high-performance GPU on Nvidia Optimus systems
// with up-to-date drivers // with up-to-date drivers
@@ -68,17 +72,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
// //
static GLFWbool loadLibraries(void) static GLFWbool loadLibraries(void)
{ {
_glfw.win32.winmm.instance = LoadLibraryA("winmm.dll");
if (!_glfw.win32.winmm.instance)
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"Win32: Failed to load winmm.dll");
return GLFW_FALSE;
}
_glfw.win32.winmm.GetTime = (PFN_timeGetTime)
GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime");
_glfw.win32.user32.instance = LoadLibraryA("user32.dll"); _glfw.win32.user32.instance = LoadLibraryA("user32.dll");
if (!_glfw.win32.user32.instance) if (!_glfw.win32.user32.instance)
{ {
@@ -176,9 +169,6 @@ static void freeLibraries(void)
if (_glfw.win32.dinput8.instance) if (_glfw.win32.dinput8.instance)
FreeLibrary(_glfw.win32.dinput8.instance); FreeLibrary(_glfw.win32.dinput8.instance);
if (_glfw.win32.winmm.instance)
FreeLibrary(_glfw.win32.winmm.instance);
if (_glfw.win32.user32.instance) if (_glfw.win32.user32.instance)
FreeLibrary(_glfw.win32.user32.instance); FreeLibrary(_glfw.win32.user32.instance);
+1
View File
@@ -28,6 +28,7 @@
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
#define _GLFW_PLATFORM_MAPPING_NAME "Windows" #define _GLFW_PLATFORM_MAPPING_NAME "Windows"
#define GLFW_BUILD_WIN32_MAPPINGS
// Joystick element (axis, button or slider) // Joystick element (axis, button or slider)
// //
+2 -19
View File
@@ -39,8 +39,8 @@
#endif #endif
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_ARB_debug_output // example to allow applications to correctly declare a GL_KHR_debug callback)
// callback) but windows.h assumes no one will define APIENTRY before it does // but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY #undef APIENTRY
// GLFW on Windows is Unicode only and does not work in MBCS mode // GLFW on Windows is Unicode only and does not work in MBCS mode
@@ -218,10 +218,6 @@ typedef enum
#define DIDFT_OPTIONAL 0x80000000 #define DIDFT_OPTIONAL 0x80000000
#endif #endif
// winmm.dll function pointer typedefs
typedef DWORD (WINAPI * PFN_timeGetTime)(void);
#define timeGetTime _glfw.win32.winmm.GetTime
// xinput.dll function pointer typedefs // xinput.dll function pointer typedefs
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*); typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*); typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
@@ -328,7 +324,6 @@ typedef struct _GLFWwindowWin32
int lastCursorPosX, lastCursorPosY; int lastCursorPosX, lastCursorPosY;
// The last recevied high surrogate when decoding pairs of UTF-16 messages // The last recevied high surrogate when decoding pairs of UTF-16 messages
WCHAR highSurrogate; WCHAR highSurrogate;
} _GLFWwindowWin32; } _GLFWwindowWin32;
// Win32-specific global data // Win32-specific global data
@@ -351,11 +346,6 @@ typedef struct _GLFWlibraryWin32
int rawInputSize; int rawInputSize;
UINT mouseTrailSize; UINT mouseTrailSize;
struct {
HINSTANCE instance;
PFN_timeGetTime GetTime;
} winmm;
struct { struct {
HINSTANCE instance; HINSTANCE instance;
PFN_DirectInput8Create Create; PFN_DirectInput8Create Create;
@@ -396,7 +386,6 @@ typedef struct _GLFWlibraryWin32
HINSTANCE instance; HINSTANCE instance;
PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_; PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
} ntdll; } ntdll;
} _GLFWlibraryWin32; } _GLFWlibraryWin32;
// Win32-specific per-monitor data // Win32-specific per-monitor data
@@ -411,7 +400,6 @@ typedef struct _GLFWmonitorWin32
char publicDisplayName[32]; char publicDisplayName[32];
GLFWbool modesPruned; GLFWbool modesPruned;
GLFWbool modeChanged; GLFWbool modeChanged;
} _GLFWmonitorWin32; } _GLFWmonitorWin32;
// Win32-specific per-cursor data // Win32-specific per-cursor data
@@ -419,16 +407,13 @@ typedef struct _GLFWmonitorWin32
typedef struct _GLFWcursorWin32 typedef struct _GLFWcursorWin32
{ {
HCURSOR handle; HCURSOR handle;
} _GLFWcursorWin32; } _GLFWcursorWin32;
// Win32-specific global timer data // Win32-specific global timer data
// //
typedef struct _GLFWtimerWin32 typedef struct _GLFWtimerWin32
{ {
GLFWbool hasPC;
uint64_t frequency; uint64_t frequency;
} _GLFWtimerWin32; } _GLFWtimerWin32;
// Win32-specific thread local storage data // Win32-specific thread local storage data
@@ -437,7 +422,6 @@ typedef struct _GLFWtlsWin32
{ {
GLFWbool allocated; GLFWbool allocated;
DWORD index; DWORD index;
} _GLFWtlsWin32; } _GLFWtlsWin32;
// Win32-specific mutex data // Win32-specific mutex data
@@ -446,7 +430,6 @@ typedef struct _GLFWmutexWin32
{ {
GLFWbool allocated; GLFWbool allocated;
CRITICAL_SECTION section; CRITICAL_SECTION section;
} _GLFWmutexWin32; } _GLFWmutexWin32;
+4 -20
View File
@@ -38,18 +38,7 @@
// //
void _glfwInitTimerWin32(void) void _glfwInitTimerWin32(void)
{ {
uint64_t frequency; QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency);
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
{
_glfw.timer.win32.hasPC = GLFW_TRUE;
_glfw.timer.win32.frequency = frequency;
}
else
{
_glfw.timer.win32.hasPC = GLFW_FALSE;
_glfw.timer.win32.frequency = 1000;
}
} }
@@ -59,14 +48,9 @@ void _glfwInitTimerWin32(void)
uint64_t _glfwPlatformGetTimerValue(void) uint64_t _glfwPlatformGetTimerValue(void)
{ {
if (_glfw.timer.win32.hasPC) uint64_t value;
{ QueryPerformanceCounter((LARGE_INTEGER*) &value);
uint64_t value; return value;
QueryPerformanceCounter((LARGE_INTEGER*) &value);
return value;
}
else
return (uint64_t) timeGetTime();
} }
uint64_t _glfwPlatformGetTimerFrequency(void) uint64_t _glfwPlatformGetTimerFrequency(void)
+1 -1
View File
@@ -2067,7 +2067,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) || if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN) _glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
{ {
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
return NULL; return NULL;
} }
+2
View File
@@ -205,6 +205,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->focusOnShow = wndconfig.focusOnShow; window->focusOnShow = wndconfig.focusOnShow;
window->cursorMode = GLFW_CURSOR_NORMAL; window->cursorMode = GLFW_CURSOR_NORMAL;
window->doublebuffer = fbconfig.doublebuffer;
window->minwidth = GLFW_DONT_CARE; window->minwidth = GLFW_DONT_CARE;
window->minheight = GLFW_DONT_CARE; window->minheight = GLFW_DONT_CARE;
window->maxwidth = GLFW_DONT_CARE; window->maxwidth = GLFW_DONT_CARE;
+5 -2
View File
@@ -26,6 +26,8 @@
// It is fine to use C99 in this file because it will not be built with VS // It is fine to use C99 in this file because it will not be built with VS
//======================================================================== //========================================================================
#define _POSIX_C_SOURCE 200809L
#include "internal.h" #include "internal.h"
#include <assert.h> #include <assert.h>
@@ -102,6 +104,7 @@ static void pointerHandleEnter(void* data,
window->wl.decorations.focus = focus; window->wl.decorations.focus = focus;
_glfw.wl.serial = serial; _glfw.wl.serial = serial;
_glfw.wl.pointerEnterSerial = serial;
_glfw.wl.pointerFocus = window; _glfw.wl.pointerFocus = window;
window->wl.hovered = GLFW_TRUE; window->wl.hovered = GLFW_TRUE;
@@ -161,7 +164,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
buffer = wl_cursor_image_get_buffer(image); buffer = wl_cursor_image_get_buffer(image);
if (!buffer) if (!buffer)
return; return;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
surface, surface,
image->hotspot_x / scale, image->hotspot_x / scale,
image->hotspot_y / scale); image->hotspot_y / scale);
@@ -558,7 +561,7 @@ static GLFWbool inputChar(_GLFWwindow* window, uint32_t key)
} }
} }
return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, syms[0]); return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, code);
} }
static void keyboardHandleKey(void* data, static void keyboardHandleKey(void* data,
+2 -4
View File
@@ -47,15 +47,13 @@ static void outputHandleGeometry(void* data,
int32_t transform) int32_t transform)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor *monitor = data;
char name[1024];
monitor->wl.x = x; monitor->wl.x = x;
monitor->wl.y = y; monitor->wl.y = y;
monitor->widthMM = physicalWidth; monitor->widthMM = physicalWidth;
monitor->heightMM = physicalHeight; monitor->heightMM = physicalHeight;
snprintf(name, sizeof(name), "%s %s", make, model); snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
monitor->name = _glfw_strdup(name);
} }
static void outputHandleMode(void* data, static void outputHandleMode(void* data,
@@ -133,7 +131,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
} }
// The actual name of this output will be set in the geometry handler. // The actual name of this output will be set in the geometry handler.
monitor = _glfwAllocMonitor(NULL, 0, 0); monitor = _glfwAllocMonitor("", 0, 0);
output = wl_registry_bind(_glfw.wl.registry, output = wl_registry_bind(_glfw.wl.registry,
name, name,
+1 -5
View File
@@ -158,7 +158,6 @@ typedef enum _GLFWdecorationSideWayland
leftDecoration, leftDecoration,
rightDecoration, rightDecoration,
bottomDecoration, bottomDecoration,
} _GLFWdecorationSideWayland; } _GLFWdecorationSideWayland;
typedef struct _GLFWdecorationWayland typedef struct _GLFWdecorationWayland
@@ -166,7 +165,6 @@ typedef struct _GLFWdecorationWayland
struct wl_surface* surface; struct wl_surface* surface;
struct wl_subsurface* subsurface; struct wl_subsurface* subsurface;
struct wp_viewport* viewport; struct wp_viewport* viewport;
} _GLFWdecorationWayland; } _GLFWdecorationWayland;
// Wayland-specific per-window data // Wayland-specific per-window data
@@ -216,7 +214,6 @@ typedef struct _GLFWwindowWayland
_GLFWdecorationWayland top, left, right, bottom; _GLFWdecorationWayland top, left, right, bottom;
int focus; int focus;
} decorations; } decorations;
} _GLFWwindowWayland; } _GLFWwindowWayland;
// Wayland-specific global data // Wayland-specific global data
@@ -252,6 +249,7 @@ typedef struct _GLFWlibraryWayland
const char* cursorPreviousName; const char* cursorPreviousName;
int cursorTimerfd; int cursorTimerfd;
uint32_t serial; uint32_t serial;
uint32_t pointerEnterSerial;
int32_t keyboardRepeatRate; int32_t keyboardRepeatRate;
int32_t keyboardRepeatDelay; int32_t keyboardRepeatDelay;
@@ -325,7 +323,6 @@ typedef struct _GLFWlibraryWayland
PFN_wl_egl_window_destroy window_destroy; PFN_wl_egl_window_destroy window_destroy;
PFN_wl_egl_window_resize window_resize; PFN_wl_egl_window_resize window_resize;
} egl; } egl;
} _GLFWlibraryWayland; } _GLFWlibraryWayland;
// Wayland-specific per-monitor data // Wayland-specific per-monitor data
@@ -339,7 +336,6 @@ typedef struct _GLFWmonitorWayland
int x; int x;
int y; int y;
int scale; int scale;
} _GLFWmonitorWayland; } _GLFWmonitorWayland;
// Wayland-specific per-cursor data // Wayland-specific per-cursor data
+3 -3
View File
@@ -796,7 +796,7 @@ static void setCursorImage(_GLFWwindow* window,
cursorWayland->yhot = image->hotspot_y; cursorWayland->yhot = image->hotspot_y;
} }
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
surface, surface,
cursorWayland->xhot / scale, cursorWayland->xhot / scale,
cursorWayland->yhot / scale); cursorWayland->yhot / scale);
@@ -1547,7 +1547,7 @@ static void lockPointer(_GLFWwindow* window)
window->wl.pointerLock.relativePointer = relativePointer; window->wl.pointerLock.relativePointer = relativePointer;
window->wl.pointerLock.lockedPointer = lockedPointer; window->wl.pointerLock.lockedPointer = lockedPointer;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
NULL, 0, 0); NULL, 0, 0);
} }
@@ -1611,7 +1611,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
} }
else if (window->cursorMode == GLFW_CURSOR_HIDDEN) else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
{ {
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0);
} }
} }
-4
View File
@@ -202,7 +202,6 @@ typedef struct _GLFWwindowX11
// The time of the last KeyPress event per keycode, for discarding // The time of the last KeyPress event per keycode, for discarding
// duplicate key events generated for some keys by ibus // duplicate key events generated for some keys by ibus
Time keyPressTimes[256]; Time keyPressTimes[256];
} _GLFWwindowX11; } _GLFWwindowX11;
// X11-specific global data // X11-specific global data
@@ -405,7 +404,6 @@ typedef struct _GLFWlibraryX11
PFN_XRenderQueryVersion QueryVersion; PFN_XRenderQueryVersion QueryVersion;
PFN_XRenderFindVisualFormat FindVisualFormat; PFN_XRenderFindVisualFormat FindVisualFormat;
} xrender; } xrender;
} _GLFWlibraryX11; } _GLFWlibraryX11;
// X11-specific per-monitor data // X11-specific per-monitor data
@@ -419,7 +417,6 @@ typedef struct _GLFWmonitorX11
// Index of corresponding Xinerama screen, // Index of corresponding Xinerama screen,
// for EWMH full screen window placement // for EWMH full screen window placement
int index; int index;
} _GLFWmonitorX11; } _GLFWmonitorX11;
// X11-specific per-cursor data // X11-specific per-cursor data
@@ -427,7 +424,6 @@ typedef struct _GLFWmonitorX11
typedef struct _GLFWcursorX11 typedef struct _GLFWcursorX11
{ {
Cursor handle; Cursor handle;
} _GLFWcursorX11; } _GLFWcursorX11;
+21 -17
View File
@@ -2500,7 +2500,11 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
} }
if (window->monitor) if (window->monitor)
{
_glfwPlatformSetWindowDecorated(window, window->decorated);
_glfwPlatformSetWindowFloating(window, window->floating);
releaseMonitor(window); releaseMonitor(window);
}
_glfwInputWindowMonitor(window, monitor); _glfwInputWindowMonitor(window, monitor);
updateNormalHints(window, width, height); updateNormalHints(window, width, height);
@@ -2682,14 +2686,14 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
break; break;
} }
if (i < count) if (i == count)
return; {
XChangeProperty(_glfw.x11.display, window->x11.handle,
XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32,
_glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeAppend,
PropModeAppend, (unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE, 1);
1); }
} }
else if (states) else if (states)
{ {
@@ -2699,15 +2703,15 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
break; break;
} }
if (i == count) if (i < count)
return; {
states[i] = states[count - 1];
count--;
states[i] = states[count - 1]; XChangeProperty(_glfw.x11.display, window->x11.handle,
count--; _glfw.x11.NET_WM_STATE, XA_ATOM, 32,
PropModeReplace, (unsigned char*) states, count);
XChangeProperty(_glfw.x11.display, window->x11.handle, }
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
PropModeReplace, (unsigned char*) states, count);
} }
if (states) if (states)
@@ -2882,7 +2886,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
if (scancode < 0 || scancode > 0xff || if (scancode < 0 || scancode > 0xff ||
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN) _glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
{ {
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
return NULL; return NULL;
} }
+7 -2
View File
@@ -7,7 +7,8 @@ if (MATH_LIBRARY)
link_libraries("${MATH_LIBRARY}") link_libraries("${MATH_LIBRARY}")
endif() endif()
if (MSVC) # Workaround for the MS CRT deprecating parts of the standard library
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif() endif()
@@ -69,9 +70,13 @@ set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
FOLDER "GLFW3/Tests") FOLDER "GLFW3/Tests")
if (MSVC) if (MSVC)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables # Tell MSVC to use main instead of WinMain
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup") LINK_FLAGS "/ENTRY:mainCRTStartup")
elseif (CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
# Tell Clang using MS CRT to use main instead of WinMain
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
LINK_FLAGS "-Wl,/entry:mainCRTStartup")
endif() endif()
if (APPLE) if (APPLE)