Commit Graph

4393 Commits

Author SHA1 Message Date
Camilla Löwy
e155c19f8e Wayland: Fix text input not following key repeat
The manual key repeat implementation did not call text input.

(cherry picked from commit 1a7da42e6e)
2022-02-15 21:22:26 +01:00
Camilla Löwy
6b15731e6c Wayland: Clean up key event handler
Adapt style and naming to match the rest of the project.

(cherry picked from commit bf99587005)
2022-02-15 21:21:43 +01:00
Camilla Löwy
554f5d0492 Wayland: Require xkbcommon 0.5.0 or greater
The Wayland backend now requires xkbcommon-compose, which was added in
version 0.5.0.  xkbcommon 0.5.0 was released in 2014.

This removes the non-composing fallback path for text input.

(cherry picked from commit 293d19a153)
2022-02-15 21:20:28 +01:00
Camilla Löwy
3901824c0e Wayland: Clean up text input
Adapt style and naming to match the rest of the project.

(cherry picked from commit b70259e52d)
2022-02-15 21:08:41 +01:00
Camilla Löwy
5066f57371 Clean up internal Unicode code point handling
Call code points by their name and store them as uint32_t.

(cherry picked from commit fe7be39793)
2022-02-15 21:08:17 +01:00
Camilla Löwy
1f7ce12cbc Wayland: Implement key name support
(cherry picked from commit 17a9e34fbc)
2022-02-15 21:02:07 +01:00
Camilla Löwy
0eaf9d557f Move UTF-8 encoding to shared code
This will be used by the Wayland code too.

(cherry picked from commit cb22c54119)
2022-02-15 20:58:44 +01:00
Camilla Löwy
61497796e6 Wayland: Fix keys reported as wrong or unknown key
(cherry picked from commit 37b7540db9)
2022-02-15 20:58:07 +01:00
Camilla Löwy
86a1d3b628 Wayland: Fix GLFW_VISIBLE affecting full screen
Full screen window creation was not ignoring the GLFW_VISIBLE hint.

(cherry picked from commit 715b874db3)
2022-02-15 20:57:26 +01:00
Camilla Löwy
9ab14a8cc0 Fix gamma test not checking for NULL return value
(cherry picked from commit 8aaea57421)
2022-02-15 20:56:32 +01:00
Camilla Löwy
f5dab59071 Wayland: Fix missing damage event on window show
By definition a hidden window on Wayland does not have valid framebuffer
contents.

This adds a window damage (refresh) event when a window is shown, to
request an initial frame for the now visible window.

(cherry picked from commit 25c521cbe5)
2022-02-15 20:56:21 +01:00
Camilla Löwy
658c931561 Wayland: Fix window not visible after initial swap
A window created with GLFW_VISIBLE set was not made visible by the
initial buffer swap during context attribute refresh.

Regression introduced by @elmindreda in
094aa6d3c7.

(cherry picked from commit c05acf6246)
2022-02-15 20:55:35 +01:00
Camilla Löwy
0c46a730de Wayland: Remove window monitor array pre-alloc
The array will be allocated by surfaceHandleEnter when needed.

(cherry picked from commit 12c2ccd609)
2022-02-15 20:55:16 +01:00
Camilla Löwy
1fa4312b29 Wayland: Remove superfluous initialize to NULL
The whole window struct has already been cleared to zero.

(cherry picked from commit 216ea3d735)
2022-02-15 20:53:55 +01:00
Camilla Löwy
eb6fc17746 Wayland: Move window title cloning to creation
(cherry picked from commit c1ecd4673e)
2022-02-15 20:53:13 +01:00
Camilla Löwy
ed785a2c79 Wayland: Gather framebuffer transparency logic
(cherry picked from commit 7bede13b1d)
2022-02-15 20:53:08 +01:00
Camilla Löwy
fba79aaaec Wayland: Move surface creation function
This needs to be after createXdgSurface, which it will soon be calling.

(cherry picked from commit a3d1633e1d)
2022-02-15 20:52:54 +01:00
Camilla Löwy
ec934edfbf Wayland: Fix repeated key not released on defocus
Platform code should not generate key events with GLFW_REPEAT.
GLFW_PRESS is translated into GLFW_REPEAT by shared code based on the
key state cache.

This confused the automatic key release logic into not generating an
event with GLFW_RELEASE for a key being repeated when the window lost
input focus.

(cherry picked from commit 3f5dfeaf29)
2022-02-15 20:51:55 +01:00
Camilla Löwy
5f0b316c24 Wayland: Control key repeat via timerfd state
The key repeat logic is now controlled only via the key repeat timerfd.

