Commit Graph

629 Commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
40d150c399 Docs: Remove mentions of extra-cmake-modules 2020-09-30 17:04:20 +02:00
Camilla Löwy
da26eefc61 Update changelog 2020-08-13 15:14:59 +02:00
Camilla Löwy
05dd2fa298 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.
2020-07-29 15:21:45 +02:00
Camilla Löwy
a2674a9034 Cocoa: Fix potential leak of CFNumber object
Spotted by Clang static analysis.
2020-07-23 22:27:40 +02:00
Camilla Löwy
782e6b6cef Make joystick platform code init on demand
This makes joystick support initialize the first time a joystick
function is called, including those gamepad functions that are layered
on top of joystick functions.

Related to #1284.
Related to #1646.
2020-07-21 17:38:56 +02:00
Camilla Löwy
f760b124ca Wayland: Fix scroll offsets being inverted
Scrolling offsets were inverted compared to X11 and Win32.

Fixes #1463.
2020-07-15 23:16:01 +02:00
Camilla Löwy
5f60c22cfa Wayland: Fix partial framebuffer size retrieval 2020-07-15 21:56:52 +02:00
Camilla Löwy
a122d91303 Documentation work for GLFW_MOUSE_PASSTHROUGH
Related to #1568.
2020-07-15 18:02:38 +02:00
Camilla Löwy
9a3664b4a9 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.
2020-07-02 21:38:03 +02:00
Camilla Löwy
6ce2070392 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.
2020-06-29 23:50:05 +02:00
Camilla Löwy
ad9eb768c9 Cocoa: Fix non-BMP Unicode codepoint input
Supplimentary Plane codepoints were reported as UTF-16 surrogate pairs.

Fixes #1635.
2020-06-29 23:03:24 +02:00
Camilla Löwy
854ce1db4e Fix format of change log entry 2020-06-29 21:14:29 +02:00
Camilla Löwy
0dea8a4441 EGL: Add support for EGL_ANGLE_platform_angle
This adds basic support for selecting the platform type (rendering
backend) when running on ANGLE.

Related to #1380.
2020-06-29 00:02:22 +02:00
Camilla Löwy
aec9fae8f3 EGL: Add support for EGL_EXT_platform_base
This adds support for EGL_EXT_platform_base and its associated X11 and
Wayland extensions, allowing us to explicitly tell EGL which window
system we are using.

This is based on work by @linkmauve in #1691.

Closes #1691.
2020-06-24 00:49:55 +02:00
Camilla Löwy
3a3c32c6b1 Add credit
Related to #1712.
2020-06-17 20:21:50 +02:00
Camilla Löwy
c72da994ba 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.
2020-06-02 19:54:30 +02:00
Camilla Löwy
399c2a1fad 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.
2020-06-02 18:04:49 +02:00
Camilla Löwy
9a87c2a4b4 Add feature available/implemented errors
This adds two new error codes: GLFW_FEATURE_UNAVAILABLE for when
a GLFW feature cannot be reasonably implemented on that platform, and
GLFW_FEATURE_UNIMPLEMENTED for when it can be but has not been yet.

This replaces the current situation where the Wayland code emitted
GLFW_PLATFORM_ERROR in both cases while the macOS code silently did
nothing.

If your application exits on any GLFW error, these error codes should at
least be easy to filter out from that behavior.

Ideally, GLFW_FEATURE_UNAVAILABLE should be rare and
GLFW_FEATURE_UNIMPLEMENTED should never be emitted at all.

Fixes #1692.
2020-06-02 17:18:18 +02:00
Corentin Wallez
91eebe922d 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.
2020-05-22 17:37:44 +02:00
Camilla Löwy
215a05af3d Update changelog and add credit
Related to #1598.
2020-03-31 17:30:51 +02:00
Camilla Löwy
e65de2941c 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.
2020-03-31 17:03:29 +02:00
Camilla Löwy
2c8e0512dd X11: Filter out Xlib errors from other connections 2020-03-16 17:15:07 +01:00
Camilla Löwy
44b5d06583 X11: Add support for XIM callbacks
This adds support for the XIM instantiate and destroy callbacks, letting
GLFW detect both when the current input method disappears and when a new
one is started.

Tested with ibus.
2020-03-12 21:05:54 +01:00
Camilla Löwy
72366ac9a9 Cocoa: Finish launching NSApp in glfwInit
This moves the remaining bits of NSApplication initialization into
_glfwPlatformInit.  As a side-effect of this, any command-line program
initializing GLFW will get a menu bar, which is not ideal.

If this has happened to you and a bisect led you here, please see the
GLFW_COCOA_MENUBAR init hint introduced in GLFW 3.3.

If this patch is a terrible idea, please get in touch in the 3.4 release
timeframe.

This is a replacement for 6e6805000a,
which attempts to preserve the existing menu bar creation behavior for
the 3.3-stable branch.

Fixes #1649.
2020-03-12 01:56:35 +01:00
Camilla Löwy
4381b86b6b X11: Fix CJK IME input when locale CTYPE is "C"
Fixes #1587.
Fixes #1636.
2020-02-12 19:01:16 +01:00
Camilla Löwy
d973acc123 Update OpenGL bits of build documentation slightly
This removes most references to GLU, replaces the legacy CMake cache
variables for OpenGL with the modern namespaced target and switches to
$() for command substitution.

