Commit Graph

433 Commits

Author SHA1 Message Date
Luflosi
08e5a17063 Use switch statement instead of if-else-chain for cursor shapes
Closes #1739.
2020-12-08 15:45:14 +01:00
Camilla Löwy
c01acc267a X11: Fix joystick detection before joystick init
Spotted by @Luflosi.
2020-07-23 21:14:36 +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
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
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
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
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
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
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
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
a0a5cc57df X11: Make libX11 dynamically loaded
This completes the dynamic loading of all X11 libraries in preparation
for run-time platform selection.
2020-02-10 17:44:56 +01:00
Camilla Löwy
0c27ed1d0e X11: Fix setting the clipboard string to itself 2020-02-10 17:44:56 +01:00
Camilla Löwy
5f1631cb0e Check scancode before use in glfwGetKeyName 2020-01-16 23:17:49 +01:00
Camilla Löwy
9372ba95fa X11: Fix parent window handle initialization
This should have been initialized to the screen root, not None.  This
issue was introduced by fe57e3c292.

Fixes #1620.
2020-01-14 21:26:21 +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
a3d28ef52c X11: Fix IC event mask not being added to our window 2019-12-26 16:31:42 +01:00
Camilla Löwy
8149a5fc00 X11: Cleanup
We can use C99 now and also we will need the event mask below.
2019-12-26 16:31:41 +01:00
Camilla Löwy
73a8ebb691 X11: Cleanup
This is technically valid but misleading and may inspire future bugs
like the one fixed by 0b652a44d2.
2019-12-17 02:17:31 +01:00
Camilla Löwy
4e70c95aa3 X11: Cleanup
The window state action is not an atom.
2019-12-17 01:53: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
9b6d68ec70 X11: Fix missing checks for EWMH attention atoms 2019-12-16 16:22:22 +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
7dbdd2e6a5 Add more standard cursors
This adds the standard cursors for diagonal and omnidirectional
resize/move and operation-not-allowed.  It also adds new (better?) names
for the horizontal and vertical resize/move and pointing hand cursors.

References:
 - https://developer.apple.com/documentation/appkit/nscursor
 - https://stackoverflow.com/questions/10733228/
 - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor
 - https://freedesktop.org/wiki/Specifications/cursor-spec/
 - https://tronche.com/gui/x/xlib/appendix/b/

Related to #427.
2019-11-28 22:24:00 +01:00
Camilla Löwy
5fc4c01302 X11: Fix decoration enabling after window creation
This fixes the enabling of window decorations after creation.  Instead
of removing the _MOTIF_WM_HINTS property, we now set or unset the
MWM_DECOR_ALL bit of the decorations field.

Fixes #1566.
2019-10-29 12:04:47 +01:00
Camilla Löwy
56ca0cb3b3 Unify key name string handling
This makes key names per-key static strings for all supported platforms.

Fixes #1200.
2019-08-27 19:29:56 +02:00
Camilla Löwy
d232bcfcdd Cleanup
Related to #1528.
2019-07-12 15:00:51 +02:00
Denis Bernard
36f90800d8 X11: Query and keep track of Xkb group index
For users with multiple keyboard layouts configured, glfwGetKeyName
works fine only with the primary layout.  Switching layouts results in
changing the group index.  This commit querries the current group index
when initializing keyboard input and keeps track of any change to it.

As a result the scancode -> keyname mapping may change while the program
is running (needs to be documented).

Fixes #1462.
Closes #1528.
2019-07-12 14:08:43 +02:00
Camilla Löwy
c6b95e3b07 X11: Fix focus events not being filtered
The filter condition had ended up below the action.
2019-07-11 00:36:34 +02:00
Camilla Löwy
1f508530f0 X11: Let the language initialize XEvent structs 2019-06-27 18:14:48 +02:00
Camilla Löwy
0c6b505619 Convert some declarations to C99 style 2019-06-27 18:13:29 +02:00
Camilla Löwy
56aad76b16 Add C dialect reminders to each source file
Files built for Win32 must use C89 style declarations for compatibility
with VS 2010 and 2012, which are still supported by GLFW.
2019-05-24 14:43:49 +02:00
Camilla Löwy
a337c56848 Start 3.4 2019-04-16 23:08:39 +02:00
Camilla Löwy
ab118b2529 Fix copyright years (somewhat) 2019-04-15 20:50:00 +02:00
Camilla Löwy
1155c83013 Rename raw input to raw mouse motion, cleanup
This renames 'raw input' to 'raw mouse motion' as there are other kinds
of raw input.  The update path is restructured to avoid reinitializing
all of disabled cursor mode.  Modification of shared state is moved out
into shared code.  Raw mouse motion is disabled by default for
compatibility.

Related to #1401.
2019-02-22 13:04:11 +01:00
Nathan Poirier
9e29f556fd Add GLFW_RAW_INPUT and glfwRawInputSupported
This adds runtime per-window control of whether accelerated or raw mouse
motion is provided when the cursor is disabled.

Fixes #1400.
Closes #1401.
2019-02-22 13:04:11 +01:00
Camilla Löwy
2a27eb95e4 X11: Fix system cursor used for GLFW_HAND_CURSOR
Fixes #1432.
2019-02-14 00:04:39 +01:00
Camilla Löwy
78e6a0063d X11: Fix EWMH state update for hidden windows
The EWMH window state code assumed the window was mapped.

Fixes #1358.
2019-01-31 00:02:16 +01:00
Camilla Löwy
d5ab3e919a Cleanup
Replace client area with content area.
2019-01-25 12:46:46 +01:00
iamCaveLamp
a46104ee69 Removed duplicates of centerCursor function 2019-01-22 20:17:35 +01:00
Camilla Löwy
72c3908e14 X11: Fix glfwSetWindowMonitor not flushing buffer 2019-01-02 21:55:30 +01:00
Camilla Löwy
cde0aaaab1 X11: Fix glfwSetWindowMonitor not updating hints
This makes glfwSetWindowMonitor update the WM_NORMAL_HINTS when resizing
non-user-resizable windowed mode windows.
2019-01-02 21:55:30 +01:00