(cherry picked from commit 850893a39f)
2022-02-15 20:50:58 +01:00
Camilla Löwy
5e8186af0a Wayland: Clean up event pump
Adapt style to the rest of the project.

(cherry picked from commit 79e7e65c9d)
2022-02-15 20:50:38 +01:00
Emmanuel Gil Peyrot
17c5c53910 Wayland: Use correct action on fallback decoration
We were previously storing the pointer position only when on the main
window, so when the user clicked on a fallback decoration it would use
the last position of the cursor on the main window, instead of the
position in the decoration surface.

Fixes part of #1991.

(cherry picked from commit 855d338a65)
2022-02-15 20:46:36 +01:00
Camilla Löwy
6afc571ade Wayland: Document delayed window showing
(cherry picked from commit 8edbc4971d)
2022-02-15 20:40:37 +01:00
Camilla Löwy
22eaa04b49 Update docs for specific Vulkan surface extensions
Related to #2014

(cherry picked from commit 05b0e2fab2)
2022-02-15 20:39:40 +01:00
Camilla Löwy
65fc4fa625 X11: Fix sonames for loaded libraries on OpenBSD
The OpenBSD ports tree assigns its own soname version numbers, so the
hardcoded sonames GLFW uses to load libraries on non-macOS Unices are
often incorrect.  Instead OpenBSD recommends that run-time loading
should leave out the version numbers entirely.  The OpenBSD ld.so then
finds the correct library.

This upstreams the ports tree fixes for Xcursor and EGL, and adds the
corresponding fix for all other run-time loaded library sonames.

Tested on OpenBSD 7.0.

This issue was initially reported on IRC.

(cherry picked from commit 7d060ba4f1)
2022-02-15 20:36:11 +01:00
Jason Francis
8ecb49d143 Wayland: Fix window hiding
Corrects the protocol violation when creating an xdg_surface from a
wl_surface that already has a buffer due to EGL buffer swaps.

This commit is based on PR #1731 by @ghost, but adapted and altered:
 - The XDG surface and role are now only created when a window is shown
   to prevent application lists from showing command-line applications
   with off-screen-only windows
 - The special case of Wayland+EGL buffer swap is now in the EGL code
   to mirror how X11 is handled
 - Adaption to run-time platform selection and separate credits file

Fixes #1492
Closes #1731

(cherry picked from commit 094aa6d3c7)
2021-12-24 01:59:16 +01:00
Camilla Löwy
9240ee5ddf Wayland: Fix key repeat continuing when refocused
If a window lost input focus while a key was held down, the key repeat
mechanism would resume once the window regained focus.

(cherry picked from commit e24fe4b189)
2021-12-24 01:53:53 +01:00
Camilla Löwy
3b806aef27 Wayland: Fix duplicate focus event on activation
(cherry picked from commit c2f0a0ae59)
2021-12-24 01:52:43 +01:00
Emmanuel Gil Peyrot
5470fd6de9 EGL: Use EGL_EXT_present_opaque when available
This extensions allows GLFW to instruct the driver to ignore the alpha
bits, even in formats which contain them.  This makes it possible to use
the alpha bits as extra storage, without it affecting the end result
getting displayed to the user.

Fixes #1434
Fixes #1803

(cherry picked from commit 6281f498c8)
2021-12-24 01:51:24 +01:00
Emmanuel Gil Peyrot
52133a3690 Wayland: Continue poll() if timerfd can’t be read
In the case the key repeat timerfd was interrupted before read(), the
cursor timerfd wasn’t read at all even when it could.

Related to #1711

(cherry picked from commit 68879081cb)
2021-12-24 01:45:22 +01:00
Stone Tickle
8f3677a0d4 Wayland: Set O_NONBLOCK on repeat timerfd
Fixes #1710
Fixes #1711

(cherry picked from commit 963e728881)
2021-12-24 01:43:44 +01:00
Camilla Löwy
f21a9104e4 Fix initial windowed mode size for test
(cherry picked from commit cd01187b9d)
2021-12-24 01:43:30 +01:00
Camilla Löwy
869e68a015 Start 3.3.7 2021-12-10 01:26:54 +01:00
InKryption
7d5a16ce71 Add missing errors section for glfwGetGamepadName
The reference documentation for glfwGetGamepadName lacked the possible
errors section.

Closes #2007

(cherry picked from commit c19f36b28d)
2021-12-08 20:23:20 +01:00
Camilla Löwy
a69648e192 Win32: Handle content scale error on creation
Only apply the content scale to the initial size of the window if
content scale retrieval succeeded.

Related to #1615.

(cherry picked from commit 53d86c64d7)
2021-12-08 20:06:18 +01:00
Camilla Löwy
e10def6de7 Win32: Fix bad content scale on monitor disconnect
The monitor handle could have become invalid just before the call to
GetDpiForMonitor.  It was possible for both window and monitor content
scale queries.