Fixes #1580.
2020-01-19 23:35:59 +01:00
Camilla Löwy
13479ed27d Update changelog and add credit
Related to #1602.
2020-01-16 23:52:39 +01:00
Camilla Löwy
65cfe743af Add credit
Related to #1624.
2020-01-16 23:52:39 +01:00
Camilla Löwy
789a2bcb39 Win32: Fix scancode when key message only had VK
Some synthetic key messages come with a scancode of zero, causing them
to be translate to GLFW_KEY_UNKNOWN.  This fills in the missing scancode
by translating the provided virtual key.

Rather than further complicate a single-use function, its body is merged
into the key message handler.

Fixes #1623.
2020-01-16 23:52:36 +01:00
Camilla Löwy
5f1631cb0e Check scancode before use in glfwGetKeyName 2020-01-16 23:17:49 +01:00
Camilla Löwy
562c17d131 Win32: Fix no Super key release event after Win+V
The Win+V hotkey brings up a clipboard history IME that consumes the key
release.  This adds left and right Super to the modifier keys manually
polled for undetected release during event processing.

Fixes #1622.
2020-01-16 23:16:41 +01:00
Camilla Löwy
7da87aaae7 Cocoa: Add fully dynamic loading of Vulkan loader
If the application is not linked against the Vulkan loader and relies on
a third-party loader library or glfwGetInstanceProcAddress, then our
call to dlopen will fail without a custom dyld environment variable.

This adds a fallback of looking in the directory of the main executable,
which matches the bundle structure recommended by the Vulkan SDK, making
that finally work out of the box for fully dynamic loading.
2020-01-16 22:15:30 +01:00
Camilla Löwy
15d91801b7 Cocoa: Select Vulkan surface extension at runtime
This mostly just follows the pattern established by X11.

Related to #1619.
2020-01-16 21:53:18 +01:00
Camilla Löwy
aa5e313561 X11: Fix BadMatch focusing a window on non-EWMH WM
When the WM does not support EWMH or there is no WM running, GLFW falls
back to XSetInputFocus, which will emit BadMatch if the window is not
viewable, which will terminate the program.

Bug spotted on IRC.
2020-01-06 22:45:56 +01:00
Camilla Löwy
fe57e3c292 X11: Fix no window position events during resize
A window resize action that also resulting in the window being moved did
not emit any window positions events, as the position of real
ConfigureNotify events was ignored.  The real events use parent
coordinates instead of root coordinates so this adds parent tracking and
conditional translation.

Fixes #1613.
2020-01-01 16:56:32 +01:00
Camilla Löwy
6b01affd89 Update changelog 2020-01-01 01:43:40 +01:00
Camilla Löwy
bf292f0083 Update changelog and add credit 2020-01-01 01:43:30 +01:00
Camilla Löwy
4ec7daf3e9 Cocoa: Replace display link with IOKit query
This removes the final dependency on CoreVideo, using a display link to
get the refresh rate of monitors where Core Graphics report a refresh
rate of zero.  Instead we now query the I/O registry directly, similarly
to what the display link does at creation.

Thanks to @OneSadCookie for pointers to this solution.
2019-12-25 21:53:04 +01:00
Camilla Löwy
54e8e0b092 NSGL: Remove problematic swap interval workaround
Fixes #1483.
2019-12-20 09:46:48 +01:00
Camilla Löwy
9db156421f X11: Fix updating GLFW_FLOATING on a hidden window 2019-12-17 01:53:40 +01:00
Camilla Löwy
0b652a44d2 X11: Fix invalid read when clearing GLFW_FLOATING 2019-12-17 01:51:35 +01:00
Camilla Löwy
4837b78ffe X11: Fix maximization of hidden windows
This fixes glfwMaximizeWindow having no effect on hidden windows by
manually appending the maximization states to the EWMH state property.
2019-12-16 16:22:15 +01:00
Camilla Löwy
081484ed34 Fix POSIX conformance issues for clock_gettime
CLOCK_MONOTONIC should not be used as a feature macro.  The POSIX
feature macros are provided by unistd.h.  CLOCK_MONOTONIC is provided by
time.h.  CLOCK_MONOTONIC requires _POSIX_C_SOURCE >= 199309L on some
systems.
2019-12-15 18:15:40 +01:00
Camilla Löwy
2551829f75 Win32: Add VERSIONINFO resource to GLFW DLL
This will let people see the API version in the Explorer property box.
2019-12-11 21:02:08 +01:00
Camilla Löwy
7e03bce138 Fix typo 2019-12-11 21:02:08 +01:00
Luflosi
ac30ef3e0c Fix typo
Fixes #1601.
2019-12-11 21:02:01 +01:00
Camilla Löwy
a43f545677 Add dependency name hints to CMake error messages
Fixes #1605.
2019-12-10 10:56:39 +01:00
Camilla Löwy
59055d585f Update minimum required CMake version to 3.1 2019-12-09 23:48:26 +01:00
Camilla Löwy
fa60269245 NSGL: Fix disabling of Retina resolution
It appears the default is now YES.

Fixes #1442.
2019-12-09 22:25:59 +01:00
Camilla Löwy
6e6805000a Cocoa: Fix pre-window-creation event processing
Polling the event queue before NSApp had been allowed to finish
launching, in our case by starting our self-terminating run loop,
triggered an assertion inside NSApplication.

This fix, which makes all event processing functions capable of starting
it, makes that assertion less likely.

A more Cocoa-friendly fix would be to finish launching NSApp during
glfwInit and let people annoyed by the menu bar disabled it with
GLFW_COCOA_MENUBAR.  That may not be suitable for 3.3-stable, though.

Fixes #1543.
2019-12-09 22:25:59 +01:00