Commit Graph

4329 Commits

Author SHA1 Message Date
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
Camilla Löwy
71316f843c Update changelog and add credit
Related to #1980

(cherry picked from commit 999962bd2f)
2021-10-28 12:40:42 +02:00
Josh Codd
472d45c07b Cocoa: Fix deprecation of kIOMasterPortDefault
This adds a workaround for kIOMasterPortDefault having been deprecated
in favor of kIOMainPortDefault in macOS 12.0.

Closes #1980

(cherry picked from commit f75c251dec)
2021-10-28 12:39:39 +02:00
Camilla Löwy
85f37ada6d Move list of contributors to separate file
Fixes #1839

(cherry picked from commit 53d7622a3a)
2021-10-28 12:33:40 +02:00
Camilla Löwy
b77a9b1d0d Fix GLFW_INCLUDE_GLEXT being ignored for glcorearb
The GLFW_INCLUDE_GLCOREARB branch was left out when GLFW_INCLUDE_GLEXT
was originally added, for reasons that are lost to history.  The current
versions of these headers seem to co-exist just fine.

Issue reported on IRC.

(cherry picked from commit 309d79376f)
2021-10-28 12:31:02 +02:00
Ioannis Tsakpinis
db85858062 Fix context API checks in native access functions
(cherry picked from commit 727db55c3a)
2021-10-28 12:29:57 +02:00
Camilla Löwy
ca676357c0 Win32: Remove timeGetTime fallback for timer
The performance counter API is guaranteed to succeed on Windows XP and
later so there is no need for a fallback.

This removes our last dependency on winmm.

(cherry picked from commit b6834bf2a1)
2021-10-28 12:24:38 +02:00
Camilla Löwy
4ea7485fbe Remove blank line before the end of some structs
(cherry picked from commit efe764b492)
2021-10-28 12:14:58 +02:00
Camilla Löwy
73b6754a67 Document possible native access function errors
(cherry picked from commit 983c44b255)
2021-10-28 12:13:36 +02:00
Camilla Löwy
2d3ce6eaae Make native access functions verify context API
The native access functions for context handles did not verify that the
context had been created with the same API the function was for.

This makes these functions emit GLFW_NO_WINDOW_CONTEXT on API mismatch.

(cherry picked from commit cca9008db2)
2021-10-28 12:13:19 +02:00
Camilla Löwy
cec0b33ee1 Remove Doxyfile tags obsoleted by Doxygen 1.9.2
Fixes #1932
2021-10-17 20:34:05 +02:00
Camilla Löwy
9400bc9f35 Remove potentially incorrect claim
(cherry picked from commit 4be0444ee6)
2021-10-13 23:11:53 +02:00
Camilla Löwy
1a7e4da343 Fix docs for Windows monitor size calculation
This sentence was truncated by 951a9583fa
and then not updated when content scale support was added with
16bf872117.

(cherry picked from commit 6a20053102)
2021-10-13 23:11:48 +02:00
Camilla Löwy
95df61e5ed Cocoa: Fix unresponsive cursor after cursor warp
This is a companion to 157ebb80aa and
fixes the same issue for calls to glfwSetCursorPos.

Related to #1962

(cherry picked from commit 6ed5294223)
2021-10-13 23:11:00 +02:00
Ioannis Tsakpinis
c32fefc6a0 Cocoa: Fix unresponsive cursor after ungrab
There is a suppression interval (0.25 seconds by default) after a call
to CGWarpMouseCursorPosition, during which local hardware events
(keyboard and mouse) are ignored. GLFW already calls
CGEventSourceSetLocalEventsSuppressionInterval with a value of 0.0, but
it doesn't help in this case, there is still a short delay before the
cursor can be moved. Moving the CGAssociateMouseAndMouseCursorPosition
call after the cursor position has been restored, fixes the issue.

Closes #1962

(cherry picked from commit 157ebb80aa)
2021-10-13 23:10:15 +02:00