This ensures both that an appropriate error is emitted and that the
retrieved values are zero on error.

Fixes #1615

(cherry picked from commit fbfd7e65c8)
2021-12-08 20:05:32 +01:00
Camilla Löwy
84c881c1a8 Cleanup
(cherry picked from commit 79de08db06)
2021-12-08 20:02:58 +01:00
Camilla Löwy
18d7c241f8 Add credits and update changelog
(cherry picked from commit e40fa3bb94)
2021-12-08 20:02:50 +01:00
Stephen Gutekanst
6281424988 X11: Fix undefined behavior in glfwSetWindowIcon
The conversion of window icon image data involves unsigned char color
values being promoted to int and then shifted to the left by 24.  For
32-bit ints this is just far enough to trigger undefined behavior.

It worked by accident because of how current compilers translate this
piece of code.

This was caught by @slimsag while working on [Zig bindings for GLFW][1],
and diagnosed together with @Andoryuuta, as described [in an
article][2].  Zig has UBSan enabled by default, which caught this
undefined behavior.

[1]: https://github.com/hexops/mach-glfw
[2]: https://devlog.hexops.com/2021/perfecting-glfw-for-zig-and-finding-undefined-behavior#finding-lurking-undefined-behavior-in-6-year-old-glfw-code

Thanks to Maato, martinhath, dcousens, drfuchs and Validark for helping
to refine the solution.

This commit message was rewritten by @elmindreda to hopefully reflect
the conclusions of the pull request thread.

Related to hexops/mach#20
Closes #1986

(cherry picked from commit 9cd4d2fa20)
2021-12-08 19:58:12 +01:00
Stephen Gutekanst
81d762bf66 Fix docs calling GLFW_CONTEXT_REVISION a hint
This docstring previously indicated that GLFW_CONTEXT_REVISION was
a window hint and attribute, but in fact it is only a window attribute
(there is no code which uses this constant in any other context.)

We noticed this in https://github.com/hexops/mach/pull/71/files#r749741814

Closes #1992

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
(cherry picked from commit 37fc28bff6)
2021-11-30 19:04:56 +01:00
Camilla Löwy
486724c433 Update comments for global mutable data
(cherry picked from commit b3a98f8555)
2021-11-30 19:04:38 +01:00
luz paz
55528e9178 Fix source comment typo
Closes #1982

(cherry picked from commit eacc1cafba)
2021-11-30 19:04:14 +01:00
Camilla Löwy
689840f2eb Add credit
Related to #1998

(cherry picked from commit a30cd6acef)
2021-11-30 19:04:04 +01:00
InKryption
c59092619a Add missing error to glfwGetClipboardString docs
Add GLFW_FORMAT_UNAVAILABLE to the list of possible errors in the
reference documentation for glfwGetClipboardString.

Slightly edited by @elmindreda.

Closes #1998

(cherry picked from commit bb193325cc)
2021-11-30 19:03:59 +01:00
Camilla Löwy
bfd9eaf092 Fix mappings for gamepads present at init
Joysticks already connected when GLFW was initalized did not get gamepad
mappings applied to them.

Regression introduced by 74a8ba26c3.

This change was backported without taking into account that 3.3.x does
not have on-demand joystick init.

Fixes #1996
2021-11-24 23:09:24 +01:00
Camilla Löwy
6902435005 Update changelog 2021-11-24 23:08:49 +01:00
Camilla Löwy
6eb24a49df Add credit
Related to #1994

(cherry picked from commit b55a517ae0)
2021-11-24 23:02:05 +01:00
Jan Ekström
bec6e7565b Cocoa: Use MACH_PORT_NULL for default IOKit port
Looking into the definition of kIOMainPortDefault, the following
description can be found:

When specifying a main port to IOKit functions, the NULL argument
indicates "use the default". This is a synonym for NULL, if you'd
rather use a named constant.

Thus, we do not have to utilize an external symbol for the identifier
of the default main IOKit port, but MACH_PORT_NULL suffice. This
simplifies compatibility between macOS versions as the symbol was
renamed with macOS 12.0.

Fixes #1985
Closes #1994

(cherry picked from commit 544790666b)
2021-11-24 23:01:46 +01:00
Camilla Löwy
19543afbfb Start 3.3.6 2021-10-28 22:16:41 +02:00
Camilla Löwy
d3b73abba0 Add missing changelog entries
(cherry picked from commit fb0f2f92a3)
2021-10-28 13:24:20 +02:00
Camilla Löwy
fbdb08c43e Fix some spelling errors in changelog
(cherry picked from commit 83d3fb08ec)
2021-10-28 13:18:38 +02:00