Commit Graph

2629 Commits

Author SHA1 Message Date
Camilla Löwy dfeacee000 Move mouse passthrough before window showing
Related to #1568.
2020-07-15 18:02:38 +02:00
Camilla Löwy 1095a43708 Remove no-op call at window creation
Related to #1568.
2020-07-15 18:02:38 +02:00
Camilla Löwy 6d2003d07a Move management of shared state to shared code
Platform code may not modify shared state.

Related to #1568.
2020-07-15 18:02:38 +02:00
Camilla Löwy 7da3e52c86 Win32: Fix GLFW_MOUSE_PASSTHROUGH dropping events
Returning HTTRANSPARENT from WM_NCHITTEST does cause the window to be
transparent for some hit-testing APIs but does not make it pass mouse
input through to whatever window is below it.

For that to work on modern Windows, the window needs to be both layered
and extended-window-style-transparent.

Additional logic changes to ensure mouse input passthrough, framebuffer
transparency and window opacity are mindful of one another when
modifying WS_EX_LAYERED.

Related to #1568.
2020-07-15 18:00:43 +02:00
Camilla Löwy 68e4261d73 X11: Include X Shape extension headers
Related to #1568.
2020-07-15 18:00:00 +02:00
Camilla Löwy e81d381256 X11: Fix disabling of GLFW_MOUSE_PASSTHROUGH
The client clip region was left in place when mouse passthrough was
disabled, leading to missing mouse input if the window grew beyond it.

Related to #1568.
2020-07-15 18:00:00 +02:00
Rokas Kupstys d285a9fdeb Add support for mouse input transparency
This adds the GLFW_MOUSE_PASSTHROUGH window hint and attribute for
controlling whether mouse input passes through the window to whatever
window is behind it.

Fixes #1236.
Closes #1568.
2020-07-15 17:59:55 +02:00
Camilla Löwy 6c031af245 Null: Fix typos in workarea retrieval 2020-07-13 19:43:13 +02:00
Camilla Löwy 49dbcfcb8c X11: Fix cursor hover query retry behavior
XQueryPointer returns zero on BadWindow so the retry did not happen.

Related to ceb20c7f97.
2020-07-10 00:05:09 +02:00
Camilla Löwy ceb20c7f97 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.
2020-07-09 22:36:59 +02:00
Camilla Löwy 4ae93e0547 X11: Remove non-UTF-8 fallback paths
It seems it has not been possible to compile GLFW on systems without the
UTF-8 extensions to Xlib since a0a5cc57df
was merged five months ago.  The UTF-8 extension functions were
introduced with XFree86 4.0.2 in December 2000 and are likely widely
available at this point.

This removes the locale-dependent fallback paths and uses the UTF-8
extension functions where available.
2020-07-02 21:38:40 +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 e47832ffcf Cocoa: Fix regression in private use area check
This fixes a regression introduced by
ad9eb768c9.
2020-06-29 23:23:26 +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 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 b420ca7404 Add GLFW_CONTEXT_DEBUG window hint alias
This adds GLFW_CONTEXT_DEBUG as a preferred alias for
the GLFW_OPENGL_DEBUG_CONTEXT window hint, as debug contexts are
defined for both OpenGL and OpenGL ES.

Related to #1720.
2020-06-28 19:27:48 +02:00
Camilla Löwy 2539d03747 Win32: Use helper window DC as EGL native display
Closes #1717.
2020-06-24 00:51:19 +02:00
Camilla Löwy bcb8558189 Remove EGL and OSMesa struct member macros
Now that the EGL and OSMesa structs can be used safely by any platform,
the member macros serve no purpose.
2020-06-24 00:50:49 +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 d7f7b0e1b5 EGL: Replace native handle macros with functions
This change is in preparation both for EGL_EXT_platform_base and runtime
GLFW platform selection.

Related to #1691.
2020-06-24 00:48:53 +02:00
Luflosi b66f105f3e
Fix typos 2020-06-23 16:41:37 +02:00
Camilla Löwy c1f60ab5dc Make compiler specific workarounds more consistent 2020-06-08 01:07:35 +02:00
Camilla Löwy e47705d8fb Move more compiler workarounds to library setup
These are details of the glfw CMake target and belong in the creation of
that target.
2020-06-08 01:07:34 +02:00
Camilla Löwy e0c77f71f9 Null: Make platform more conformant
This makes the null platform behave more like an actual stub.  More
queryable state is tracked and there is even a fake monitor with one
whole fake video mode.
2020-06-02 22:40:09 +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 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
ben1 a84a30ab63 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.
2020-05-26 21:37:20 +02:00
Luflosi 250b94cd03 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.
2020-05-26 20:19:14 +02:00
Luflosi d4f5074535 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.
2020-05-25 16:05:49 +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 51a465ee2b Win32: Remove checks for pre-XP Windows
Windows XP is the oldest version supported by GLFW 3.4.
2020-05-20 17:59:10 +02:00
Camilla Löwy 5f9dfe3d83 X11: Clarify function name and comment 2020-05-19 22:36:44 +02:00
Camilla Löwy ef5220d6b1 X11: Clarify code flow for Clang static analysis 2020-05-19 17:59:18 +02:00
Camilla Löwy a17a1b2011 X11: Fix XKB events being passed on to core path 2020-05-19 17:55:28 +02:00
Camilla Löwy e07925c404 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.
2020-05-19 17:49:02 +02:00
Camilla Löwy cf3a03a85d X11: Remove duplicate XKB group initialization
The XKB group is already set to zero during initialization.
2020-05-19 17:47:58 +02:00
Camilla Löwy 0c403c8ca6 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.
2020-05-19 17:44:59 +02:00
Camilla Löwy 949275bbed 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.
2020-04-30 22:44:54 +02:00
Camilla Löwy cab41529da 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.
2020-04-23 22:13:18 +02:00
Camilla Löwy 318e08d914 X11: Add additional XKB key names for Right Alt 2020-04-23 17:42:36 +02:00
Camilla Löwy 560304e0f4 X11: Use XKB key name MENU for Menu key 2020-03-31 17:31:01 +02:00
Camilla Löwy 9ecacf1d7f X11: Check XKB key aliases in addition to names 2020-03-31 17:31:01 +02:00
Camilla Löwy ee45b58647 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.
2020-03-31 17:31:01 +02:00
Ali Sherief a41a58a95e 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.
2020-03-31 17:03:29 +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