Compare commits

...

101 Commits

Author SHA1 Message Date
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
Camilla Löwy 901d30b973 Update changelog
(cherry picked from commit 2c7f3ce91b)
2021-02-17 21:23:27 +01:00
Camilla Löwy 0c22ebac36 Wayland: Move DPI fallback work to output done
This removes the dependency on the (unspecified) ordering of geometry
and mode events in wl_output.

Based on feedback from @linkmauve and @caramelli.

Related to #1792.

(cherry picked from commit b925a54ef1)
2021-02-17 21:15:51 +01:00
Camilla Löwy 900dda7e89 Win32: Fix content area rescaling on older systems
GLFW_SCALE_TO_MONITOR had no effect on Windows 8.1 up to and including
Windows 10 version 1607 (Anniversary Update), despite those having
support for per-monitor DPI.

That done was to avoid handling systems that have non-client scaling,
introduced in Windows 10 version 1607, without reliable overriding of
the new window size, introduced in Windows 10 version 1703 (Creators
Update).  Both are needed to keep the content area at a fixed size for
windows that have GLFW_SCALE_TO_MONITOR disabled.

This change enables window rescaling on Windows 8.1 and all later
versions but disables non-client scaling for unscaled windows on Windows
10 version 1607.  Versions after 1607 are unaffected.

Fixes #1511.

(cherry picked from commit 729c9988d0)
2021-02-17 21:15:32 +01:00
Camilla Löwy 56230ca173 Win32: Fix full screen windows affected by scaling
Per-monitor DPI scaling should not affect full screen windows.

Fixes #1582.

(cherry picked from commit 410890aa80)
2021-02-17 21:14:47 +01:00
Camilla Löwy c6fa2c8cfb Cocoa: Fix console apps getting a dock icon
Regression introduced by @elmindreda in
8b11867464.

Adapted to 3.3-stable from 6de084000b.
2021-02-10 18:17:16 +01:00
Camilla Löwy 860d9deceb Update changelog and add credit
(cherry picked from commit 9477311130)
2021-02-10 17:14:46 +01:00
Laurent Aphecetche 5a15d8a784 Cocoa: Fix install name for installed dylib
The install name was incorrectly set to a relative path.

This change leaves the install name of the installed dylib as
@rpath/soname.  Those who wish to override this can set the
CMAKE_INSTALL_NAME_DIR variable.

Closes #1504.

(cherry picked from commit 384ff74a46)
2021-02-10 17:14:46 +01:00
Camilla Löwy 8270081334 Simplify references in CMake if-statements
Adapted to 3.3-stable from f8d6801a50.
2021-02-10 17:14:46 +01:00
Camilla Löwy 15b0c43e2d Cocoa: Unify CG display to NS screen mapping
This moves the matching of CG displays to NS screens to monitor
enumeration time.

(cherry picked from commit 3959ee8949)
2021-02-10 17:14:46 +01:00
Camilla Löwy 903c0ebfd1 Update changelog and add credit
Related to #1833.

(cherry picked from commit 8ab40399d3)
2021-02-10 17:14:45 +01:00
Nevyn Bengtsson 8746f68d61 Cocoa: Use modern API to get display name
On Apple Silicon, IOKit is deprecated and there will be no
matching io_service that we can query for name. Luckilly,
NSScreen got an API to fetch the display name in 10.15.

This is a blocker to get glfw running on Apple Silicon.

Fixes #1809.
Closes #1833.

(cherry picked from commit 2bc52ca82e)
2021-02-10 17:14:45 +01:00
Camilla Löwy 14921d1e24 Cocoa: Fix duplicate monitor connection events
(cherry picked from commit 5aff72aa00)
2021-02-10 17:14:45 +01:00
Camilla Löwy eda12dd949 Cocoa: Fix menubar for unbundled apps on 10.15
NSApp setActivationPolicy: was being called too soon when the app was
not bundled and launched from the command line.

This fix is based on #1802 by @richardwilkes.

Fixes #1648.
Closes #1802.

Adapted to 3.3-stable from 8b11867464.
2021-02-10 17:14:45 +01:00
Camilla Löwy 01c362ba37 Update changelog
(cherry picked from commit 552209fe46)
2021-02-09 21:49:17 +01:00
Philip Rideout 078e8fcf55 Cocoa: Fix duplicate video mode detection
Closes #1830.

(cherry picked from commit f5af421a6b)
2021-02-09 21:49:17 +01:00
Camilla Löwy be56132c02 Update repo URL for Nuklear
Fixes #1826.

(cherry picked from commit 5d1d1a01e3)
2021-02-09 21:49:17 +01:00
Camilla Löwy 294b08dcc8 Add credit
Related to #1818.

(cherry picked from commit 6ce6b50787)
2021-02-09 21:49:17 +01:00
ashishgamedev cdd5ee8d36 Fix indentation in internal.h
Closes #1818.

(cherry picked from commit 761f97d6b6)
2021-02-09 21:49:17 +01:00
Bhee 0d7acffd47 Fix minor typo: If if -> If.
(cherry picked from commit 0b9e48fa3d)
2021-02-09 21:49:17 +01:00
Camilla Löwy edb6f674cd Add missing changelog issue number
(cherry picked from commit 7e8da57094)
2021-02-09 21:49:17 +01:00
Leonard König b31d7ddc8c Wayland: Fix destroying CSDs in the correct order
On Wayland we implement Client-Side Decorations if the compositors do not
implement SSDs.  In that case, the destructors of the surfaces were called
in the wrong order, leading to a dereference of an already freed object.
We need to first destroy the subsurface before destroying the parent surface.

Related PR on kitty: https://github.com/kovidgoyal/kitty/pull/3066
Related issue on kitty: https://github.com/kovidgoyal/kitty/issues/3051

Closes #1798.

(cherry picked from commit 0dc1005c85)
2021-02-09 21:49:16 +01:00
Camilla Löwy baf26a6ea7 Cocoa: Fix ObjC being built as C with CMake 3.19
CMake 3.19 adds -xc when the LANGUAGE file property is C, breaking our
workaround for CMake 3.15 and earlier not understanding the .m suffix.

Fixes #1787.

(cherry picked from commit 3327050ca6)
2021-02-09 21:49:16 +01:00
Camilla Löwy 395ab660d5 Win32: Filter out duplicate size events
This mirrors the filtering done on X11 and Cocoa.  Possibly this should
be done by shared code instead.

Fixes #1610.

(cherry picked from commit 0bccc3852b)
2021-02-09 21:49:16 +01:00
Camilla Löwy 7dee4e05f9 Win32: Fix clang-cl interpreting -Wall as /Wall
Unlike -Wall, VS /Wall really means all warnings.

Closes #1780.

(cherry picked from commit ac627706ef)
2021-02-09 21:49:16 +01:00
Camilla Löwy e0b3361683 Win32: Enable /W3 on VS for library sources
/W3 is the default for new VS projects and the library builds cleanly
with it on VS 2010-2019 so let's try to keep it that way.

(cherry picked from commit 6b78419c9a)
2021-02-09 21:49:16 +01:00
Camilla Löwy 0b56adb721 Remove ignored Clang compiler flag
Clang ignores this when C99 is enabled, while GCC does not.  Removing
the checks for Clang to hopefully avoid a false sense of security.

(cherry picked from commit 9b140d08d7)
2020-12-14 22:50:33 +01:00
Camilla Löwy db66a0f028 Add credit
Related to #1779 and #1781.

(cherry picked from commit a506a8dc73)
2020-12-14 22:47:56 +01:00
Nicolas Caramelli 0a16464f5e Update test SPIR-V shader code
Closes #1781.

(cherry picked from commit 8d47dc5894)
2020-12-14 22:47:52 +01:00
Camilla Löwy 5e807a029b Add credit and update changelog
Related to #1775.

(cherry picked from commit 150b11c2763a2c7d4da92ee63bc88a94fb99d06a)
2020-09-30 16:11:34 +02:00
Vladimir Perminov 41ad058ce3 Win32: Fix value for _WIN32_WINNT_WINBLUE
An incorrect value for _WIN32_WINNT_WINBLUE caused GLFW to think Windows
8 was 8.1 or greater.  This led to a crash when attempting to call
SetProcessDpiAwareness.

Closes #1775.

(cherry picked from commit e1d71cfa4701250a44a6c02d1bbb43309ac8a46c)
2020-09-30 16:11:14 +02:00
Camilla Löwy 214c76a3ad Update changelog
Related to #1761.

(cherry picked from commit 89056d796353ccbb0a1df13bb8b01fb1cfe94f08)
2020-09-30 16:10:59 +02:00
Doug Binks c3250be690 Win32: Update all monitor handles on config change
Closes #1761.

(cherry picked from commit fecd711e0bc9779c379f00e63c1ab7a5081e1954)
2020-09-30 16:10:17 +02:00
Camilla Löwy e341080489 Update CODEOWNERS for move to SCSS
(cherry picked from commit 73ef5f0abb)
2020-09-30 16:09:54 +02:00
Luflosi 77dffb341b Use consistent indentation for Doxygen custom stylesheet
Most of this file is indented with tabs but parts are indented with spaces.

Closes #1770.

(cherry picked from commit 58df92acad)
2020-09-30 16:09:46 +02:00
Siavash Eliasi cb8aee8437 Migrate to Sass for Doxygen custom stylesheets
Closes #1759.

(cherry picked from commit 96f9f5c4b9)
2020-09-16 13:31:29 +02:00
Emmanuel Gil Peyrot bbc4caf04c Fix typo in GLFWwindowmaximizefun documentation
Thanks brianzuvich!

Fixes #1764.

(cherry picked from commit 1ed1489831)
2020-09-16 13:31:22 +02:00
Siavash Eliasi c0704e4a63 Improve docs scaling on mobile and small screens
Closes #1757.

(cherry picked from commit bb1d917c2f)
2020-09-02 22:30:43 +02:00
Camilla Löwy 92f80daf4a Support interprocedural optimization override
This policy applies the CMAKE_INTERPROCEDURAL_OPTIMIZATION override to
the GLFW target.

Fixes #1753.

(cherry picked from commit 9d7897f961)
2020-09-02 22:29:59 +02:00
Camilla Löwy 111c8ecea6 Move Wayland build CI to focal
This finally allows us to drop the Wayland workarounds for CI.

Thanks Travis CI!

(cherry picked from commit b3a79103a6)
2020-09-02 22:29:53 +02:00
Camilla Löwy 7728a6a3aa Fix formatting in transition guide
(cherry picked from commit b9dfce0070)
2020-09-02 22:29:37 +02:00
Camilla Löwy 0ab31db9c0 Formatting
(cherry picked from commit 7765451d0f)
2020-09-02 22:29:30 +02:00
Camilla Löwy 8363179eee Win32: Disable fb transparency when it is broken
On Windows 7, when GLFW framebuffer transparency and the DWM are enabled
but DWM transparency is disabled (i.e. when the Transparency setting is
disabled under Personalization > Color), the contents of the framebuffer
is combined with the last frame using additive blending instead of
replacing the previous contents.

This commit limits GLFW framebuffer transparency on Windows 7 to when
DWM transparency is enabled, removing the previous workaround of setting
a layered window color key that led to rendering artifacts.

Fixes #1512.

(cherry picked from commit 05dd2fa298)
2020-09-02 22:27:45 +02:00
Camilla Löwy b8a6254a26 Cocoa: Fix potential leak of CFNumber object
Spotted by Clang static analysis.

(cherry picked from commit a2674a9034)
2020-09-02 22:12:40 +02:00
Camilla Löwy 2a5ac9a6d6 Documentation fix
"Joystick token" is not used anywhere else in the documentation.

(cherry picked from commit e0f7ce402b)
2020-07-22 18:08:20 +02:00
Camilla Löwy 114704262c Wayland: Fix scroll offsets being inverted
Scrolling offsets were inverted compared to X11 and Win32.

Fixes #1463.

(cherry picked from commit f760b124ca)
2020-07-16 13:34:28 +02:00
Camilla Löwy bd2fb9ebaf Wayland: Fix partial framebuffer size retrieval
(cherry picked from commit 5f60c22cfa)
2020-07-16 13:33:58 +02:00
Camilla Löwy 85a169ff50 X11: Fix cursor hover query retry behavior
XQueryPointer returns zero on BadWindow so the retry did not happen.

Related to ceb20c7f97.

(cherry picked from commit 49dbcfcb8c)
2020-07-16 13:32:11 +02:00
Camilla Löwy 539f4bdca2 X11: Fix race in window hovered query
The window decoration window can go away between calls to XQueryPointer,
for example if the GLFW_DECORATED window attribute was just cleared.

(cherry picked from commit ceb20c7f97)
2020-07-16 13:32:04 +02:00
Camilla Löwy 606c0fc03e X11: Fix detection of key events duplicated by XIM
Background: The IM will filter out key events, instead sending exact
duplicate events that are not filtered.  It does not send these for
every event, however, so the duplicate events cannot be relied on for
key input.  Instead we need to identify and discard them.  Since they
are identical, they have the same timestamp as the originals.

The previous duplicate event detection would consume unrelated key
events if the keys were pressed simultaneously, as it only tracked
a single timestamp.

This fixes that issue for any combination of keys, at the expense of
a 1 KB array per GLFW window.

This fix is a stopgap until explicit IME support is done.

Based on #1472 by @LucaRood.

Fixes #1112.
Fixes #1415.
Fixes #1616.
Fixes #1663.
Closes #1472.

(cherry picked from commit 9a3664b4a9)
2020-07-16 13:30:39 +02:00
Camilla Löwy d858e48860 Win32: Fix non-BMP Unicode codepoint input
Supplementary Plane codepoints from WM_CHAR and WM_SYSCHAR messages were
reported as UTF-16 surrogate pairs.

Related to #1635.

(cherry picked from commit 6ce2070392)
2020-06-30 17:21:24 +02:00
Camilla Löwy e6646c8508 Cocoa: Fix regression in private use area check
This fixes a regression introduced by
ad9eb768c9.

(cherry picked from commit e47832ffcf)
2020-06-30 17:14:24 +02:00
Camilla Löwy 9cae95faa3 Cocoa: Fix non-BMP Unicode codepoint input
Supplimentary Plane codepoints were reported as UTF-16 surrogate pairs.

Fixes #1635.

(cherry picked from commit ad9eb768c9)
2020-06-30 17:14:13 +02:00
Camilla Löwy 26aaa007e0 Fix format of change log entry
(cherry picked from commit 854ce1db4e)
2020-06-30 17:13:11 +02:00
Camilla Löwy f921caf4a6 Re-word docs for GLFW_OPENGL_DEBUG_CONTEXT attrib
Related to #1720.

(cherry picked from commit 4e3b43383a)
2020-06-30 17:10:50 +02:00
A. Tombs 9aefb67358 Re-word docs for OPENGL_DEBUG_CONTEXT hint
Re-worded documentation for the `GLFW_OPENGL_DEBUG_CONTEXT` window hint
to avoid implying that it only applies to OpenGL contexts. Added a link
to the relevant Khronos extension description.

Closes #1720.

(cherry picked from commit 8a69a0d7e5)
2020-06-30 17:10:44 +02:00
Luflosi 1730184971 Fix typos
(cherry picked from commit b66f105f3e)
2020-06-30 17:09:55 +02:00
Camilla Löwy 325b4186d3 Remove deprecated sudo key from Travis CI config
(cherry picked from commit bf1c62b261)
2020-06-30 17:07:59 +02:00
Camilla Löwy 92c6209530 Add credit
Related to #1712.

(cherry picked from commit 3a3c32c6b1)
2020-06-30 17:07:51 +02:00
Tatsuya Yatagawa 307ce3aa1a Fix GLU header inclusion being disabled
This fixes a regression introduced by
105cf32e0b where GLFW_INCLUDE_GLU had no
effect if the GLFW header detected an earlier OpenGL header or loader
library header.

Closes #1712.

(cherry picked from commit 81f475bccb)
2020-06-30 17:07:47 +02:00
Camilla Löwy d7b67a2eb4 Fix MinGW linker flag tests breaking later tests
(cherry picked from commit cfc23cd087)
2020-06-30 17:04:44 +02:00
Camilla Löwy 5dbca2e2c9 Wayland: Fix repeated keys reported to NULL window
This fixes a race between the key repeat logic and the surface leave
event handler, which could result in repeated keys being reported with
a window of NULL.

Fixes #1704.

(cherry picked from commit c72da994ba)
2020-06-30 17:04:04 +02:00
Camilla Löwy 63af05c419 Clarify docs on default GL header inclusion
The documentation claims that any extension loader library header
included before the GLFW one will prevent the inclusion of the
default OpenGL header.  In reality this only worked if the loader
defined the canonical desktop OpenGL __gl_h_ inclusion guard and even
then relied on the OpenGL header to detect this.

This is the companion to 105cf32e0b, which
added the preprocessor logic to check for many known OpenGL and OpenGL
ES inclusion guards and not even attempt to include the default header
if any are present.

