Commit Graph

4585 Commits

Author SHA1 Message Date
Camilla Löwy
c05acf6246 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.
2021-12-31 01:32:18 +01:00
Camilla Löwy
12c2ccd609 Wayland: Remove window monitor array pre-alloc
The array will be allocated by surfaceHandleEnter when needed.
2021-12-31 01:32:18 +01:00
Camilla Löwy
216ea3d735 Wayland: Remove superfluous initialize to NULL
The whole window struct has already been cleared to zero.
2021-12-31 01:32:18 +01:00
Camilla Löwy
c1ecd4673e Wayland: Move window title cloning to creation 2021-12-31 01:32:18 +01:00
Camilla Löwy
7bede13b1d Wayland: Gather framebuffer transparency logic 2021-12-31 01:32:18 +01:00
Camilla Löwy
a3d1633e1d Wayland: Move surface creation function
This needs to be after createXdgSurface, which it will soon be calling.
2021-12-31 01:32:18 +01:00
Camilla Löwy
3f5dfeaf29 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.
2021-12-31 01:32:18 +01:00
Camilla Löwy
850893a39f Wayland: Control key repeat via timerfd state
The key repeat logic is now controlled only via the key repeat timerfd.
2021-12-31 01:32:18 +01:00
Camilla Löwy
79e7e65c9d Wayland: Clean up event pump
Adapt style to the rest of the project.
2021-12-31 01:31:30 +01:00
Emmanuel Gil Peyrot
855d338a65 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.
2021-12-30 19:04:10 +01:00
Camilla Löwy
8edbc4971d Wayland: Document delayed window showing 2021-12-27 01:31:38 +01:00
Camilla Löwy
05b0e2fab2 Update docs for specific Vulkan surface extensions
Related to #2014
2021-12-26 18:10:18 +01:00
Camilla Löwy
7d060ba4f1 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.
2021-12-24 01:14:23 +01:00
Camilla Löwy
f8ef3ca719 Add hiding and showing to interactive window test 2021-12-24 00:56:44 +01:00
Jason Francis
094aa6d3c7 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
2021-12-24 00:55:31 +01:00
Camilla Löwy
e24fe4b189 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.
2021-12-22 14:51:05 +01:00
Camilla Löwy
c2f0a0ae59 Wayland: Fix duplicate focus event on activation 2021-12-22 14:51:04 +01:00
Emmanuel Gil Peyrot
6281f498c8 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
2021-12-14 18:35:30 +01:00
Emmanuel Gil Peyrot
68879081cb 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
2021-12-14 09:33:16 +01:00
Stone Tickle
963e728881 Wayland: Set O_NONBLOCK on repeat timerfd
Fixes #1710
Fixes #1711
2021-12-14 09:28:34 +01:00
Camilla Löwy
900848ad0c X11: Add extension header paths to CMake target
The way the X11 find module is written, these paths can differ from the
base X11 header path, even if they very rarely do.

Fixes #1999
2021-12-09 20:05:07 +01:00
Camilla Löwy
cd01187b9d Fix initial windowed mode size for test 2021-12-09 20:05:07 +01:00
InKryption
c19f36b28d Add missing errors section for glfwGetGamepadName
The reference documentation for glfwGetGamepadName lacked the possible
errors section.

Closes #2007
2021-12-08 19:20:45 +01:00
Camilla Löwy
53d86c64d7 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.
2021-12-01 21:13:00 +01:00
Camilla Löwy
fbfd7e65c8 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
2021-12-01 21:13:00 +01:00
Camilla Löwy
d1efa32983 Formatting 2021-12-01 21:13:00 +01:00
Camilla Löwy
79de08db06 Cleanup 2021-12-01 21:12:53 +01:00
Camilla Löwy
e40fa3bb94 Add credits and update changelog 2021-12-01 20:23:04 +01:00
Stephen Gutekanst
9cd4d2fa20 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
2021-12-01 19:05:39 +01:00
Stephen Gutekanst
37fc28bff6 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>
2021-11-25 23:44:12 +01:00
Camilla Löwy
706d1f1653 Gather Null specific platform selection logic
The more specific error description is now used whatever the desired
platform is, when a binary only supports the Null platform.
2021-11-25 23:24:39 +01:00
Camilla Löwy
b3a98f8555 Update comments for global mutable data 2021-11-25 23:24:39 +01:00
luz paz
eacc1cafba Fix source comment typo
Closes #1982
2021-11-25 23:24:39 +01:00
Camilla Löwy
a30cd6acef Add credit
Related to #1998
2021-11-25 23:24:39 +01:00
InKryption
bb193325cc 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
2021-11-25 23:24:26 +01:00
Camilla Löwy
b55a517ae0 Add credit
Related to #1994
2021-11-22 21:32:34 +01:00
Jan Ekström
544790666b 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
2021-11-22 21:30:53 +01:00
Camilla Löwy
fb0f2f92a3 Add missing changelog entries 2021-10-28 13:22:37 +02:00
Camilla Löwy
83d3fb08ec Fix some spelling errors in changelog 2021-10-28 00:01:24 +02:00
Camilla Löwy
999962bd2f Update changelog and add credit
Related to #1980
2021-10-27 23:14:19 +02:00
Josh Codd
f75c251dec Cocoa: Fix deprecation of kIOMasterPortDefault
This adds a workaround for kIOMasterPortDefault having been deprecated
in favor of kIOMainPortDefault in macOS 12.0.

Closes #1980
2021-10-27 23:09:40 +02:00
Camilla Löwy
575d2971d4 Fix glfwinfo not handling --platform=any 2021-10-27 18:22:06 +02:00
Camilla Löwy
2a78a2cf82 Refactor platform selection for clarity? 2021-10-27 18:22:06 +02:00
Camilla Löwy
76a5f781db Add glfwInitVulkanLoader
This removes the GLFW_VULKAN_STATIC CMake option and the
_GLFW_VULKAN_STATIC configuration macro and replaces them with the
glfwInitVulkanLoader function, allowing a single library binary to
provide both behaviors.

This is based on the design from PR #1374 by @pmuetschard.

Closes #1374
Closes #1890
2021-10-27 18:22:05 +02:00
Camilla Löwy
393eac458b Improve Vulkan guide header section 2021-10-27 18:22:05 +02:00
Camilla Löwy
db91507956 Remove saving a function pointer only used once
This removes the global struct member for
vkEnumerateInstanceExtensionProperties, which is only used in the same
function that fetches the function from the loader.

The pattern is now more in line with how other single uses of Vulkan
functions are structures, such as window surface creation.
2021-10-27 18:22:05 +02:00
Camilla Löwy
ee6ff939a5 Fix invalid pointer conversions
C does not allow conversions between data pointers and function
pointers.

Yes, the name of the macro is reserved.  That's something for a future
commit to fix.

Fixes #1703
2021-10-27 18:22:05 +02:00
Camilla Löwy
68534cc2ce Null: Remove unused function 2021-10-27 18:22:05 +02:00
Camilla Löwy
4005f70eef WGL: Limit DWM swap interval hack to Vista and 7
This hack breaks when switching a window to fullscreen, if the OpenGL
ICD detects this and switches its swapchain to exclusive mode.

This limits the hack to Windows Vista and 7.  This hack was added
because of vsync jitter under DWM on Windows 7 and I have been unable
to reproduce it on any later version.

Is this change causing any problems on any version of Windows?  Please
open an issue!

Fixes #1072
2021-10-27 18:22:05 +02:00
Camilla Löwy
53d7622a3a Move list of contributors to separate file
Fixes #1839
2021-10-27 18:19:38 +02:00