Some clarification of the language around header inclusion has also been
attempted, including making GLFW_INCLUDE_NONE more prominent.

Fixes #1695.

(cherry picked from commit 399c2a1fad)
2020-06-02 19:02:10 +02:00
Camilla Löwy e336288eeb Fix typo in header option macro docs
(cherry picked from commit fbf8aae44f)
2020-06-02 19:01:28 +02:00
A. Tombs fb0c8d4662 Add statement to docs for glfwTerminate
It is safe to call glfwTerminate both before initialization and after
termination.

Closes #1698.

(cherry picked from commit 7486e12f88)
2020-06-02 19:01:25 +02:00
Camilla Löwy 78ad4e8f36 Fix desktop GL header not always being suppressed
If an OpenGL ES header or the glcorearb header is included before the
GLFW header (with no options defined), the legacy OpenGL header will be
implicitly included and the compilation will fail.

This disables the default behavior if we detect any known OpenGL, OpenGL
ES or extension loader inclusion guard macro.

Sources:
 - Khronos headers
 - Windows SDK
 - MinGW
 - MinGW-w64
 - flextGL
 - glad
 - glad2
 - GLEW
 - Galogen
 - gl3w
 - GLXW
 - glbinding
 - Epoxy
 - Glatter
 - glLoadGen
 - Regal
 - GLee
 - OpenGL.framework
 - Debian
 - FreeBSD
 - ANGLE
 - SwiftShader

Related to #1695.

(cherry picked from commit 105cf32e0b)
2020-06-02 19:01:21 +02:00
ben1 37a86f24f0 Win32: Fix VS /W4 compile warnings
These are harmless errors but the code was worth fixing just to reduce
confusion and be more explicit.  E.g. using a different variable name
for a new variable of a different type in win32_joystick.c.

Closes #1700.

(cherry picked from commit a84a30ab63)
2020-06-02 19:01:15 +02:00
Luflosi 11e5102d83 Use the correct type in a for loop
The `atomCount` variable has the type `unsigned long`,
so the `for` loop iterating over it should use the same type.

Closes #1701.

(cherry picked from commit 250b94cd03)
2020-06-02 19:01:09 +02:00
Luflosi a8e5c530ee Replace %m conversion specifier with %s and strerror()
When compiling with `-Wall` and `-pedantic-errors`, gcc complains with
```
warning: ISO C does not support the '%m' gnu_printf format [-Wformat=]
```
because the `%m` conversion specifier is a GNU extension.

Closes #1702.

(cherry picked from commit d4f5074535)
2020-06-02 19:01:05 +02:00
Corentin Wallez 8b63ca53de Use CALayer instead of NSView for EGLNativeWindowType
The only two EGL implementations on macOS are Swiftshader and ANGLE.
While Swiftshader supports both `NSView` and `CALayer` as
`EGLNativeWindowType`, ANGLE supports only `CALayer`. Furthermore
Swiftshader's OpenGL ES frontend is deprecated in favor of using ANGLE's
Vulkan backend on top of Swiftshader's Vulkan frontend.

This means that on macOS `EGLNativeWindowType` should be a `CALayer` for
compatibility with ANGLE.

Fixes #1169.
Closes #1680.

(cherry picked from commit 91eebe922d)
2020-06-02 19:00:53 +02:00
Camilla Löwy ca2cd2f796 X11: Clarify function name and comment
(cherry picked from commit 5f9dfe3d83)
2020-05-22 16:29:54 +02:00
Camilla Löwy 0a7c24e48c X11: Clarify code flow for Clang static analysis
(cherry picked from commit ef5220d6b1)
2020-05-22 16:27:33 +02:00
Camilla Löwy 48bc089e9e X11: Fix XKB events being passed on to core path
(cherry picked from commit a17a1b2011)
2020-05-22 16:27:22 +02:00
Camilla Löwy 3df4ebeaac X11: Fix XKB state event bits being overwritten
This limits the update to the XKB group state event bit without clearing
all other state event bits.

(cherry picked from commit e07925c404)
2020-05-22 16:27:16 +02:00
Camilla Löwy dff64496d6 X11: Remove duplicate XKB group initialization
The XKB group is already set to zero during initialization.

(cherry picked from commit cf3a03a85d)
2020-05-22 16:27:10 +02:00
Camilla Löwy 117f7694b2 X11: Fix XKB group event depending on state query
This fixes XKB group change events not being enabled if the initial
XKB keyboard state query fails.

(cherry picked from commit 0c403c8ca6)
2020-05-22 16:27:02 +02:00
Camilla Löwy d0c0997528 Add null platform to Travis CI
(cherry picked from commit 844bc8031c)
2020-05-19 14:33:31 +02:00
gre-42 e145d89a96 Correct sign in mat4x4_rotate_Y
Signs were incorrect in mat4x4_rotate_Y.

Closes #1673.

(cherry picked from commit 67c720d117)
2020-05-19 14:33:27 +02:00
Camilla Löwy 10c01512f2 Update community resource links
(cherry picked from commit d7ae90a790)
2020-05-19 14:33:23 +02:00
Camilla Löwy 8216a148cf Disambiguate Vulkan support reference link
(cherry picked from commit 41a19ed49c)
2020-05-19 14:33:20 +02:00
Camilla Löwy 6e01359e36 Cocoa: Fix call to NSWindow from non-main threads
glfwSwapBuffers may be called by any thread but NSWindow may not.

Bug introduced by c3ca88055f and reported
by @crujose.

(cherry picked from commit 949275bbed)
2020-05-19 14:33:15 +02:00
Camilla Löwy 404c28df3d X11: Improve non-XKB fallback for key mapping
A regression introduced by b889aa7841
broke the special handling of numpad keys for the non-XKB fallback path.
The non-functional remains were later removed.  This restores the
original behavior.

(cherry picked from commit cab41529da)
2020-05-05 00:18:59 +02:00
Camilla Löwy b0c79896a3 X11: Add additional XKB key names for Right Alt
(cherry picked from commit 318e08d914)
2020-05-05 00:18:54 +02:00
Camilla Löwy 4aaf8ba1d2 X11: Use XKB key name MENU for Menu key
(cherry picked from commit 560304e0f4)
2020-05-05 00:18:51 +02:00
Camilla Löwy cf87e6549c X11: Check XKB key aliases in addition to names
(cherry picked from commit 9ecacf1d7f)
2020-05-05 00:18:48 +02:00
Camilla Löwy 27d7fc098d X11: Fix X keycode ranges for XKB and core
This replaces the hardcoded keycode ranges and various kludgy range
checks with the actual ranges reported by Xlib and XKB.

(cherry picked from commit ee45b58647)
2020-05-05 00:18:16 +02:00
Camilla Löwy ec5610deda Update changelog and add credit
Related to #1598.

(cherry picked from commit 215a05af3d)
2020-05-05 00:15:36 +02:00
Ali Sherief b25ee390c1 X11: Fix function keys mapped to GLFW_KEY_UNKNOWN
This fixes the issue where function keys would be reported as
GLFW_KEY_UNKNOWN if XKB was available and one of the configured keyboard
layouts was Arabic.

This is only part of #1598, because the full patch removed parts of the
fallback path for when XKB is unavailable.

Closes #1598.

(cherry picked from commit a41a58a95e)
2020-05-05 00:14:18 +02:00
Camilla Löwy a6d022c257 X11: Improve window handle race condition
The non-root parent window owned by the WM could be destroyed before we
process the ConfigureNotify event using the cached parent handle.

Bug was found by unmapping a decorated window.

This like all uses of the Xlib error handler is not thread safe and
there is nothing we can do about that short of moving to XCB.

Fixes #1633.

(cherry picked from commit e65de2941c)
2020-04-03 17:03:29 +02:00
Camilla Löwy 2d4c4b7949 X11: Filter out Xlib errors from other connections
(cherry picked from commit 2c8e0512dd)
2020-04-03 17:02:51 +02:00
Camilla Löwy aee62d3c16 Fix unclear language in build guide
Fixes #1658.

(cherry picked from commit 9516df52a4)
2020-04-03 17:01:40 +02:00
Camilla Löwy c4b4476d78 Wayland: Remove unused link-time dependency
The wayland-egl library is now loaded dynamically at init.  This narrows
the pkgconfig dependencies to the link-time depdendencies.

(cherry picked from commit 6aca3e99f0)
2020-04-03 17:01:22 +02:00
Camilla Löwy 0ac013381b X11: Fix CJK IME input when locale CTYPE is "C"
Fixes #1587.
Fixes #1636.

(cherry picked from commit 4381b86b6b)
2020-02-13 22:03:51 +01:00
Camilla Löwy d99249337e WGL: Remove unused constants
(cherry picked from commit 27d19d06ca)
2020-02-13 22:02:23 +01:00
Camilla Löwy 750b1c5365 Fix rendering race in offscreen example
(cherry picked from commit 4b8ac11aa3)
2020-02-13 22:02:20 +01:00
Camilla Löwy 1d711057a1 X11: Fix setting the clipboard string to itself
(cherry picked from commit 0c27ed1d0e)
2020-02-13 22:02:15 +01:00
Camilla Löwy 3604cc72fc Put docs target in GLFW3 folder
(cherry picked from commit d1ae7bac60)
2020-02-13 22:02:06 +01:00
Camilla Löwy 64c7aa50d0 Start 3.3.3 2020-02-13 22:01:33 +01:00
42 changed files with 912 additions and 657 deletions
+27 -19
View File
@@ -9,7 +9,6 @@ matrix:
include: include:
- os: linux - os: linux
dist: xenial dist: xenial
sudo: false
name: "X11 shared library" name: "X11 shared library"
addons: addons:
apt: apt:
@@ -23,7 +22,6 @@ matrix:
- CFLAGS=-Werror - CFLAGS=-Werror
- os: linux - os: linux
dist: xenial dist: xenial
sudo: false
name: "X11 static library" name: "X11 static library"
addons: addons:
apt: apt:
@@ -36,15 +34,13 @@ matrix:
- BUILD_SHARED_LIBS=OFF - BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror - CFLAGS=-Werror
- os: linux - os: linux
dist: xenial dist: focal
sudo: required
name: "Wayland shared library" name: "Wayland shared library"
addons: addons:
apt: apt:
sources:
- ppa:kubuntu-ppa/backports
packages: packages:
- extra-cmake-modules - extra-cmake-modules
- wayland-protocols
- libwayland-dev - libwayland-dev
- libxkbcommon-dev - libxkbcommon-dev
- libegl1-mesa-dev - libegl1-mesa-dev
@@ -53,15 +49,13 @@ matrix:
- BUILD_SHARED_LIBS=ON - BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror - CFLAGS=-Werror
- os: linux - os: linux
dist: xenial dist: focal
sudo: required
name: "Wayland static library" name: "Wayland static library"
addons: addons:
apt: apt:
sources:
- ppa:kubuntu-ppa/backports
packages: packages:
- extra-cmake-modules - extra-cmake-modules
- wayland-protocols
- libwayland-dev - libwayland-dev
- libxkbcommon-dev - libxkbcommon-dev
- libegl1-mesa-dev - libegl1-mesa-dev
@@ -69,15 +63,35 @@ matrix:
- USE_WAYLAND=ON - USE_WAYLAND=ON
- BUILD_SHARED_LIBS=OFF - BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror - 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 - os: osx
sudo: false
name: "Cocoa shared library" name: "Cocoa shared library"
env: env:
- BUILD_SHARED_LIBS=ON - BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror - CFLAGS=-Werror
- MACOSX_DEPLOYMENT_TARGET=10.8 - MACOSX_DEPLOYMENT_TARGET=10.8
- os: osx - os: osx
sudo: false
name: "Cocoa static library" name: "Cocoa static library"
env: env:
- BUILD_SHARED_LIBS=OFF - BUILD_SHARED_LIBS=OFF
@@ -90,13 +104,7 @@ script:
fi fi
- mkdir build - mkdir build
- cd build - cd build
- if test -n "${USE_WAYLAND}"; then - cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} -DGLFW_USE_OSMESA=${USE_OSMESA} ..
git clone git://anongit.freedesktop.org/wayland/wayland-protocols;
pushd wayland-protocols;
git checkout 1.15 && ./autogen.sh --prefix=/usr && make && sudo make install;
popd;
fi
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} ..
- cmake --build . - cmake --build .
notifications: notifications:
email: email:
+9 -2
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(GLFW VERSION 3.3.2 LANGUAGES C) project(GLFW VERSION 3.3.4 LANGUAGES C)
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
@@ -8,6 +8,10 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
endif() endif()
if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
if (POLICY CMP0077) if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW) cmake_policy(SET CMP0077 NEW)
endif() endif()
@@ -128,6 +132,9 @@ if (MINGW)
if (_GLFW_HAS_64ASLR) if (_GLFW_HAS_64ASLR)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
endif() endif()
# Clear flags again to avoid breaking later tests
set(CMAKE_REQUIRED_FLAGS)
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@@ -244,7 +251,7 @@ if (_GLFW_WAYLAND)
find_package(WaylandScanner REQUIRED) find_package(WaylandScanner REQUIRED)
find_package(WaylandProtocols 1.15 REQUIRED) find_package(WaylandProtocols 1.15 REQUIRED)
list(APPEND glfw_PKG_DEPS "wayland-egl") list(APPEND glfw_PKG_DEPS "wayland-client")
list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
+20 -11
View File
@@ -101,7 +101,7 @@ located in the `deps/` directory.
functions functions
- [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in - [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in
examples examples
- [Nuklear](https://github.com/vurtun/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](http://doxygen.org/) if CMake can
@@ -118,16 +118,8 @@ information on what to include when reporting a bug.
## Changelog ## Changelog
- [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622) - [X11] Bugfix: Some window attributes were not applied on leaving fullscreen
- [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an (#1863)
invalid pointer
- [Win32] Bugfix: Some synthetic key events were reported as `GLFW_KEY_UNKNOWN`
(#1623)
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
- [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
- [X11] Bugfix: Creating an undecorated window could fail with BadMatch (#1620)
- [X11] Bugfix: Querying a disconnected monitor could segfault (#1602)
## Contact ## Contact
@@ -153,13 +145,16 @@ GLFW exists because people around the world donated their time and lent their
skills. skills.
- Bobyshev Alexander - Bobyshev Alexander
- Laurent Aphecetche
- Matt Arsenault - Matt Arsenault
- ashishgamedev
- David Avedissian - David Avedissian
- Keith Bauer - Keith Bauer
- John Bartholomew - John Bartholomew
- Coşku Baş - Coşku Baş
- Niklas Behrens - Niklas Behrens
- Andrew Belt - Andrew Belt
- Nevyn Bengtsson
- Niklas Bergström - Niklas Bergström
- Denis Bernard - Denis Bernard
- Doug Binks - Doug Binks
@@ -168,6 +163,7 @@ skills.
- Rok Breulj - Rok Breulj
- Kai Burjack - Kai Burjack
- Martin Capitanio - Martin Capitanio
- Nicolas Caramelli
- David Carlier - David Carlier
- Arturo Castro - Arturo Castro
- Chi-kwan Chan - Chi-kwan Chan
@@ -206,6 +202,7 @@ skills.
- Eloi Marín Gratacós - Eloi Marín Gratacós
- Stefan Gustavson - Stefan Gustavson
- Jonathan Hale - Jonathan Hale
- hdf89shfdfs
- Sylvain Hellegouarch - Sylvain Hellegouarch
- Matthew Henry - Matthew Henry
- heromyth - heromyth
@@ -230,11 +227,13 @@ skills.
- Konstantin Käfer - Konstantin Käfer
- Eric Larson - Eric Larson
- Francis Lecavalier - Francis Lecavalier
- Jong Won Lee
- Robin Leffmann - Robin Leffmann
- Glenn Lewis - Glenn Lewis
- Shane Liesegang - Shane Liesegang
- Anders Lindqvist - Anders Lindqvist
- Leon Linhart - Leon Linhart
- Marco Lizza
- Eyal Lotem - Eyal Lotem
- Aaron Loucks - Aaron Loucks
- Luflosi - Luflosi
@@ -266,6 +265,7 @@ skills.
- ndogxj - ndogxj
- Kristian Nielsen - Kristian Nielsen
- Kamil Nowakowski - Kamil Nowakowski
- onox
- Denis Ovod - Denis Ovod
- Ozzy - Ozzy
- Andri Pálsson - Andri Pálsson
@@ -273,6 +273,7 @@ skills.
- Braden Pellett - Braden Pellett
- Christopher Pelloux - Christopher Pelloux
- Arturo J. Pérez - Arturo J. Pérez
- Vladimir Perminov
- Anthony Pesch - Anthony Pesch
- Orson Peters - Orson Peters
- Emmanuel Gil Peyrot - Emmanuel Gil Peyrot
@@ -290,8 +291,10 @@ skills.
- Eddie Ringle - Eddie Ringle
- Max Risuhin - Max Risuhin
- Jorge Rodriguez - Jorge Rodriguez
- Luca Rood
- Ed Ropple - Ed Ropple
- Aleksey Rybalkin - Aleksey Rybalkin
- Mikko Rytkönen
- Riku Salminen - Riku Salminen
- Brandon Schaefer - Brandon Schaefer
- Sebastian Schuberth - Sebastian Schuberth
@@ -299,6 +302,7 @@ skills.
- Matt Sealey - Matt Sealey
- Steve Sexton - Steve Sexton
- Arkady Shapkin - Arkady Shapkin
- Ali Sherief
- Yoshiki Shibukawa - Yoshiki Shibukawa
- Dmitri Shuralyov - Dmitri Shuralyov
- Daniel Skorupski - Daniel Skorupski
@@ -331,14 +335,19 @@ skills.
- Torsten Walluhn - Torsten Walluhn
- Patrick Walton - Patrick Walton
- Xo Wang - Xo Wang
- Waris
- Jay Weisskopf - Jay Weisskopf
- Frank Wille - Frank Wille
- Richard A. Wilkes
- Tatsuya Yatagawa
- Ryogo Yoshimura - Ryogo Yoshimura
- Lukas Zanner - Lukas Zanner
- Andrey Zholos - Andrey Zholos
- Aihui Zhu
- Santi Zupancic - Santi Zupancic
- Jonas Ådahl - Jonas Ådahl
- Lasse Öörni - Lasse Öörni
- Leonard König
- All the unmentioned and anonymous contributors in the GLFW community, for bug - All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement reports, patches, feedback, testing and encouragement
+2 -2
View File
@@ -237,9 +237,9 @@ static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle)
float s = sinf(angle); float s = sinf(angle);
float c = cosf(angle); float c = cosf(angle);
mat4x4 R = { mat4x4 R = {
{ c, 0.f, s, 0.f}, { c, 0.f, -s, 0.f},
{ 0.f, 1.f, 0.f, 0.f}, { 0.f, 1.f, 0.f, 0.f},
{ -s, 0.f, c, 0.f}, { s, 0.f, c, 0.f},
{ 0.f, 0.f, 0.f, 1.f} { 0.f, 0.f, 0.f, 1.f}
}; };
mat4x4_mul(Q, M, R); mat4x4_mul(Q, M, R);
+2
View File
@@ -30,3 +30,5 @@ add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}"
WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs" WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs"
COMMENT "Generating HTML documentation" VERBATIM) COMMENT "Generating HTML documentation" VERBATIM)
set_target_properties(docs PROPERTIES FOLDER "GLFW3")
+1 -1
View File
@@ -4,7 +4,7 @@
src/wl_* @linkmauve src/wl_* @linkmauve
docs/*.css @glfw/webdev docs/*.css @glfw/webdev
docs/*.less @glfw/webdev docs/*.scss @glfw/webdev
docs/*.html @glfw/webdev docs/*.html @glfw/webdev
docs/*.xml @glfw/webdev docs/*.xml @glfw/webdev
+28 -22
View File
@@ -25,39 +25,41 @@ GLFW.
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@endcode @endcode
This header declares the GLFW API and by default also includes the OpenGL header This header defines all the constants and declares all the types and function
from your development environment. See below for how to control this. prototypes of the GLFW API. By default it also includes the OpenGL header from
your development environment. See [option macros](@ref build_macros) below for
how to select OpenGL ES headers and more.
The GLFW header also defines any platform-specific macros needed by your OpenGL The GLFW header also defines any platform-specific macros needed by your OpenGL
header, so it can be included without needing any window system headers. header, so that it can be included without needing any window system headers.
For example, under Windows you are normally required to include `windows.h` It does this only when needed, so if window system headers are included, the
before the OpenGL header, which would bring in the whole Win32 API. The GLFW GLFW header does not try to redefine those symbols. The reverse is not true,
header duplicates the small number of macros needed. i.e. `windows.h` cannot cope if any Win32 symbols have already been defined.
It does this only when needed, so if `windows.h` _is_ included, the GLFW header
does not try to redefine those symbols. The reverse is not true, i.e.
`windows.h` cannot cope if any of its symbols have already been defined.
In other words: In other words:
- Do _not_ include the OpenGL headers yourself, as GLFW does this for you - Use the GLFW header to include OpenGL or OpenGL ES headers portably
- Do _not_ include `windows.h` or other platform-specific headers unless you - Do not include window system headers unless you will use those APIs directly
plan on using those APIs directly - If you do need such headers, include them before the GLFW header
- If you _do_ need to include such headers, do it _before_ including
the GLFW header and it will handle this
If you are using an OpenGL extension loading library such as If you are using an OpenGL extension loading library such as
[glad](https://github.com/Dav1dde/glad), the extension loader header should [glad](https://github.com/Dav1dde/glad), the extension loader header should
be included _before_ the GLFW one. be included before the GLFW one. GLFW attempts to detect any OpenGL or OpenGL
ES header or extension loader header included before it and will then disable
the inclusion of the default OpenGL header. Most extension loaders also define
macros that disable similar headers below it.
@code @code
#include <glad/gl.h> #include <glad/gl.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@endcode @endcode
Alternatively the @ref GLFW_INCLUDE_NONE macro (described below) can be used to Both of these mechanisms depend on the extension loader header defining a known
prevent the GLFW header from including the OpenGL header. macro. If yours doesn't or you don't know which one your users will pick, the
@ref GLFW_INCLUDE_NONE macro will explicitly to prevent the GLFW header from
including the OpenGL header. This will also allow you to include the two
headers in any order.
@code @code
#define GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE
@@ -105,7 +107,7 @@ __GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.1
`GLES3/gl31.h` header instead of the regular OpenGL header. `GLES3/gl31.h` header instead of the regular OpenGL header.
@anchor GLFW_INCLUDE_ES32 @anchor GLFW_INCLUDE_ES32
__GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.2 __GLFW_INCLUDE_ES32__ makes the GLFW header include the OpenGL ES 3.2
`GLES3/gl32.h` header instead of the regular OpenGL header. `GLES3/gl32.h` header instead of the regular OpenGL header.
@anchor GLFW_INCLUDE_NONE @anchor GLFW_INCLUDE_NONE
@@ -113,7 +115,8 @@ __GLFW_INCLUDE_NONE__ makes the GLFW header not include any OpenGL or OpenGL ES
API header. This is useful in combination with an extension loading library. API header. This is useful in combination with an extension loading library.
If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h` If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h`
header (`OpenGL/gl.h` on macOS) is included. header (`OpenGL/gl.h` on macOS) is included, unless GLFW detects the inclusion
guards of any OpenGL, OpenGL ES or extension loader header it knows about.
The following macros control the inclusion of additional API headers. Any The following macros control the inclusion of additional API headers. Any
number of these may be defined simultaneously, and/or together with one of the number of these may be defined simultaneously, and/or together with one of the
@@ -219,12 +222,15 @@ find_package(OpenGL REQUIRED)
@endcode @endcode
If OpenGL is found, the `OpenGL::GL` target is added to your project, containing If OpenGL is found, the `OpenGL::GL` target is added to your project, containing
library and include directory paths. Link against this like above. library and include directory paths. Link against this like any other library.
@code{.cmake} @code{.cmake}
target_link_libraries(myapp OpenGL::GL) target_link_libraries(myapp OpenGL::GL)
@endcode @endcode
For a minimal example of a program and GLFW sources built with CMake, see the
[GLFW CMake Starter](https://github.com/juliettef/GLFW-CMake-starter) on GitHub.
@subsection build_link_cmake_package With CMake and installed GLFW binaries @subsection build_link_cmake_package With CMake and installed GLFW binaries
@@ -258,7 +264,7 @@ find_package(OpenGL REQUIRED)
@endcode @endcode
If OpenGL is found, the `OpenGL::GL` target is added to your project, containing If OpenGL is found, the `OpenGL::GL` target is added to your project, containing
library and include directory paths. Link against this like above. library and include directory paths. Link against this like any other library.
@code{.cmake} @code{.cmake}
target_link_libraries(myapp OpenGL::GL) target_link_libraries(myapp OpenGL::GL)
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"version":3,"sourceRoot":"","sources":["extra.scss"],"names":[],"mappings":"AA8EA,4GACI,gBACA,iBAGJ,yBACC,yDAGD,6HACC,sDAGD,yIACC,sDAGD,mBACI,WA9EuB,KA+EvB,iBAGJ,uBACC,MAzFoB,QA0FjB,iBAGJ,6UACC,gBAGD,mJACC,YAGD,yHACC,iBAGD,sBACC,gBAGD,4LACC,UAGD,yCACC,aAGD,kMACC,WAnHgC,QAsHjC,KACC,MA1HoB,QA6HrB,sDACC,MA/Ge,QAgHf,mBAGD,GACE,iBACA,eAGF,GACE,iBACA,gBACA,eAGF,GACE,iBACA,gBACA,eAGF,YACC,eACA,gBACA,gBACA,eACA,cAEA,aACA,mBACA,eACA,2BACA,mBACA,sBAGD,UACC,iBACA,mBACA,MA/J0B,KAgK1B,gBACA,qEAGD,YACC,qBACA,kBACA,YAGD,yBACC,WAGD,oCACC,iBACA,gBACA,cACA,MAlL0B,KAqL3B,YACC,eAGD,8CACC,qBAGD,mBACC,MA9L0B,KAiM3B,eACC,kBACA,YACA,eAGD,KACC,WAxM0B,KA2M3B,UACC,gBACA,cACA,eAGD,WACC,gBACA,cACA,eAGD,UACI,aAGJ,mBACI,iBACA,iBAGJ,WACC,gBACA,aACA,mBACA,eACA,2BACA,mBACA,sBAGD,mEACC,MA9OgC,QAiPjC,gCACC,MArPoB,QAwPrB,sCACC,MAjOoB,KAoOrB,yBACC,kBAGD,UACC,iBAGD,wBACC,gBACA,cACA,eACA,qBAGD,uDACC,gEACA,+BACA,+BACA,gBACA,MArPgB,KAwPjB,mBACC,MA5PoB,KA6PpB,aACA,kBACA,yBAGD,QACC,WACA,WAGD,WACC,iBAGD,WACC,mBAGD,WACC,cACA,eACA,qBAGD,oCACC,gEACA,kCACA,2BACA,MAlSe,QAmSf,yBACA,kBAGD,WACC,MA3QuB,QA8QxB,cACC,sBACA,2BACA,4BACA,mBAGD,cACC,sBACA,+BACA,8BACA,gBAGD,mCACC,wBACA,iBACA,sBACA,kBAGD,gIACC,MAxToB,KAyTpB,qBAGD,cACC,wBACA,iBACA,sBACA,kBAGD,iBACC,WACA,4EAGD,oCApSC,gEACA,kCACA,cACA,yBAqSD,wBAxSC,gEACA,kCACA,cACA,yBAySD,qBA5SC,gEACA,kCACA,cACA,yBA6SD,gBAhTC,gEACA,kCACA,cACA,yBAiTD,iGACC,kBACA,YACA,2BACA,aAGD,kRACC,cAGD,SACC,oBAGD,0BACC,mBACA,kBACA,YACA,YACA,cACA,2BACA,aAGD,+CACC,MA1YoB,QA6YrB,+BACC,cAGD,sBACC,cAGD,+CACC,cACA,iBAGD,mBACC,cAGD,KACC,aACA","file":"extra.css"}
+110 -94
View File
@@ -1,106 +1,106 @@
// NOTE: Please use this file to perform modifications on default style sheets. // NOTE: Please use this file to perform modifications on default style sheets.
// //
// You need to install a few Ruby gems to generate extra.css from this file: // You need to install the official Sass CLI tool:
// gem install less therubyracer // npm install -g sass
// //
// Run this command to regenerate extra.css after you're finished with changes: // Run this command to regenerate extra.css after you're finished with changes:
// lessc --compress extra.less > extra.css // sass --style=compressed extra.scss extra.css
// //
// Alternatively you can use online services to regenerate extra.css. // Alternatively you can use online services to regenerate extra.css.
// Default text color for page contents // Default text color for page contents
@default-text-color: hsl(0,0%,30%); $default-text-color: hsl(0,0%,30%);
// Page header, footer, table rows, inline codes and definition lists // Page header, footer, table rows, inline codes and definition lists
@header-footer-background-color: hsl(0,0%,95%); $header-footer-background-color: hsl(0,0%,95%);
// Page header, footer links and navigation bar background // Page header, footer links and navigation bar background
@header-footer-link-color: hsl(0,0%,40%); $header-footer-link-color: hsl(0,0%,40%);
// Doxygen navigation bar links // Doxygen navigation bar links
@navbar-link-color: @header-footer-background-color; $navbar-link-color: $header-footer-background-color;
// Page content background color // Page content background color
@content-background-color: hsl(0,0%,100%); $content-background-color: hsl(0,0%,100%);
// Bold, italic, h1, h2, ... and table of contents // Bold, italic, h1, h2, ... and table of contents
@heading-color: hsl(0,0%,10%); $heading-color: hsl(0,0%,10%);
// Function, enum and macro definition separator // Function, enum and macro definition separator
@def-separator-color: @header-footer-background-color; $def-separator-color: $header-footer-background-color;
// Base color hue // Base color hue
@base-hue: 24; $base-hue: 24;
// Default color used for links // Default color used for links
@default-link-color: hsl(@base-hue,100%,50%); $default-link-color: hsl($base-hue,100%,50%);
// Doxygen navigation bar active tab // Doxygen navigation bar active tab
@tab-text-color: hsl(0,0%,100%); $tab-text-color: hsl(0,0%,100%);
@tab-background-color1: @default-link-color; $tab-background-color1: $default-link-color;
@tab-background-color2: lighten(spin(@tab-background-color1, 10), 10%); $tab-background-color2: lighten(adjust-hue($tab-background-color1, 10), 10%);
// Table borders // Table borders
@default-border-color: @default-link-color; $default-border-color: $default-link-color;
// Table header // Table header
@table-text-color: @tab-text-color; $table-text-color: $tab-text-color;
@table-background-color1: @tab-background-color1; $table-background-color1: $tab-background-color1;
@table-background-color2: @tab-background-color2; $table-background-color2: $tab-background-color2;
// Table of contents, data structure index and prototypes // Table of contents, data structure index and prototypes
@toc-background-color1: hsl(0,0%,90%); $toc-background-color1: hsl(0,0%,90%);
@toc-background-color2: lighten(@toc-background-color1, 5%); $toc-background-color2: lighten($toc-background-color1, 5%);
// Function prototype parameters color // Function prototype parameters color
@prototype-param-color: darken(@default-link-color, 25%); $prototype-param-color: darken($default-link-color, 25%);
// Message box color: note, pre, post and invariant // Message box color: note, pre, post and invariant
@box-note-color: hsl(103,80%,85%); $box-note-color: hsl(103,80%,85%);
// Message box color: warning and attention // Message box color: warning and attention
@box-warning-color: hsl(34,80%,85%); $box-warning-color: hsl(34,80%,85%);
// Message box color: deprecated and bug // Message box color: deprecated and bug
@box-bug-color: hsl(333,80%,85%); $box-bug-color: hsl(333,80%,85%);
// Message box color: todo and test // Message box color: todo and test
@box-todo-color: hsl(200,80%,85%); $box-todo-color: hsl(200,80%,85%);
// Message box helper function // Message box helper function
.message-box(@base-color) { @mixin message-box($base-color){
background:linear-gradient(to bottom,lighten(@base-color, 5%) 0%,@base-color 100%); background:linear-gradient(to bottom,lighten($base-color, 5%) 0%,$base-color 100%);
box-shadow:inset 0 0 32px darken(@base-color, 5%); box-shadow:inset 0 0 32px darken($base-color, 5%);
color:darken(@base-color, 67%); color:darken($base-color, 67%);
border:2px solid desaturate(darken(@base-color, 10%), 20%); border:2px solid desaturate(darken($base-color, 10%), 20%);
} }
.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover { .sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover {
background:none; background:none;
text-shadow:none; text-shadow:none;
} }
.sm-dox a span.sub-arrow { .sm-dox a span.sub-arrow {
border-color:@navbar-link-color transparent transparent transparent; border-color:$navbar-link-color transparent transparent transparent;
} }
.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow { .sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow {
border-color:@default-link-color transparent transparent transparent; border-color:$default-link-color transparent transparent transparent;
} }
.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow { .sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow {
border-color:transparent transparent transparent @default-link-color; border-color:transparent transparent transparent $default-link-color;
} }
.sm-dox ul a:hover { .sm-dox ul a:hover {
background:@header-footer-link-color; background:$header-footer-link-color;
text-shadow:none; text-shadow:none;
} }
.sm-dox ul.sm-nowrap a { .sm-dox ul.sm-nowrap a {
color:@default-text-color; color:$default-text-color;
text-shadow:none; text-shadow:none;
} }
#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code { #main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code {
@@ -128,55 +128,61 @@ div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.a
} }
html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven { html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven {
background:@header-footer-background-color; background:$header-footer-background-color;
} }
body { body {
color:@default-text-color; color:$default-text-color;
} }
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em { h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
color:@heading-color; color:$heading-color;
border-bottom:none; border-bottom:none;
} }
h1 { h1 {
padding-top:0.5em; padding-top:0.5em;
font-size:180%; font-size:180%;
} }
h2 { h2 {
padding-top:0.5em; padding-top:0.5em;
margin-bottom:0; margin-bottom:0;
font-size:140%; font-size:140%;
} }
h3 { h3 {
padding-top:0.5em; padding-top:0.5em;
margin-bottom:0; margin-bottom:0;
font-size:110%; font-size:110%;
} }
.glfwheader { .glfwheader {
font-size:16px; font-size:16px;
height:64px; min-height:64px;
max-width:920px; max-width:920px;
min-width:800px;
padding:0 32px; padding:0 32px;
margin:0 auto; margin:0 auto;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
align-content: stretch;
} }
#glfwhome { #glfwhome {
line-height:64px; line-height:64px;
padding-right:48px; padding-right:48px;
color:@header-footer-link-color; color:$header-footer-link-color;
font-size:2.5em; font-size:2.5em;
background:url("https://www.glfw.org/css/arrow.png") no-repeat right; background:url("https://www.glfw.org/css/arrow.png") no-repeat right;
} }
.glfwnavbar { .glfwnavbar {
list-style-type:none; list-style-type:none;
margin:0 auto; margin:0 0 0 auto;
float:right; float:right;
} }
@@ -188,7 +194,11 @@ h3 {
line-height:64px; line-height:64px;
margin-left:2em; margin-left:2em;
display:block; display:block;
color:@header-footer-link-color; color:$header-footer-link-color;
}
.glfwnavbar {
padding-left: 0;
} }
#glfwhome,.glfwnavbar a,.glfwnavbar a:visited { #glfwhome,.glfwnavbar a,.glfwnavbar a:visited {
@@ -196,7 +206,7 @@ h3 {
} }
#titlearea,.footer { #titlearea,.footer {
color:@header-footer-link-color; color:$header-footer-link-color;
} }
address.footer { address.footer {
@@ -206,48 +216,54 @@ address.footer {
} }
#top { #top {
background:@header-footer-link-color; background:$header-footer-link-color;
} }
#main-nav { #main-nav {
max-width:960px; max-width:960px;
min-width:800px;
margin:0 auto; margin:0 auto;
font-size:13px; font-size:13px;
} }
#main-menu { #main-menu {
max-width:920px; max-width:920px;
min-width:800px;
margin:0 auto; margin:0 auto;
font-size:13px; font-size:13px;
} }
.memtitle { .memtitle {
display:none; display:none;
} }
.memproto,.memname { .memproto,.memname {
font-weight:bold; font-weight:bold;
text-shadow:none; text-shadow:none;
} }
#main-menu { #main-menu {
height:36px; min-height:36px;
display:block; display: flex;
position:relative; flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
align-content: stretch;
} }
#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li { #main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li {
color:@navbar-link-color; color:$navbar-link-color;
} }
#main-menu li ul.sm-nowrap li a { #main-menu li ul.sm-nowrap li a {
color:@default-text-color; color:$default-text-color;
} }
#main-menu li ul.sm-nowrap li a:hover { #main-menu li ul.sm-nowrap li a:hover {
color:@default-link-color; color:$default-link-color;
}
#main-menu > li:last-child {
margin: 0 0 0 auto;
} }
.contents { .contents {
@@ -258,22 +274,22 @@ div.contents,div.header {
max-width:920px; max-width:920px;
margin:0 auto; margin:0 auto;
padding:0 32px; padding:0 32px;
background:@content-background-color none; background:$content-background-color none;
} }
table.doxtable th,table.markdownTable th,dl.reflist dt { table.doxtable th,table.markdownTable th,dl.reflist dt {
background:linear-gradient(to bottom,@table-background-color2 0%,@table-background-color1 100%); background:linear-gradient(to bottom,$table-background-color2 0%,$table-background-color1 100%);
box-shadow:inset 0 0 32px @table-background-color1; box-shadow:inset 0 0 32px $table-background-color1;
text-shadow:0 -1px 1px darken(@table-background-color1, 15%); text-shadow:0 -1px 1px darken($table-background-color1, 15%);
text-align:left; text-align:left;
color:@table-text-color; color:$table-text-color;
} }
dl.reflist dt a.el { dl.reflist dt a.el {
color:@default-link-color; color:$default-link-color;
padding:.2em; padding:.2em;
border-radius:4px; border-radius:4px;
background-color:lighten(@default-link-color, 40%); background-color:lighten($default-link-color, 40%);
} }
div.toc { div.toc {
@@ -296,27 +312,27 @@ div.toc li {
} }
div.toc,.memproto,div.qindex,div.ah { div.toc,.memproto,div.qindex,div.ah {
background:linear-gradient(to bottom,@toc-background-color2 0%,@toc-background-color1 100%); background:linear-gradient(to bottom,$toc-background-color2 0%,$toc-background-color1 100%);
box-shadow:inset 0 0 32px @toc-background-color1; box-shadow:inset 0 0 32px $toc-background-color1;
text-shadow:0 1px 1px lighten(@toc-background-color2, 10%); text-shadow:0 1px 1px lighten($toc-background-color2, 10%);
color:@heading-color; color:$heading-color;
border:2px solid @toc-background-color1; border:2px solid $toc-background-color1;
border-radius:4px; border-radius:4px;
} }
.paramname { .paramname {
color:@prototype-param-color; color:$prototype-param-color;
} }
dl.reflist dt { dl.reflist dt {
border:2px solid @default-border-color; border:2px solid $default-border-color;
border-top-left-radius:4px; border-top-left-radius:4px;
border-top-right-radius:4px; border-top-right-radius:4px;
border-bottom:none; border-bottom:none;
} }
dl.reflist dd { dl.reflist dd {
border:2px solid @default-border-color; border:2px solid $default-border-color;
border-bottom-right-radius:4px; border-bottom-right-radius:4px;
border-bottom-left-radius:4px; border-bottom-left-radius:4px;
border-top:none; border-top:none;
@@ -325,41 +341,41 @@ dl.reflist dd {
table.doxtable,table.markdownTable { table.doxtable,table.markdownTable {
border-collapse:inherit; border-collapse:inherit;
border-spacing:0; border-spacing:0;
border:2px solid @default-border-color; border:2px solid $default-border-color;
border-radius:4px; border-radius:4px;
} }
a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover { a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover {
color:@default-link-color; color:$default-link-color;
text-decoration:none; text-decoration:none;
} }
div.directory { div.directory {
border-collapse:inherit; border-collapse:inherit;
border-spacing:0; border-spacing:0;
border:2px solid @default-border-color; border:2px solid $default-border-color;
border-radius:4px; border-radius:4px;
} }
hr,.memSeparator { hr,.memSeparator {
height:2px; height:2px;
background:linear-gradient(to right,@def-separator-color 0%,darken(@def-separator-color, 10%) 50%,@def-separator-color 100%); background:linear-gradient(to right,$def-separator-color 0%,darken($def-separator-color, 10%) 50%,$def-separator-color 100%);
} }
dl.note,dl.pre,dl.post,dl.invariant { dl.note,dl.pre,dl.post,dl.invariant {
.message-box(@box-note-color); @include message-box($box-note-color);
} }
dl.warning,dl.attention { dl.warning,dl.attention {
.message-box(@box-warning-color); @include message-box($box-warning-color);
} }
dl.deprecated,dl.bug { dl.deprecated,dl.bug {
.message-box(@box-bug-color); @include message-box($box-bug-color);
} }
dl.todo,dl.test { dl.todo,dl.test {
.message-box(@box-todo-color); @include message-box($box-todo-color);
} }
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test { dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test {
@@ -388,7 +404,7 @@ div.fragment,pre.fragment {
} }
.lineno a,.lineno a:visited,.line,pre.fragment { .lineno a,.lineno a:visited,.line,pre.fragment {
color:@default-text-color; color:$default-text-color;
} }
span.preprocessor,span.comment { span.preprocessor,span.comment {
@@ -400,7 +416,7 @@ a.code,a.code:visited {
} }
span.keyword,span.keywordtype,span.keywordflow { span.keyword,span.keywordtype,span.keywordflow {
color:darken(@default-text-color, 5%); color:darken($default-text-color, 5%);
font-weight:bold; font-weight:bold;
} }
+3 -2
View File
@@ -1,7 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/> <meta name="generator" content="Doxygen $doxygenversion"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME--> <!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+1 -1
View File
@@ -645,7 +645,7 @@ const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4);
@endcode @endcode
Joystick names are not guaranteed to be unique. Two joysticks of the same model Joystick names are not guaranteed to be unique. Two joysticks of the same model
and make may have the same name. Only the [joystick token](@ref joysticks) is and make may have the same name. Only the [joystick ID](@ref joysticks) is
guaranteed to be unique, and only until that joystick is disconnected. guaranteed to be unique, and only until that joystick is disconnected.
+2 -2
View File
@@ -362,8 +362,8 @@ should be using the character callback instead, on both GLFW 2 and 3. This will
give you the characters being input, as opposed to the keys being pressed. give you the characters being input, as opposed to the keys being pressed.
GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of
having to remember whether to check for `'a'` or `'A'`, you now check for having to remember whether to check for `a` or `A`, you now check for
`GLFW_KEY_A`. @ref GLFW_KEY_A.
@subsection moving_joystick Joystick function changes @subsection moving_joystick Joystick function changes
+7
View File
@@ -299,6 +299,13 @@ a requirement of the GLFW CMake files. The GLFW source files do not depend on
CMake. CMake.
@subsubsection caveat_fbtransparency_33 Framebuffer transparency requires DWM transparency
GLFW no longer supports framebuffer transparency enabled via @ref
GLFW_TRANSPARENT_FRAMEBUFFER on Windows 7 if DWM transparency is off
(the Transparency setting under Personalization > Window Color).
@subsection deprecations_33 Deprecations in version 3.3 @subsection deprecations_33 Deprecations in version 3.3
@subsubsection charmods_callback_33 Character with modifiers callback @subsubsection charmods_callback_33 Character with modifiers callback
+33 -30
View File
@@ -18,43 +18,42 @@ behave differently in GLFW 3.
@subsection quick_include Including the GLFW header @subsection quick_include Including the GLFW header
In the source files of your application where you use OpenGL or GLFW, you need In the source files of your application where you use GLFW, you need to include
to include the GLFW 3 header file. its header file.
@code @code
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@endcode @endcode
This defines all the constants, types and function prototypes of the GLFW API. This header provides all the constants, types and function prototypes of the
It also includes the OpenGL header from your development environment and GLFW API.
defines all the constants and types necessary for it to work on your platform
without including any platform-specific headers.
In other words: By default it also includes the OpenGL header from your development environment.
On some platforms this header only supports older versions of OpenGL. The most
extreme case is Windows, where it typically only supports OpenGL 1.2.
- Do _not_ include the OpenGL header yourself, as GLFW does this for you in Most programs will instead use an
a platform-independent way [extension loader library](@ref context_glext_auto) and include its header.
- Do _not_ include `windows.h` or other platform-specific headers unless This example uses files generated by [glad](https://gen.glad.sh/). The GLFW
you plan on using those APIs yourself header can detect most such headers if they are included first and will then not
- If you _do_ need to include such headers, include them _before_ the GLFW include the one from your development environment.
header and it will detect this
On some platforms supported by GLFW the OpenGL header and link library only
expose older versions of OpenGL. The most extreme case is Windows, which only
exposes OpenGL 1.2. The easiest way to work around this is to use an
[extension loader library](@ref context_glext_auto).
If you are using such a library then you should include its header _before_ the
GLFW header. This lets it replace the OpenGL header included by GLFW without
conflicts. This example uses
[glad2](https://github.com/Dav1dde/glad), but the same rule applies to all such
libraries.
@code @code
#include <glad/gl.h> #include <glad/gl.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@endcode @endcode
To make sure there will be no header conflicts, you can define @ref
GLFW_INCLUDE_NONE before the GLFW header to explicitly disable inclusion of the
development environment header. This also allows the two headers to be included
in any order.
@code
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <glad/gl.h>
@endcode
@subsection quick_init_term Initializing and terminating GLFW @subsection quick_init_term Initializing and terminating GLFW
@@ -246,12 +245,16 @@ glViewport(0, 0, width, height);
You can also set a framebuffer size callback using @ref You can also set a framebuffer size callback using @ref
glfwSetFramebufferSizeCallback and be notified when the size changes. glfwSetFramebufferSizeCallback and be notified when the size changes.
Actual rendering with OpenGL is outside the scope of this tutorial, but there The details of how to render with OpenGL is outside the scope of this tutorial,
are [many](https://open.gl/) [excellent](https://learnopengl.com/) but there are many excellent resources for learning modern OpenGL. Here are
[tutorial](http://openglbook.com/) [sites](http://ogldev.atspace.co.uk/) that a few of them:
teach modern OpenGL. Some of them use GLFW to create the context and window
while others use GLUT or SDL, but remember that OpenGL itself always works the - [Anton's OpenGL 4 Tutorials](https://antongerdelan.net/opengl/)
same. - [Learn OpenGL](https://learnopengl.com/)
- [Open.GL](https://open.gl/)
These all happen to use GLFW, but OpenGL itself works the same whatever API you
use to create the window and context.
@subsection quick_timer Reading the timer @subsection quick_timer Reading the timer
+9 -4
View File
@@ -4,8 +4,8 @@
@tableofcontents @tableofcontents
This guide is intended to fill the gaps between the [Vulkan This guide is intended to fill the gaps between the official [Vulkan
documentation](https://www.khronos.org/vulkan/) and the rest of the GLFW resources](https://www.khronos.org/vulkan/) and the rest of the GLFW
documentation and is not a replacement for either. It assumes some familiarity documentation and is not a replacement for either. It assumes some familiarity
with Vulkan concepts like loaders, devices, queues and surfaces and leaves it to with Vulkan concepts like loaders, devices, queues and surfaces and leaves it to
the Vulkan documentation to explain the details of Vulkan functions. the Vulkan documentation to explain the details of Vulkan functions.
@@ -14,7 +14,12 @@ To develop for Vulkan you should download the [LunarG Vulkan
SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link
libraries, they also provide the validation layers necessary for development. libraries, they also provide the validation layers necessary for development.
For details on a specific function in this category, see the @ref vulkan. There The [Vulkan Tutorial](https://vulkan-tutorial.com/) has more information on how
to use GLFW and Vulkan. The [Khronos Vulkan
Samples](https://github.com/KhronosGroup/Vulkan-Samples) also use GLFW, although
with a small framework in between.
For details on a specific Vulkan support function, see the @ref vulkan. There
are also guides for the other areas of the GLFW API. are also guides for the other areas of the GLFW API.
- @ref intro_guide - @ref intro_guide
@@ -88,7 +93,7 @@ if (glfwVulkanSupported())
This function returns `GLFW_TRUE` if the Vulkan loader and any minimally This function returns `GLFW_TRUE` if the Vulkan loader and any minimally
functional ICD was found. functional ICD was found.
If if one or both were not found, calling any other Vulkan related GLFW function If one or both were not found, calling any other Vulkan related GLFW function
will generate a @ref GLFW_API_UNAVAILABLE error. will generate a @ref GLFW_API_UNAVAILABLE error.
+10 -13
View File
@@ -234,13 +234,6 @@ alpha channel will be used to combine the framebuffer with the background. This
does not affect window decorations. Possible values are `GLFW_TRUE` and does not affect window decorations. Possible values are `GLFW_TRUE` and
`GLFW_FALSE`. `GLFW_FALSE`.
@par
@win32 GLFW sets a color key for the window to work around repainting issues
with a transparent framebuffer. The chosen color value is RGB 255,0,255
(magenta). This will make pixels with that exact color fully transparent
regardless of their alpha values. If this is a problem, make these pixels any
other color before buffer swap.
@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`.
@@ -408,10 +401,14 @@ Forward-compatibility is described in detail in the
[OpenGL Reference Manual](https://www.opengl.org/registry/). [OpenGL Reference Manual](https://www.opengl.org/registry/).
@anchor GLFW_OPENGL_DEBUG_CONTEXT_hint @anchor GLFW_OPENGL_DEBUG_CONTEXT_hint
__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether to create a debug OpenGL __GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created
context, which may have additional error and performance issue reporting in debug mode, which may provide additional error and diagnostic reporting
functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If OpenGL ES functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
is requested, this hint is ignored.
@par
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)
extension.
@anchor GLFW_OPENGL_PROFILE_hint @anchor GLFW_OPENGL_PROFILE_hint
__GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context __GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context
@@ -1328,8 +1325,8 @@ __GLFW_OPENGL_FORWARD_COMPAT__ is `GLFW_TRUE` if the window's context is an
OpenGL forward-compatible one, or `GLFW_FALSE` otherwise. OpenGL forward-compatible one, or `GLFW_FALSE` otherwise.
@anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib @anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib
__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is an __GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is in debug
OpenGL debug context, or `GLFW_FALSE` otherwise. mode, or `GLFW_FALSE` otherwise.
@anchor GLFW_OPENGL_PROFILE_attrib @anchor GLFW_OPENGL_PROFILE_attrib
__GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This __GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This
+1
View File
@@ -148,6 +148,7 @@ int main(void)
glUseProgram(program); glUseProgram(program);
glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
glDrawArrays(GL_TRIANGLES, 0, 3); glDrawArrays(GL_TRIANGLES, 0, 3);
glFinish();
#if USE_NATIVE_OSMESA #if USE_NATIVE_OSMESA
glfwGetOSMesaColorBuffer(window, &width, &height, NULL, (void**) &buffer); glfwGetOSMesaColorBuffer(window, &width, &height, NULL, (void**) &buffer);
+43 -12
View File
@@ -52,7 +52,7 @@ extern "C" {
* This is the reference documentation for OpenGL and OpenGL ES context related * This is the reference documentation for OpenGL and OpenGL ES context related
* functions. For more task-oriented information, see the @ref context_guide. * functions. For more task-oriented information, see the @ref context_guide.
*/ */
/*! @defgroup vulkan Vulkan reference /*! @defgroup vulkan Vulkan support reference
* @brief Functions and types related to Vulkan. * @brief Functions and types related to Vulkan.
* *
* This is the reference documentation for Vulkan related functions and types. * This is the reference documentation for Vulkan related functions and types.
@@ -193,7 +193,38 @@ extern "C" {
#endif /*__APPLE__*/ #endif /*__APPLE__*/
#elif !defined(GLFW_INCLUDE_NONE) #elif defined(GLFW_INCLUDE_GLU)
#if defined(__APPLE__)
#if defined(GLFW_INCLUDE_GLU)
#include <OpenGL/glu.h>
#endif
#else /*__APPLE__*/
#if defined(GLFW_INCLUDE_GLU)
#include <GL/glu.h>
#endif
#endif /*__APPLE__*/
#elif !defined(GLFW_INCLUDE_NONE) && \
!defined(__gl_h_) && \
!defined(__gles1_gl_h_) && \
!defined(__gles2_gl2_h_) && \
!defined(__gles2_gl3_h_) && \
!defined(__gles2_gl31_h_) && \
!defined(__gles2_gl32_h_) && \
!defined(__gl_glcorearb_h_) && \
!defined(__gl2_h_) /*legacy*/ && \
!defined(__gl3_h_) /*legacy*/ && \
!defined(__gl31_h_) /*legacy*/ && \
!defined(__gl32_h_) /*legacy*/ && \
!defined(__glcorearb_h_) /*legacy*/ && \
!defined(__GL_H__) /*non-standard*/ && \
!defined(__gltypes_h_) /*non-standard*/ && \
!defined(__glee_h_) /*non-standard*/
#if defined(__APPLE__) #if defined(__APPLE__)
@@ -201,9 +232,6 @@ extern "C" {
#define GL_GLEXT_LEGACY #define GL_GLEXT_LEGACY
#endif #endif
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#if defined(GLFW_INCLUDE_GLU)
#include <OpenGL/glu.h>
#endif
#else /*__APPLE__*/ #else /*__APPLE__*/
@@ -211,9 +239,6 @@ extern "C" {
#if defined(GLFW_INCLUDE_GLEXT) #if defined(GLFW_INCLUDE_GLEXT)
#include <GL/glext.h> #include <GL/glext.h>
#endif #endif
#if defined(GLFW_INCLUDE_GLU)
#include <GL/glu.h>
#endif
#endif /*__APPLE__*/ #endif /*__APPLE__*/
@@ -270,7 +295,7 @@ extern "C" {
* API changes. * API changes.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_REVISION 2 #define GLFW_VERSION_REVISION 4
/*! @} */ /*! @} */
/*! @brief One. /*! @brief One.
@@ -949,9 +974,9 @@ extern "C" {
* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
*/ */
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
/*! @brief OpenGL debug context hint and attribute. /*! @brief Debug mode context hint and attribute.
* *
* OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and * Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib). * [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
*/ */
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
@@ -1328,7 +1353,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
* @endcode * @endcode
* *
* @param[in] window The window that was maximized or restored. * @param[in] window The window that was maximized or restored.
* @param[in] iconified `GLFW_TRUE` if the window was maximized, or * @param[in] maximized `GLFW_TRUE` if the window was maximized, or
* `GLFW_FALSE` if it was restored. * `GLFW_FALSE` if it was restored.
* *
* @sa @ref window_maximize * @sa @ref window_maximize
@@ -1753,6 +1778,10 @@ typedef struct GLFWgamepadstate
* bundle, if present. This can be disabled with the @ref * bundle, if present. This can be disabled with the @ref
* GLFW_COCOA_CHDIR_RESOURCES init hint. * GLFW_COCOA_CHDIR_RESOURCES init hint.
* *
* @remark @x11 This function will set the `LC_CTYPE` category of the
* application locale according to the current environment if that category is
* still "C". This is because the "C" locale breaks Unicode text input.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref intro_init * @sa @ref intro_init
@@ -1776,6 +1805,8 @@ GLFWAPI int glfwInit(void);
* call this function, as it is called by @ref glfwInit before it returns * call this function, as it is called by @ref glfwInit before it returns
* failure. * failure.
* *
* This function has no effect if GLFW is not initialized.
*
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR. * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
* *
* @remark This function may be called before @ref glfwInit. * @remark This function may be called before @ref glfwInit.
+22 -16
View File
@@ -63,7 +63,7 @@ elseif (_GLFW_OSMESA)
endif() endif()
if (_GLFW_X11 OR _GLFW_WAYLAND) if (_GLFW_X11 OR _GLFW_WAYLAND)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h) set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h)
set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c) set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c)
else() else()
@@ -72,8 +72,8 @@ if (_GLFW_X11 OR _GLFW_WAYLAND)
endif() endif()
endif() endif()
if (APPLE) # Workaround for CMake not knowing about .m files before version 3.16
# For some reason CMake didn't know about .m until version 3.16 if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
cocoa_window.m nsgl_context.m PROPERTIES cocoa_window.m nsgl_context.m PROPERTIES
LANGUAGE C) LANGUAGE C)
@@ -87,8 +87,8 @@ set_target_properties(glfw PROPERTIES
POSITION_INDEPENDENT_CODE ON POSITION_INDEPENDENT_CODE ON
FOLDER "GLFW3") FOLDER "GLFW3")
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR if (CMAKE_VERSION VERSION_EQUAL "3.1.0" OR
${CMAKE_VERSION} VERSION_GREATER "3.1.0") CMAKE_VERSION VERSION_GREATER "3.1.0")
set_target_properties(glfw PROPERTIES C_STANDARD 99) set_target_properties(glfw PROPERTIES C_STANDARD 99)
else() else()
@@ -109,21 +109,30 @@ target_include_directories(glfw PRIVATE
${glfw_INCLUDE_DIRS}) ${glfw_INCLUDE_DIRS})
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES}) target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR # Make GCC warn about declarations that VS 2010 and 2012 won't accept for all
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR # source files that VS will build (Clang ignores this because we set -std=c99)
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
# Make GCC and Clang warn about declarations that VS 2010 and 2012 won't
# accept for all source files that VS will build
set_source_files_properties(context.c init.c input.c monitor.c vulkan.c set_source_files_properties(context.c init.c input.c monitor.c vulkan.c
window.c win32_init.c win32_joystick.c window.c win32_init.c win32_joystick.c
win32_monitor.c win32_time.c win32_thread.c win32_monitor.c win32_time.c win32_thread.c
win32_window.c wgl_context.c egl_context.c win32_window.c wgl_context.c egl_context.c
osmesa_context.c PROPERTIES osmesa_context.c PROPERTIES
COMPILE_FLAGS -Wdeclaration-after-statement) COMPILE_FLAGS -Wdeclaration-after-statement)
endif()
# Enable a reasonable set of warnings (no, -Wextra is not reasonable) # Enable a reasonable set of warnings
target_compile_options(glfw PRIVATE "-Wall") if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
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")
endif() endif()
if (WIN32) if (WIN32)
@@ -159,9 +168,6 @@ if (BUILD_SHARED_LIBS)
elseif (APPLE) elseif (APPLE)
# Add -fno-common to work around a bug in Apple's GCC # Add -fno-common to work around a bug in Apple's GCC
target_compile_options(glfw PRIVATE "-fno-common") target_compile_options(glfw PRIVATE "-fno-common")
set_target_properties(glfw PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
endif() endif()
if (UNIX) if (UNIX)
+5 -3
View File
@@ -428,9 +428,6 @@ static GLFWbool initializeTIS(void)
{ {
if (_glfw.hints.init.ns.menubar) if (_glfw.hints.init.ns.menubar)
{ {
// In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
// Menu bar setup must go between sharedApplication and finishLaunching // Menu bar setup must go between sharedApplication and finishLaunching
// in order to properly emulate the behavior of NSApplicationMain // in order to properly emulate the behavior of NSApplicationMain
@@ -449,6 +446,11 @@ static GLFWbool initializeTIS(void)
{ {
_glfw.ns.finishedLaunching = GLFW_TRUE; _glfw.ns.finishedLaunching = GLFW_TRUE;
_glfwPlatformPostEmptyEvent(); _glfwPlatformPostEmptyEvent();
// In case we are unbundled, make us a proper UI application
if (_glfw.hints.init.ns.menubar)
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp stop:nil]; [NSApp stop:nil];
} }
+59 -40
View File
@@ -39,8 +39,21 @@
// Get the name of the specified display, or NULL // Get the name of the specified display, or NULL
// //
static char* getDisplayName(CGDirectDisplayID displayID) static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
{ {
// IOKit doesn't work on Apple Silicon anymore
// Luckily, 10.15 introduced -[NSScreen localizedName].
// Use it if available, and fall back to IOKit otherwise.
if (screen)
{
if ([screen respondsToSelector:@selector(localizedName)])
{
NSString* name = [screen valueForKey:@"localizedName"];
if (name)
return _glfw_strdup([name UTF8String]);
}
}
io_iterator_t it; io_iterator_t it;
io_service_t service; io_service_t service;
CFDictionaryRef info; CFDictionaryRef info;
@@ -209,31 +222,6 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
} }
} }
// Finds and caches the NSScreen corresponding to the specified monitor
//
static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
{
if (monitor->ns.screen)
return GLFW_TRUE;
for (NSScreen* screen in [NSScreen screens])
{
NSNumber* displayID = [screen deviceDescription][@"NSScreenNumber"];
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
if (monitor->ns.unitNumber == CGDisplayUnitNumber([displayID unsignedIntValue]))
{
monitor->ns.screen = screen;
return GLFW_TRUE;
}
}
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find a screen for monitor");
return GLFW_FALSE;
}
// Returns the display refresh rate queried from the I/O registry // Returns the display refresh rate queried from the I/O registry
// //
static double getFallbackRefreshRate(CGDirectDisplayID displayID) static double getFallbackRefreshRate(CGDirectDisplayID displayID)
@@ -277,14 +265,20 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
CFSTR("IOFBCurrentPixelCount"), CFSTR("IOFBCurrentPixelCount"),
kCFAllocatorDefault, kCFAllocatorDefault,
kNilOptions); kNilOptions);
if (!clockRef || !countRef)
break;
uint32_t clock = 0, count = 0; uint32_t clock = 0, count = 0;
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
CFNumberGetValue(countRef, kCFNumberIntType, &count); if (clockRef)
CFRelease(clockRef); {
CFRelease(countRef); CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
CFRelease(clockRef);
}
if (countRef)
{
CFNumberGetValue(countRef, kCFNumberIntType, &count);
CFRelease(countRef);
}
if (clock > 0 && count > 0) if (clock > 0 && count > 0)
refreshRate = clock / (double) count; refreshRate = clock / (double) count;
@@ -328,27 +322,46 @@ void _glfwPollMonitorsNS(void)
if (CGDisplayIsAsleep(displays[i])) if (CGDisplayIsAsleep(displays[i]))
continue; continue;
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
NSScreen* screen = nil;
for (screen in [NSScreen screens])
{
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
break;
}
// HACK: Compare unit numbers instead of display IDs to work around // HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics // display replacement on machines with automatic graphics
// switching // switching
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]); uint32_t j;
for (uint32_t j = 0; j < disconnectedCount; j++) for (j = 0; j < disconnectedCount; j++)
{ {
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber) if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
{ {
disconnected[j]->ns.screen = screen;
disconnected[j] = NULL; disconnected[j] = NULL;
break; break;
} }
} }
if (j < disconnectedCount)
continue;
const CGSize size = CGDisplayScreenSize(displays[i]); const CGSize size = CGDisplayScreenSize(displays[i]);
char* name = getDisplayName(displays[i]); char* name = getMonitorName(displays[i], screen);
if (!name) if (!name)
name = _glfw_strdup("Unknown"); name = _glfw_strdup("Unknown");
_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];
monitor->ns.unitNumber = unitNumber; monitor->ns.unitNumber = unitNumber;
monitor->ns.screen = screen;
free(name); free(name);
@@ -457,8 +470,11 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
{ {
@autoreleasepool { @autoreleasepool {
if (!refreshMonitorScreen(monitor)) if (!monitor->ns.screen)
return; {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Cannot query content scale without screen");
}
const NSRect points = [monitor->ns.screen frame]; const NSRect points = [monitor->ns.screen frame];
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points]; const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
@@ -477,8 +493,11 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
{ {
@autoreleasepool { @autoreleasepool {
if (!refreshMonitorScreen(monitor)) if (!monitor->ns.screen)
return; {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Cannot query workarea without screen");
}
const NSRect frameRect = [monitor->ns.screen visibleFrame]; const NSRect frameRect = [monitor->ns.screen visibleFrame];
@@ -521,7 +540,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
} }
// Skip duplicate modes // Skip duplicate modes
if (i < *count) if (j < *count)
continue; continue;
(*count)++; (*count)++;
+2 -1
View File
@@ -92,7 +92,7 @@ typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMeta
#define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlclose(handle) dlclose(handle)
#define _glfw_dlsym(handle, name) dlsym(handle, name) #define _glfw_dlsym(handle, name) dlsym(handle, name)
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.view) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.layer)
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns
@@ -121,6 +121,7 @@ typedef struct _GLFWwindowNS
id layer; id layer;
GLFWbool maximized; GLFWbool maximized;
GLFWbool occluded;
GLFWbool retina; GLFWbool retina;
// Cached window properties to filter out duplicate events // Cached window properties to filter out duplicate events
+29 -6
View File
@@ -322,6 +322,14 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputWindowFocus(window, GLFW_FALSE); _glfwInputWindowFocus(window, GLFW_FALSE);
} }
- (void)windowDidChangeOcclusionState:(NSNotification* )notification
{
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
window->ns.occluded = GLFW_FALSE;
else
window->ns.occluded = GLFW_TRUE;
}
@end @end
@@ -723,14 +731,24 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
else else
characters = (NSString*) string; characters = (NSString*) string;
const NSUInteger length = [characters length]; NSRange range = NSMakeRange(0, [characters length]);
for (NSUInteger i = 0; i < length; i++) while (range.length)
{ {
const unichar codepoint = [characters characterAtIndex:i]; uint32_t codepoint = 0;
if ((codepoint & 0xff00) == 0xf700)
continue;
_glfwInputChar(window, codepoint, mods, plain); if ([characters getBytes:&codepoint
maxLength:sizeof(codepoint)
usedLength:NULL
encoding:NSUTF32StringEncoding
options:0
range:range
remainingRange:&range])
{
if (codepoint >= 0xf700 && codepoint <= 0xf7ff)
continue;
_glfwInputChar(window, codepoint, mods, plain);
}
} }
} }
@@ -901,6 +919,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
} }
else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
{ {
// EGL implementation on macOS use CALayer* EGLNativeWindowType so we
// need to get the layer for EGL window surface creation.
[window->ns.view setWantsLayer:YES];
window->ns.layer = [window->ns.view layer];
if (!_glfwInitEGL()) if (!_glfwInitEGL())
return GLFW_FALSE; return GLFW_FALSE;
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
+7 -9
View File
@@ -588,18 +588,16 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
} }
// Set up attributes for surface creation // Set up attributes for surface creation
index = 0;
if (fbconfig->sRGB)
{ {
int index = 0; if (_glfw.egl.KHR_gl_colorspace)
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
if (fbconfig->sRGB)
{
if (_glfw.egl.KHR_gl_colorspace)
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
}
setAttrib(EGL_NONE, EGL_NONE);
} }
setAttrib(EGL_NONE, EGL_NONE);
window->context.egl.surface = window->context.egl.surface =
eglCreateWindowSurface(_glfw.egl.display, eglCreateWindowSurface(_glfw.egl.display,
config, config,
+18 -18
View File
@@ -342,9 +342,9 @@ struct _GLFWcontext
int robustness; int robustness;
int release; int release;
PFNGLGETSTRINGIPROC GetStringi; PFNGLGETSTRINGIPROC GetStringi;
PFNGLGETINTEGERVPROC GetIntegerv; PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETSTRINGPROC GetString; PFNGLGETSTRINGPROC GetString;
_GLFWmakecontextcurrentfun makeCurrent; _GLFWmakecontextcurrentfun makeCurrent;
_GLFWswapbuffersfun swapBuffers; _GLFWswapbuffersfun swapBuffers;
@@ -396,23 +396,23 @@ struct _GLFWwindow
_GLFWcontext context; _GLFWcontext context;
struct { struct {
GLFWwindowposfun pos; GLFWwindowposfun pos;
GLFWwindowsizefun size; GLFWwindowsizefun size;
GLFWwindowclosefun close; GLFWwindowclosefun close;
GLFWwindowrefreshfun refresh; GLFWwindowrefreshfun refresh;
GLFWwindowfocusfun focus; GLFWwindowfocusfun focus;
GLFWwindowiconifyfun iconify; GLFWwindowiconifyfun iconify;
GLFWwindowmaximizefun maximize; GLFWwindowmaximizefun maximize;
GLFWframebuffersizefun fbsize; GLFWframebuffersizefun fbsize;
GLFWwindowcontentscalefun scale; GLFWwindowcontentscalefun scale;
GLFWmousebuttonfun mouseButton; GLFWmousebuttonfun mouseButton;
GLFWcursorposfun cursorPos; GLFWcursorposfun cursorPos;
GLFWcursorenterfun cursorEnter; GLFWcursorenterfun cursorEnter;
GLFWscrollfun scroll; GLFWscrollfun scroll;
GLFWkeyfun key; GLFWkeyfun key;
GLFWcharfun character; GLFWcharfun character;
GLFWcharmodsfun charmods; GLFWcharmodsfun charmods;
GLFWdropfun drop; GLFWdropfun drop;
} callbacks; } callbacks;
// This is defined in the window API's platform.h // This is defined in the window API's platform.h
+1 -1
View File
@@ -51,7 +51,7 @@ static void swapBuffersNSGL(_GLFWwindow* window)
// HACK: Simulate vsync with usleep as NSGL swap interval does not apply to // HACK: Simulate vsync with usleep as NSGL swap interval does not apply to
// windows with a non-visible occlusion state // windows with a non-visible occlusion state
if (!([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)) if (window->ns.occluded)
{ {
int interval = 0; int interval = 0;
[window->context.nsgl.object getValues:&interval [window->context.nsgl.object getValues:&interval
-4
View File
@@ -104,10 +104,6 @@ typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
#define wglMakeCurrent _glfw.wgl.MakeCurrent #define wglMakeCurrent _glfw.wgl.MakeCurrent
#define wglShareLists _glfw.wgl.ShareLists #define wglShareLists _glfw.wgl.ShareLists
#define _GLFW_RECREATION_NOT_NEEDED 0
#define _GLFW_RECREATION_REQUIRED 1
#define _GLFW_RECREATION_IMPOSSIBLE 2
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl
+6
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)
#warning "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
@@ -143,6 +147,8 @@ static GLFWbool loadLibraries(void)
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush"); GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
_glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow) _glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow"); GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
_glfw.win32.dwmapi.GetColorizationColor = (PFN_DwmGetColorizationColor)
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
} }
_glfw.win32.shcore.instance = LoadLibraryA("shcore.dll"); _glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
+5 -5
View File
@@ -356,7 +356,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
_GLFWjoystick* js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (js->present) if (js->present)
{ {
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0) if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
@@ -672,11 +672,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
}; };
// Screams of horror are appropriate at this point // Screams of horror are appropriate at this point
int state = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES); int stateIndex = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
if (state < 0 || state > 8) if (stateIndex < 0 || stateIndex > 8)
state = 8; stateIndex = 8;
_glfwInputJoystickHat(js, pi, states[state]); _glfwInputJoystickHat(js, pi, states[stateIndex]);
pi++; pi++;
break; break;
} }
+2
View File
@@ -185,6 +185,8 @@ void _glfwPollMonitorsWin32(void)
display.DeviceName) == 0) display.DeviceName) == 0)
{ {
disconnected[i] = NULL; disconnected[i] = NULL;
// handle may have changed, update
EnumDisplayMonitors(NULL, NULL, monitorCallback, (LPARAM) _glfw.monitors[i]);
break; break;
} }
} }
+12 -1
View File
@@ -77,6 +77,9 @@
#ifndef WM_DWMCOMPOSITIONCHANGED #ifndef WM_DWMCOMPOSITIONCHANGED
#define WM_DWMCOMPOSITIONCHANGED 0x031E #define WM_DWMCOMPOSITIONCHANGED 0x031E
#endif #endif
#ifndef WM_DWMCOLORIZATIONCOLORCHANGED
#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
#endif
#ifndef WM_COPYGLOBALDATA #ifndef WM_COPYGLOBALDATA
#define WM_COPYGLOBALDATA 0x0049 #define WM_COPYGLOBALDATA 0x0049
#endif #endif
@@ -99,7 +102,7 @@
#define DISPLAY_DEVICE_ACTIVE 0x00000001 #define DISPLAY_DEVICE_ACTIVE 0x00000001
#endif #endif
#ifndef _WIN32_WINNT_WINBLUE #ifndef _WIN32_WINNT_WINBLUE
#define _WIN32_WINNT_WINBLUE 0x0602 #define _WIN32_WINNT_WINBLUE 0x0603
#endif #endif
#ifndef _WIN32_WINNT_WIN8 #ifndef _WIN32_WINNT_WIN8
#define _WIN32_WINNT_WIN8 0x0602 #define _WIN32_WINNT_WIN8 0x0602
@@ -247,9 +250,11 @@ typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UIN
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*); typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID); typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*); typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
typedef HRESULT (WINAPI * PFN_DwmGetColorizationColor)(DWORD*,BOOL*);
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled #define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
#define DwmFlush _glfw.win32.dwmapi.Flush #define DwmFlush _glfw.win32.dwmapi.Flush
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow #define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
#define DwmGetColorizationColor _glfw.win32.dwmapi.GetColorizationColor
// shcore.dll function pointer typedefs // shcore.dll function pointer typedefs
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
@@ -316,8 +321,13 @@ typedef struct _GLFWwindowWin32
GLFWbool transparent; GLFWbool transparent;
GLFWbool scaleToMonitor; GLFWbool scaleToMonitor;
// Cached size used to filter out duplicate events
int width, height;
// The last received cursor position, regardless of source // The last received cursor position, regardless of source
int lastCursorPosX, lastCursorPosY; int lastCursorPosX, lastCursorPosY;
// The last recevied high surrogate when decoding pairs of UTF-16 messages
WCHAR highSurrogate;
} _GLFWwindowWin32; } _GLFWwindowWin32;
@@ -373,6 +383,7 @@ typedef struct _GLFWlibraryWin32
PFN_DwmIsCompositionEnabled IsCompositionEnabled; PFN_DwmIsCompositionEnabled IsCompositionEnabled;
PFN_DwmFlush Flush; PFN_DwmFlush Flush;
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow; PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
PFN_DwmGetColorizationColor GetColorizationColor;
} dwmapi; } dwmapi;
struct { struct {
+89 -42
View File
@@ -377,12 +377,17 @@ static void updateWindowStyles(const _GLFWwindow* window)
// //
static void updateFramebufferTransparency(const _GLFWwindow* window) static void updateFramebufferTransparency(const _GLFWwindow* window)
{ {
BOOL enabled; BOOL composition, opaque;
DWORD color;
if (!IsWindowsVistaOrGreater()) if (!IsWindowsVistaOrGreater())
return; return;
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
return;
if (IsWindows8OrGreater() ||
(SUCCEEDED(DwmGetColorizationColor(&color, &opaque)) && !opaque))
{ {
HRGN region = CreateRectRgn(0, 0, -1, -1); HRGN region = CreateRectRgn(0, 0, -1, -1);
DWM_BLURBEHIND bb = {0}; DWM_BLURBEHIND bb = {0};
@@ -390,37 +395,18 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
bb.hRgnBlur = region; bb.hRgnBlur = region;
bb.fEnable = TRUE; bb.fEnable = TRUE;
if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb))) DwmEnableBlurBehindWindow(window->win32.handle, &bb);
{
// Decorated windows don't repaint the transparent background
// leaving a trail behind animations
// HACK: Making the window layered with a transparency color key
// seems to fix this. Normally, when specifying
// a transparency color key to be used when composing the
// layered window, all pixels painted by the window in this
// color will be transparent. That doesn't seem to be the
// case anymore, at least when used with blur behind window
// plus negative region.
LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
exStyle |= WS_EX_LAYERED;
SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
// Using a color key not equal to black to fix the trailing
// issue. When set to black, something is making the hit test
// not resize with the window frame.
SetLayeredWindowAttributes(window->win32.handle,
RGB(255, 0, 255), 255, LWA_COLORKEY);
}
DeleteObject(region); DeleteObject(region);
} }
else else
{ {
LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); // HACK: Disable framebuffer transparency on Windows 7 when the
exStyle &= ~WS_EX_LAYERED; // colorization color is opaque, because otherwise the window
SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle); // contents is blended additively with the previous frame instead
RedrawWindow(window->win32.handle, NULL, NULL, // of replacing it
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); DWM_BLURBEHIND bb = {0};
bb.dwFlags = DWM_BB_ENABLE;
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
} }
} }
@@ -519,7 +505,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_NCCREATE: case WM_NCCREATE:
{ {
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
EnableNonClientDpiScaling(hWnd); {
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
// On per-monitor DPI aware V1 systems, only enable
// non-client scaling for windows that scale the client area
// We need WM_GETDPISCALEDSIZE from V2 to keep the client
// area static when the non-client area is scaled
if (wndconfig && wndconfig->scaleToMonitor)
EnableNonClientDpiScaling(hWnd);
}
break; break;
} }
@@ -645,11 +641,35 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_CHAR: case WM_CHAR:
case WM_SYSCHAR: case WM_SYSCHAR:
{
if (wParam >= 0xd800 && wParam <= 0xdbff)
window->win32.highSurrogate = (WCHAR) wParam;
else
{
unsigned int codepoint = 0;
if (wParam >= 0xdc00 && wParam <= 0xdfff)
{
if (window->win32.highSurrogate)
{
codepoint += (window->win32.highSurrogate - 0xd800) << 10;
codepoint += (WCHAR) wParam - 0xdc00;
codepoint += 0x10000;
}
}
else
codepoint = (WCHAR) wParam;
window->win32.highSurrogate = 0;
_glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR);
}
return 0;
}
case WM_UNICHAR: case WM_UNICHAR:
{ {
const GLFWbool plain = (uMsg != WM_SYSCHAR); if (wParam == UNICODE_NOCHAR)
if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR)
{ {
// WM_UNICHAR is not sent by Windows, but is sent by some // WM_UNICHAR is not sent by Windows, but is sent by some
// third-party input method engine // third-party input method engine
@@ -657,7 +677,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return TRUE; return TRUE;
} }
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain); _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE);
return 0; return 0;
} }
@@ -944,6 +964,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SIZE: case WM_SIZE:
{ {
const int width = LOWORD(lParam);
const int height = HIWORD(lParam);
const GLFWbool iconified = wParam == SIZE_MINIMIZED; const GLFWbool iconified = wParam == SIZE_MINIMIZED;
const GLFWbool maximized = wParam == SIZE_MAXIMIZED || const GLFWbool maximized = wParam == SIZE_MAXIMIZED ||
(window->win32.maximized && (window->win32.maximized &&
@@ -958,8 +980,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->win32.maximized != maximized) if (window->win32.maximized != maximized)
_glfwInputWindowMaximize(window, maximized); _glfwInputWindowMaximize(window, maximized);
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); if (width != window->win32.width || height != window->win32.height)
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); {
window->win32.width = width;
window->win32.height = height;
_glfwInputFramebufferSize(window, width, height);
_glfwInputWindowSize(window, width, height);
}
if (window->monitor && window->win32.iconified != iconified) if (window->monitor && window->win32.iconified != iconified)
{ {
@@ -1073,6 +1101,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
} }
case WM_DWMCOMPOSITIONCHANGED: case WM_DWMCOMPOSITIONCHANGED:
case WM_DWMCOLORIZATIONCOLORCHANGED:
{ {
if (window->win32.transparent) if (window->win32.transparent)
updateFramebufferTransparency(window); updateFramebufferTransparency(window);
@@ -1112,9 +1141,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
// Only apply the suggested size if the OS is new enough to have // Resize windowed mode windows that either permit rescaling or that
// sent a WM_GETDPISCALEDSIZE before this // need it to compensate for non-client area scaling
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) if (!window->monitor &&
(window->win32.scaleToMonitor ||
_glfwIsWindows10CreatorsUpdateOrGreaterWin32()))
{ {
RECT* suggested = (RECT*) lParam; RECT* suggested = (RECT*) lParam;
SetWindowPos(window->win32.handle, HWND_TOP, SetWindowPos(window->win32.handle, HWND_TOP,
@@ -1229,7 +1260,7 @@ static int createNativeWindow(_GLFWwindow* window,
NULL, // No parent window NULL, // No parent window
NULL, // No window menu NULL, // No window menu
GetModuleHandleW(NULL), GetModuleHandleW(NULL),
NULL); (LPVOID) wndconfig);
free(wideTitle); free(wideTitle);
@@ -1296,6 +1327,8 @@ static int createNativeWindow(_GLFWwindow* window,
window->win32.transparent = GLFW_TRUE; window->win32.transparent = GLFW_TRUE;
} }
_glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height);
return GLFW_TRUE; return GLFW_TRUE;
} }
@@ -1797,7 +1830,8 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
{ {
BOOL enabled; BOOL composition, opaque;
DWORD color;
if (!window->win32.transparent) if (!window->win32.transparent)
return GLFW_FALSE; return GLFW_FALSE;
@@ -1805,7 +1839,20 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
if (!IsWindowsVistaOrGreater()) if (!IsWindowsVistaOrGreater())
return GLFW_FALSE; return GLFW_FALSE;
return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
return GLFW_FALSE;
if (!IsWindows8OrGreater())
{
// HACK: Disable framebuffer transparency on Windows 7 when the
// colorization color is opaque, because otherwise the window
// contents is blended additively with the previous frame instead
// of replacing it
if (FAILED(DwmGetColorizationColor(&color, &opaque)) || opaque)
return GLFW_FALSE;
}
return GLFW_TRUE;
} }
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
+1
View File
@@ -1099,3 +1099,4 @@ GLFWAPI void glfwPostEmptyEvent(void)
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
_glfwPlatformPostEmptyEvent(); _glfwPlatformPostEmptyEvent();
} }
+2 -2
View File
@@ -347,9 +347,9 @@ static void pointerHandleAxis(void* data,
axis == WL_POINTER_AXIS_VERTICAL_SCROLL); axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
x = wl_fixed_to_double(value) * scrollFactor; x = -wl_fixed_to_double(value) * scrollFactor;
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
y = wl_fixed_to_double(value) * scrollFactor; y = -wl_fixed_to_double(value) * scrollFactor;
_glfwInputScroll(window, x, y); _glfwInputScroll(window, x, y);
} }
+8
View File
@@ -88,6 +88,14 @@ static void outputHandleDone(void* data, struct wl_output* output)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor *monitor = data;
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
{
// If Wayland does not provide a physical size, assume the default 96 DPI
const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode];
monitor->widthMM = (int) (mode->width * 25.4f / 96.f);
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
}
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
} }
+20 -11
View File
@@ -208,8 +208,8 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
if (fd < 0) if (fd < 0)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Creating a buffer file for %d B failed: %m", "Wayland: Creating a buffer file for %d B failed: %s",
length); length, strerror(errno));
return NULL; return NULL;
} }
@@ -217,7 +217,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
if (data == MAP_FAILED) if (data == MAP_FAILED)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: mmap failed: %m"); "Wayland: mmap failed: %s", strerror(errno));
close(fd); close(fd);
return NULL; return NULL;
} }
@@ -312,10 +312,10 @@ static void createDecorations(_GLFWwindow* window)
static void destroyDecoration(_GLFWdecorationWayland* decoration) static void destroyDecoration(_GLFWdecorationWayland* decoration)
{ {
if (decoration->surface)
wl_surface_destroy(decoration->surface);
if (decoration->subsurface) if (decoration->subsurface)
wl_subsurface_destroy(decoration->subsurface); wl_subsurface_destroy(decoration->subsurface);
if (decoration->surface)
wl_surface_destroy(decoration->surface);
if (decoration->viewport) if (decoration->viewport)
wp_viewport_destroy(decoration->viewport); wp_viewport_destroy(decoration->viewport);
decoration->surface = NULL; decoration->surface = NULL;
@@ -870,10 +870,17 @@ static void handleEvents(int timeout)
if (read_ret != 8) if (read_ret != 8)
return; return;
for (i = 0; i < repeats; ++i) if (_glfw.wl.keyboardFocus)
_glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey, {
_glfw.wl.keyboardLastScancode, GLFW_REPEAT, for (i = 0; i < repeats; ++i)
_glfw.wl.xkb.modifiers); {
_glfwInputKey(_glfw.wl.keyboardFocus,
_glfw.wl.keyboardLastKey,
_glfw.wl.keyboardLastScancode,
GLFW_REPEAT,
_glfw.wl.xkb.modifiers);
}
}
} }
if (fds[2].revents & POLLIN) if (fds[2].revents & POLLIN)
@@ -1111,8 +1118,10 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
int* width, int* height) int* width, int* height)
{ {
_glfwPlatformGetWindowSize(window, width, height); _glfwPlatformGetWindowSize(window, width, height);
*width *= window->wl.scale; if (width)
*height *= window->wl.scale; *width *= window->wl.scale;
if (height)
*height *= window->wl.scale;
} }
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
+226 -121
View File
@@ -38,24 +38,15 @@
#include <locale.h> #include <locale.h>
// Translate an X11 key code to a GLFW key code. // Translate the X11 KeySyms for a key to a GLFW key code
// NOTE: This is only used as a fallback, in case the XKB method fails
// It is layout-dependent and will fail partially on most non-US layouts
// //
static int translateKeyCode(int scancode) static int translateKeySyms(const KeySym* keysyms, int width)
{ {
int keySym; if (width > 1)
// Valid key code range is [8,255], according to the Xlib manual
if (scancode < 8 || scancode > 255)
return GLFW_KEY_UNKNOWN;
if (_glfw.x11.xkb.available)
{ {
// Try secondary keysym, for numeric keypad keys switch (keysyms[1])
// Note: This way we always force "NumLock = ON", which is intentional
// since the returned key code should correspond to a physical
// location.
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 1);
switch (keySym)
{ {
case XK_KP_0: return GLFW_KEY_KP_0; case XK_KP_0: return GLFW_KEY_KP_0;
case XK_KP_1: return GLFW_KEY_KP_1; case XK_KP_1: return GLFW_KEY_KP_1;
@@ -73,22 +64,9 @@ static int translateKeyCode(int scancode)
case XK_KP_Enter: return GLFW_KEY_KP_ENTER; case XK_KP_Enter: return GLFW_KEY_KP_ENTER;
default: break; default: break;
} }
// Now try primary keysym for function keys (non-printable keys)
// These should not depend on the current keyboard layout
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 0);
}
else
{
int dummy;
KeySym* keySyms;
keySyms = XGetKeyboardMapping(_glfw.x11.display, scancode, 1, &dummy);
keySym = keySyms[0];
XFree(keySyms);
} }
switch (keySym) switch (keysyms[0])
{ {
case XK_Escape: return GLFW_KEY_ESCAPE; case XK_Escape: return GLFW_KEY_ESCAPE;
case XK_Tab: return GLFW_KEY_TAB; case XK_Tab: return GLFW_KEY_TAB;
@@ -232,7 +210,7 @@ static int translateKeyCode(int scancode)
// //
static void createKeyTables(void) static void createKeyTables(void)
{ {
int scancode, key; int scancode, scancodeMin, scancodeMax;
memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes)); memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes));
memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes)); memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes));
@@ -242,89 +220,217 @@ static void createKeyTables(void)
// Use XKB to determine physical key locations independently of the // Use XKB to determine physical key locations independently of the
// current keyboard layout // current keyboard layout
char name[XkbKeyNameLength + 1];
XkbDescPtr desc = XkbGetMap(_glfw.x11.display, 0, XkbUseCoreKbd); XkbDescPtr desc = XkbGetMap(_glfw.x11.display, 0, XkbUseCoreKbd);
XkbGetNames(_glfw.x11.display, XkbKeyNamesMask, desc); XkbGetNames(_glfw.x11.display, XkbKeyNamesMask | XkbKeyAliasesMask, desc);
scancodeMin = desc->min_key_code;
scancodeMax = desc->max_key_code;
const struct
{
int key;
char* name;
} keymap[] =
{
{ GLFW_KEY_GRAVE_ACCENT, "TLDE" },
{ GLFW_KEY_1, "AE01" },
{ GLFW_KEY_2, "AE02" },
{ GLFW_KEY_3, "AE03" },
{ GLFW_KEY_4, "AE04" },
{ GLFW_KEY_5, "AE05" },
{ GLFW_KEY_6, "AE06" },
{ GLFW_KEY_7, "AE07" },
{ GLFW_KEY_8, "AE08" },
{ GLFW_KEY_9, "AE09" },
{ GLFW_KEY_0, "AE10" },
{ GLFW_KEY_MINUS, "AE11" },
{ GLFW_KEY_EQUAL, "AE12" },
{ GLFW_KEY_Q, "AD01" },
{ GLFW_KEY_W, "AD02" },
{ GLFW_KEY_E, "AD03" },
{ GLFW_KEY_R, "AD04" },
{ GLFW_KEY_T, "AD05" },
{ GLFW_KEY_Y, "AD06" },
{ GLFW_KEY_U, "AD07" },
{ GLFW_KEY_I, "AD08" },
{ GLFW_KEY_O, "AD09" },
{ GLFW_KEY_P, "AD10" },
{ GLFW_KEY_LEFT_BRACKET, "AD11" },
{ GLFW_KEY_RIGHT_BRACKET, "AD12" },
{ GLFW_KEY_A, "AC01" },
{ GLFW_KEY_S, "AC02" },
{ GLFW_KEY_D, "AC03" },
{ GLFW_KEY_F, "AC04" },
{ GLFW_KEY_G, "AC05" },
{ GLFW_KEY_H, "AC06" },
{ GLFW_KEY_J, "AC07" },
{ GLFW_KEY_K, "AC08" },
{ GLFW_KEY_L, "AC09" },
{ GLFW_KEY_SEMICOLON, "AC10" },
{ GLFW_KEY_APOSTROPHE, "AC11" },
{ GLFW_KEY_Z, "AB01" },
{ GLFW_KEY_X, "AB02" },
{ GLFW_KEY_C, "AB03" },
{ GLFW_KEY_V, "AB04" },
{ GLFW_KEY_B, "AB05" },
{ GLFW_KEY_N, "AB06" },
{ GLFW_KEY_M, "AB07" },
{ GLFW_KEY_COMMA, "AB08" },
{ GLFW_KEY_PERIOD, "AB09" },
{ GLFW_KEY_SLASH, "AB10" },
{ GLFW_KEY_BACKSLASH, "BKSL" },
{ GLFW_KEY_WORLD_1, "LSGT" },
{ GLFW_KEY_SPACE, "SPCE" },
{ GLFW_KEY_ESCAPE, "ESC" },
{ GLFW_KEY_ENTER, "RTRN" },
{ GLFW_KEY_TAB, "TAB" },
{ GLFW_KEY_BACKSPACE, "BKSP" },
{ GLFW_KEY_INSERT, "INS" },
{ GLFW_KEY_DELETE, "DELE" },
{ GLFW_KEY_RIGHT, "RGHT" },
{ GLFW_KEY_LEFT, "LEFT" },
{ GLFW_KEY_DOWN, "DOWN" },
{ GLFW_KEY_UP, "UP" },
{ GLFW_KEY_PAGE_UP, "PGUP" },
{ GLFW_KEY_PAGE_DOWN, "PGDN" },
{ GLFW_KEY_HOME, "HOME" },
{ GLFW_KEY_END, "END" },
{ GLFW_KEY_CAPS_LOCK, "CAPS" },
{ GLFW_KEY_SCROLL_LOCK, "SCLK" },
{ GLFW_KEY_NUM_LOCK, "NMLK" },
{ GLFW_KEY_PRINT_SCREEN, "PRSC" },
{ GLFW_KEY_PAUSE, "PAUS" },
{ GLFW_KEY_F1, "FK01" },
{ GLFW_KEY_F2, "FK02" },
{ GLFW_KEY_F3, "FK03" },
{ GLFW_KEY_F4, "FK04" },
{ GLFW_KEY_F5, "FK05" },
{ GLFW_KEY_F6, "FK06" },
{ GLFW_KEY_F7, "FK07" },
{ GLFW_KEY_F8, "FK08" },
{ GLFW_KEY_F9, "FK09" },
{ GLFW_KEY_F10, "FK10" },
{ GLFW_KEY_F11, "FK11" },
{ GLFW_KEY_F12, "FK12" },
{ GLFW_KEY_F13, "FK13" },
{ GLFW_KEY_F14, "FK14" },
{ GLFW_KEY_F15, "FK15" },
{ GLFW_KEY_F16, "FK16" },
{ GLFW_KEY_F17, "FK17" },
{ GLFW_KEY_F18, "FK18" },
{ GLFW_KEY_F19, "FK19" },
{ GLFW_KEY_F20, "FK20" },
{ GLFW_KEY_F21, "FK21" },
{ GLFW_KEY_F22, "FK22" },
{ GLFW_KEY_F23, "FK23" },
{ GLFW_KEY_F24, "FK24" },
{ GLFW_KEY_F25, "FK25" },
{ GLFW_KEY_KP_0, "KP0" },
{ GLFW_KEY_KP_1, "KP1" },
{ GLFW_KEY_KP_2, "KP2" },
{ GLFW_KEY_KP_3, "KP3" },
{ GLFW_KEY_KP_4, "KP4" },
{ GLFW_KEY_KP_5, "KP5" },
{ GLFW_KEY_KP_6, "KP6" },
{ GLFW_KEY_KP_7, "KP7" },
{ GLFW_KEY_KP_8, "KP8" },
{ GLFW_KEY_KP_9, "KP9" },
{ GLFW_KEY_KP_DECIMAL, "KPDL" },
{ GLFW_KEY_KP_DIVIDE, "KPDV" },
{ GLFW_KEY_KP_MULTIPLY, "KPMU" },
{ GLFW_KEY_KP_SUBTRACT, "KPSU" },
{ GLFW_KEY_KP_ADD, "KPAD" },
{ GLFW_KEY_KP_ENTER, "KPEN" },
{ GLFW_KEY_KP_EQUAL, "KPEQ" },
{ GLFW_KEY_LEFT_SHIFT, "LFSH" },
{ GLFW_KEY_LEFT_CONTROL, "LCTL" },
{ GLFW_KEY_LEFT_ALT, "LALT" },
{ GLFW_KEY_LEFT_SUPER, "LWIN" },
{ GLFW_KEY_RIGHT_SHIFT, "RTSH" },
{ GLFW_KEY_RIGHT_CONTROL, "RCTL" },
{ GLFW_KEY_RIGHT_ALT, "RALT" },
{ GLFW_KEY_RIGHT_ALT, "LVL3" },
{ GLFW_KEY_RIGHT_ALT, "MDSW" },
{ GLFW_KEY_RIGHT_SUPER, "RWIN" },
{ GLFW_KEY_MENU, "MENU" }
};
// Find the X11 key code -> GLFW key code mapping // Find the X11 key code -> GLFW key code mapping
for (scancode = desc->min_key_code; scancode <= desc->max_key_code; scancode++) for (scancode = scancodeMin; scancode <= scancodeMax; scancode++)
{ {
memcpy(name, desc->names->keys[scancode].name, XkbKeyNameLength); int key = GLFW_KEY_UNKNOWN;
name[XkbKeyNameLength] = '\0';
// Map the key name to a GLFW key code. Note: We only map printable // Map the key name to a GLFW key code. Note: We use the US
// keys here, and we use the US keyboard layout. The rest of the // keyboard layout. Because function keys aren't mapped correctly
// keys (function keys) are mapped using traditional KeySym // when using traditional KeySym translations, they are mapped
// translations. // here instead.
if (strcmp(name, "TLDE") == 0) key = GLFW_KEY_GRAVE_ACCENT; for (int i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++)
else if (strcmp(name, "AE01") == 0) key = GLFW_KEY_1; {
else if (strcmp(name, "AE02") == 0) key = GLFW_KEY_2; if (strncmp(desc->names->keys[scancode].name,
else if (strcmp(name, "AE03") == 0) key = GLFW_KEY_3; keymap[i].name,
else if (strcmp(name, "AE04") == 0) key = GLFW_KEY_4; XkbKeyNameLength) == 0)
else if (strcmp(name, "AE05") == 0) key = GLFW_KEY_5; {
else if (strcmp(name, "AE06") == 0) key = GLFW_KEY_6; key = keymap[i].key;
else if (strcmp(name, "AE07") == 0) key = GLFW_KEY_7; break;
else if (strcmp(name, "AE08") == 0) key = GLFW_KEY_8; }
else if (strcmp(name, "AE09") == 0) key = GLFW_KEY_9; }
else if (strcmp(name, "AE10") == 0) key = GLFW_KEY_0;
else if (strcmp(name, "AE11") == 0) key = GLFW_KEY_MINUS;
else if (strcmp(name, "AE12") == 0) key = GLFW_KEY_EQUAL;
else if (strcmp(name, "AD01") == 0) key = GLFW_KEY_Q;
else if (strcmp(name, "AD02") == 0) key = GLFW_KEY_W;
else if (strcmp(name, "AD03") == 0) key = GLFW_KEY_E;
else if (strcmp(name, "AD04") == 0) key = GLFW_KEY_R;
else if (strcmp(name, "AD05") == 0) key = GLFW_KEY_T;
else if (strcmp(name, "AD06") == 0) key = GLFW_KEY_Y;
else if (strcmp(name, "AD07") == 0) key = GLFW_KEY_U;
else if (strcmp(name, "AD08") == 0) key = GLFW_KEY_I;
else if (strcmp(name, "AD09") == 0) key = GLFW_KEY_O;
else if (strcmp(name, "AD10") == 0) key = GLFW_KEY_P;
else if (strcmp(name, "AD11") == 0) key = GLFW_KEY_LEFT_BRACKET;
else if (strcmp(name, "AD12") == 0) key = GLFW_KEY_RIGHT_BRACKET;
else if (strcmp(name, "AC01") == 0) key = GLFW_KEY_A;
else if (strcmp(name, "AC02") == 0) key = GLFW_KEY_S;
else if (strcmp(name, "AC03") == 0) key = GLFW_KEY_D;
else if (strcmp(name, "AC04") == 0) key = GLFW_KEY_F;
else if (strcmp(name, "AC05") == 0) key = GLFW_KEY_G;
else if (strcmp(name, "AC06") == 0) key = GLFW_KEY_H;
else if (strcmp(name, "AC07") == 0) key = GLFW_KEY_J;
else if (strcmp(name, "AC08") == 0) key = GLFW_KEY_K;
else if (strcmp(name, "AC09") == 0) key = GLFW_KEY_L;
else if (strcmp(name, "AC10") == 0) key = GLFW_KEY_SEMICOLON;
else if (strcmp(name, "AC11") == 0) key = GLFW_KEY_APOSTROPHE;
else if (strcmp(name, "AB01") == 0) key = GLFW_KEY_Z;
else if (strcmp(name, "AB02") == 0) key = GLFW_KEY_X;
else if (strcmp(name, "AB03") == 0) key = GLFW_KEY_C;
else if (strcmp(name, "AB04") == 0) key = GLFW_KEY_V;
else if (strcmp(name, "AB05") == 0) key = GLFW_KEY_B;
else if (strcmp(name, "AB06") == 0) key = GLFW_KEY_N;
else if (strcmp(name, "AB07") == 0) key = GLFW_KEY_M;
else if (strcmp(name, "AB08") == 0) key = GLFW_KEY_COMMA;
else if (strcmp(name, "AB09") == 0) key = GLFW_KEY_PERIOD;
else if (strcmp(name, "AB10") == 0) key = GLFW_KEY_SLASH;
else if (strcmp(name, "BKSL") == 0) key = GLFW_KEY_BACKSLASH;
else if (strcmp(name, "LSGT") == 0) key = GLFW_KEY_WORLD_1;
else key = GLFW_KEY_UNKNOWN;
if ((scancode >= 0) && (scancode < 256)) // Fall back to key aliases in case the key name did not match
_glfw.x11.keycodes[scancode] = key; for (int i = 0; i < desc->names->num_key_aliases; i++)
{
if (key != GLFW_KEY_UNKNOWN)
break;
if (strncmp(desc->names->key_aliases[i].real,
desc->names->keys[scancode].name,
XkbKeyNameLength) != 0)
{
continue;
}
for (int j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++)
{
if (strncmp(desc->names->key_aliases[i].alias,
keymap[j].name,
XkbKeyNameLength) == 0)
{
key = keymap[j].key;
break;
}
}
}
_glfw.x11.keycodes[scancode] = key;
} }
XkbFreeNames(desc, XkbKeyNamesMask, True); XkbFreeNames(desc, XkbKeyNamesMask, True);
XkbFreeKeyboard(desc, 0, True); XkbFreeKeyboard(desc, 0, True);
} }
else
XDisplayKeycodes(_glfw.x11.display, &scancodeMin, &scancodeMax);
for (scancode = 0; scancode < 256; scancode++) int width;
KeySym* keysyms = XGetKeyboardMapping(_glfw.x11.display,
scancodeMin,
scancodeMax - scancodeMin + 1,
&width);
for (scancode = scancodeMin; scancode <= scancodeMax; scancode++)
{ {
// Translate the un-translated key codes using traditional X11 KeySym // Translate the un-translated key codes using traditional X11 KeySym
// lookups // lookups
if (_glfw.x11.keycodes[scancode] < 0) if (_glfw.x11.keycodes[scancode] < 0)
_glfw.x11.keycodes[scancode] = translateKeyCode(scancode); {
const size_t base = (scancode - scancodeMin) * width;
_glfw.x11.keycodes[scancode] = translateKeySyms(&keysyms[base], width);
}
// Store the reverse translation for faster key name lookup // Store the reverse translation for faster key name lookup
if (_glfw.x11.keycodes[scancode] > 0) if (_glfw.x11.keycodes[scancode] > 0)
_glfw.x11.scancodes[_glfw.x11.keycodes[scancode]] = scancode; _glfw.x11.scancodes[_glfw.x11.keycodes[scancode]] = scancode;
} }
XFree(keysyms);
} }
// Check whether the IM has a usable style // Check whether the IM has a usable style
@@ -352,13 +458,13 @@ static GLFWbool hasUsableInputMethodStyle(void)
// Check whether the specified atom is supported // Check whether the specified atom is supported
// //
static Atom getSupportedAtom(Atom* supportedAtoms, static Atom getAtomIfSupported(Atom* supportedAtoms,
unsigned long atomCount, unsigned long atomCount,
const char* atomName) const char* atomName)
{ {
const Atom atom = XInternAtom(_glfw.x11.display, atomName, False); const Atom atom = XInternAtom(_glfw.x11.display, atomName, False);
for (unsigned int i = 0; i < atomCount; i++) for (unsigned long i = 0; i < atomCount; i++)
{ {
if (supportedAtoms[i] == atom) if (supportedAtoms[i] == atom)
return atom; return atom;
@@ -426,33 +532,33 @@ static void detectEWMH(void)
// See which of the atoms we support that are supported by the WM // See which of the atoms we support that are supported by the WM
_glfw.x11.NET_WM_STATE = _glfw.x11.NET_WM_STATE =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE");
_glfw.x11.NET_WM_STATE_ABOVE = _glfw.x11.NET_WM_STATE_ABOVE =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
_glfw.x11.NET_WM_STATE_FULLSCREEN = _glfw.x11.NET_WM_STATE_FULLSCREEN =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT = _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT");
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ = _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ");
_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION = _glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION");
_glfw.x11.NET_WM_FULLSCREEN_MONITORS = _glfw.x11.NET_WM_FULLSCREEN_MONITORS =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
_glfw.x11.NET_WM_WINDOW_TYPE = _glfw.x11.NET_WM_WINDOW_TYPE =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL = _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL");
_glfw.x11.NET_WORKAREA = _glfw.x11.NET_WORKAREA =
getSupportedAtom(supportedAtoms, atomCount, "_NET_WORKAREA"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_WORKAREA");
_glfw.x11.NET_CURRENT_DESKTOP = _glfw.x11.NET_CURRENT_DESKTOP =
getSupportedAtom(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP");
_glfw.x11.NET_ACTIVE_WINDOW = _glfw.x11.NET_ACTIVE_WINDOW =
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
_glfw.x11.NET_FRAME_EXTENTS = _glfw.x11.NET_FRAME_EXTENTS =
getSupportedAtom(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS");
_glfw.x11.NET_REQUEST_FRAME_EXTENTS = _glfw.x11.NET_REQUEST_FRAME_EXTENTS =
getSupportedAtom(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS"); getAtomIfSupported(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS");
if (supportedAtoms) if (supportedAtoms)
XFree(supportedAtoms); XFree(supportedAtoms);
@@ -660,13 +766,12 @@ static GLFWbool initExtensions(void)
_glfw.x11.xkb.detectable = GLFW_TRUE; _glfw.x11.xkb.detectable = GLFW_TRUE;
} }
_glfw.x11.xkb.group = 0;
XkbStateRec state; XkbStateRec state;
if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success) if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success)
{
XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
_glfw.x11.xkb.group = (unsigned int)state.group; _glfw.x11.xkb.group = (unsigned int)state.group;
}
XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify,
XkbGroupStateMask, XkbGroupStateMask);
} }
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
@@ -851,6 +956,9 @@ static Window createHelperWindow(void)
// //
static int errorHandler(Display *display, XErrorEvent* event) static int errorHandler(Display *display, XErrorEvent* event)
{ {
if (_glfw.x11.display != display)
return 0;
_glfw.x11.errorCode = event->error_code; _glfw.x11.errorCode = event->error_code;
return 0; return 0;
} }
@@ -931,15 +1039,12 @@ Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot)
int _glfwPlatformInit(void) int _glfwPlatformInit(void)
{ {
#if !defined(X_HAVE_UTF8_STRING) // HACK: If the application has left the locale as "C" then both wide
// HACK: If the current locale is "C" and the Xlib UTF-8 functions are // character text input and explicit UTF-8 input via XIM will break
// unavailable, apply the environment's locale in the hope that it's // This sets the CTYPE part of the current locale from the environment
// both available and not "C" // in the hope that it is set to something more sane than "C"
// This is done because the "C" locale breaks wide character input,
// which is what we fall back on when UTF-8 support is missing
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0) if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
#endif
XInitThreads(); XInitThreads();
XrmInitialize(); XrmInitialize();
+1 -1
View File
@@ -164,7 +164,7 @@ void _glfwPollMonitorsX11(void)
if (widthMM <= 0 || heightMM <= 0) if (widthMM <= 0 || heightMM <= 0)
{ {
// HACK: If RandR does not provide a physical size, assume the // HACK: If RandR does not provide a physical size, assume the
// X11 default 96 DPI and calcuate from the CRTC viewport // X11 default 96 DPI and calculate from the CRTC viewport
// NOTE: These members are affected by rotation, unlike the mode // NOTE: These members are affected by rotation, unlike the mode
// info and output info members // info and output info members
widthMM = (int) (ci->width * 25.4f / 96.f); widthMM = (int) (ci->width * 25.4f / 96.f);
+3 -2
View File
@@ -199,8 +199,9 @@ typedef struct _GLFWwindowX11
// The last position the cursor was warped to by GLFW // The last position the cursor was warped to by GLFW
int warpCursorPosX, warpCursorPosY; int warpCursorPosX, warpCursorPosY;
// The time of the last KeyPress event // The time of the last KeyPress event per keycode, for discarding
Time lastKeyTime; // duplicate key events generated for some keys by ibus
Time keyPressTimes[256];
} _GLFWwindowX11; } _GLFWwindowX11;
+38 -16
View File
@@ -1195,6 +1195,8 @@ static void processEvent(XEvent *event)
{ {
_glfw.x11.xkb.group = ((XkbEvent*) event)->state.group; _glfw.x11.xkb.group = ((XkbEvent*) event)->state.group;
} }
return;
} }
} }
@@ -1273,16 +1275,20 @@ static void processEvent(XEvent *event)
if (window->x11.ic) if (window->x11.ic)
{ {
// HACK: Ignore duplicate key press events generated by ibus // HACK: Do not report the key press events duplicated by XIM
// These have the same timestamp as the original event // Duplicate key releases are filtered out implicitly by
// Corresponding release events are filtered out // the GLFW key repeat logic in _glfwInputKey
// implicitly by the GLFW key repeat logic // A timestamp per key is used to handle simultaneous keys
if (window->x11.lastKeyTime < event->xkey.time) // NOTE: Always allow the first event for each key through
// (the server never sends a timestamp of zero)
// NOTE: Timestamp difference is compared to handle wrap-around
Time diff = event->xkey.time - window->x11.keyPressTimes[keycode];
if (diff == event->xkey.time || (diff > 0 && diff < (1 << 31)))
{ {
if (keycode) if (keycode)
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods); _glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
window->x11.lastKeyTime = event->xkey.time; window->x11.keyPressTimes[keycode] = event->xkey.time;
} }
if (!filtered) if (!filtered)
@@ -1557,6 +1563,8 @@ static void processEvent(XEvent *event)
// the position into root (screen) coordinates // the position into root (screen) coordinates
if (!event->xany.send_event && window->x11.parent != _glfw.x11.root) if (!event->xany.send_event && window->x11.parent != _glfw.x11.root)
{ {
_glfwGrabErrorHandlerX11();
Window dummy; Window dummy;
XTranslateCoordinates(_glfw.x11.display, XTranslateCoordinates(_glfw.x11.display,
window->x11.parent, window->x11.parent,
@@ -1564,6 +1572,10 @@ static void processEvent(XEvent *event)
xpos, ypos, xpos, ypos,
&xpos, &ypos, &xpos, &ypos,
&dummy); &dummy);
_glfwReleaseErrorHandlerX11();
if (_glfw.x11.errorCode == BadWindow)
return;
} }
if (xpos != window->x11.xpos || ypos != window->x11.ypos) if (xpos != window->x11.xpos || ypos != window->x11.ypos)
@@ -1971,7 +1983,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig, const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig)
{ {
Visual* visual; Visual* visual = NULL;
int depth; int depth;
if (ctxconfig->client != GLFW_NO_API) if (ctxconfig->client != GLFW_NO_API)
@@ -1997,8 +2009,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
} }
} }
if (ctxconfig->client == GLFW_NO_API || if (!visual)
ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
{ {
visual = DefaultVisual(_glfw.x11.display, _glfw.x11.screen); visual = DefaultVisual(_glfw.x11.display, _glfw.x11.screen);
depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen); depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen);
@@ -2489,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);
@@ -2580,13 +2595,19 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
int rootX, rootY, childX, childY; int rootX, rootY, childX, childY;
unsigned int mask; unsigned int mask;
if (!XQueryPointer(_glfw.x11.display, w, _glfwGrabErrorHandlerX11();
&root, &w, &rootX, &rootY, &childX, &childY, &mask))
{
return GLFW_FALSE;
}
if (w == window->x11.handle) const Bool result = XQueryPointer(_glfw.x11.display, w,
&root, &w, &rootX, &rootY,
&childX, &childY, &mask);
_glfwReleaseErrorHandlerX11();
if (_glfw.x11.errorCode == BadWindow)
w = _glfw.x11.root;
else if (!result)
return GLFW_FALSE;
else if (w == window->x11.handle)
return GLFW_TRUE; return GLFW_TRUE;
} }
@@ -2950,8 +2971,9 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
void _glfwPlatformSetClipboardString(const char* string) void _glfwPlatformSetClipboardString(const char* string)
{ {
char* copy = _glfw_strdup(string);
free(_glfw.x11.clipboardString); free(_glfw.x11.clipboardString);
_glfw.x11.clipboardString = _glfw_strdup(string); _glfw.x11.clipboardString = copy;
XSetSelectionOwner(_glfw.x11.display, XSetSelectionOwner(_glfw.x11.display,
_glfw.x11.CLIPBOARD, _glfw.x11.CLIPBOARD,
+46 -142
View File
@@ -70,150 +70,54 @@ static GLADapiproc glad_vulkan_callback(const char* name, void* user)
return glfwGetInstanceProcAddress((VkInstance) user, name); return glfwGetInstanceProcAddress((VkInstance) user, name);
} }
static const char fragShaderCode[] = { static const uint32_t fragShaderCode[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x07230203,0x00010000,0x00080007,0x00000014,0x00000000,0x00020011,0x00000001,0x0006000b,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x00000011,0x00030010,
0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00000004,0x00000007,0x00030003,0x00000002,0x00000190,0x00090004,0x415f4c47,0x735f4252,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004,0x415f4c47,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x735f4252,0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361,0x00040005,
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x61724675,0x6c6f4367,0x0000726f,
0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00030005,0x0000000d,0x00786574,0x00050005,0x00000011,0x63786574,0x64726f6f,0x00000000,
0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,0x0000000d,0x00000022,0x00000000,
0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00040047,0x0000000d,0x00000021,0x00000000,0x00040047,0x00000011,0x0000001e,0x00000000,
0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72, 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
0x61, 0x74, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6f, 0x00040017,0x00000007,0x00000006,0x00000004,0x00040020,0x00000008,0x00000003,0x00000007,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0004003b,0x00000008,0x00000009,0x00000003,0x00090019,0x0000000a,0x00000006,0x00000001,
0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x69, 0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x0000000b,0x0000000a,
0x6e, 0x67, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x5f, 0x00040020,0x0000000c,0x00000000,0x0000000b,0x0004003b,0x0000000c,0x0000000d,0x00000000,
0x34, 0x32, 0x30, 0x70, 0x61, 0x63, 0x6b, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00040017,0x0000000f,0x00000006,0x00000002,0x00040020,0x00000010,0x00000001,0x0000000f,
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x0004003b,0x00000010,0x00000011,0x00000001,0x00050036,0x00000002,0x00000004,0x00000000,
0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x46, 0x72, 0x61, 0x00000003,0x000200f8,0x00000005,0x0004003d,0x0000000b,0x0000000e,0x0000000d,0x0004003d,
0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x0000000f,0x00000012,0x00000011,0x00050057,0x00000007,0x00000013,0x0000000e,0x00000012,
0x0d, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0003003e,0x00000009,0x00000013,0x000100fd,0x00010038
0x11, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64,
0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x47, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00,
0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x3b, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x17, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00,
0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
0x57, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00,
0x09, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00,
0x38, 0x00, 0x01, 0x00
}; };
static const char vertShaderCode[] = { static const uint32_t vertShaderCode[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x07230203,0x00010000,0x00080007,0x00000018,0x00000000,0x00020011,0x00000001,0x0006000b,
0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000b,0x00000010,
0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00000014,0x00030003,0x00000002,0x00000190,0x00090004,0x415f4c47,0x735f4252,0x72617065,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004,0x415f4c47,0x735f4252,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361,0x00040005,0x00000004,
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574,0x64726f6f,0x00000000,0x00040005,
0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0000000b,0x72747461,0x00000000,0x00060005,0x0000000e,0x505f6c67,0x65567265,0x78657472,
0x17, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00000000,0x00060006,0x0000000e,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,
0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00000010,0x00000000,0x00030005,0x00000014,0x00736f70,0x00040047,0x00000009,0x0000001e,
0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000001,0x00050048,0x0000000e,0x00000000,
0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x0000000b,0x00000000,0x00030047,0x0000000e,0x00000002,0x00040047,0x00000014,0x0000001e,
0x65, 0x72, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, 0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000003,
0x68, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00040020,0x0000000a,0x00000001,
0x61, 0x67, 0x65, 0x5f, 0x34, 0x32, 0x30, 0x70, 0x61, 0x63, 0x6b, 0x00, 0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x00040017,0x0000000d,0x00000006,
0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000003,0x0000000e,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0004003b,0x0000000f,0x00000010,0x00000003,0x00040015,0x00000011,0x00000020,0x00000001,
0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x00, 0x00, 0x0004002b,0x00000011,0x00000012,0x00000000,0x00040020,0x00000013,0x00000001,0x0000000d,
0x05, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x0004003b,0x00000013,0x00000014,0x00000001,0x00040020,0x00000016,0x00000003,0x0000000d,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,
0x67, 0x6c, 0x5f, 0x50, 0x65, 0x72, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00000007,0x0000000c,0x0000000b,0x0003003e,0x00000009,0x0000000c,0x0004003d,0x0000000d,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00000015,0x00000014,0x00050041,0x00000016,0x00000017,0x00000010,0x00000012,0x0003003e,
0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x00000017,0x00000015,0x000100fd,0x00010038
0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x07, 0x00, 0x11, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x69, 0x6e, 0x74,
0x53, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00,
0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x43,
0x6c, 0x69, 0x70, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x00,
0x05, 0x00, 0x03, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x03, 0x00, 0x17, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x00,
0x05, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x56,
0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, 0x05, 0x00, 0x06, 0x00,
0x1d, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x49, 0x6e, 0x73, 0x74, 0x61,
0x6e, 0x63, 0x65, 0x49, 0x44, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x47, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00,
0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x47, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x20, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x15, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00,
0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
0x3b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00,
0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
0x19, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
0x1b, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00,
0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00,
0x09, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
0x41, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00,
0x13, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00,
0x1a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00,
0x38, 0x00, 0x01, 0x00
}; };
struct texture_object { struct texture_object {