Commit Graph

4824 Commits

Author SHA1 Message Date
Jan Schürkamp
9317970243 Wayland: Implement glfwRequestWindowAttention
This implements window attention requests via the xdg-activation-v1
protocol.

This was updated by @ elmindreda to work with recent Wayland related
 changes to the main branch:
 - Switched to current way of handling Wayland protocol files
 - Added the xdg-activation-v1.xml protocol file to deps/wayland
 - Added missing macros to rename protocol interface globals

The protocol file was copied from wayland-protocols 1.33.

Closes #2287
2024-01-30 20:20:42 +01:00
Camilla Löwy
2590d4cdd4 Wayland: Enable platform by default
This changes the default platform for Unix-like systems (other than
macOS) from only X11 to Wayland and X11.  It also removes the backward
compatibility with the older GLFW_USE_WAYLAND CMake option.

If a bisect took you here because your build broke, hello, sorry, set
the GLFW_BUILD_WAYLAND or GLFW_BUILD_X11 CMake option to disable the
associated platform.

This can be done when configuring GLFW with CMake, from a higher-level
CMakeLists.txt if GLFW is part of your project, or at any point after
configuration by updating the CMake cache with the command-line tool or
the GUI.

The next step is to make Wayland the run-time default when enabled, but
that will hopefully not break any builds.

Related to #2439
2024-01-30 20:20:42 +01:00
Camilla Löwy
51920ede68 Wayland: Fix compilation on FreeBSD
The list of compile-time dependencies on FreeBSD lacked evdev-proto.

Unlike on Linux, the input-event-codes.h header file was not implicitly
included on FreeBSD.

Fixes #2445
2024-01-30 20:20:42 +01:00
Camilla Löwy
291f4d89cd OSMesa: Fix headers included before shared header
The shared header, internal.h, must be the first header included in
every compilation unit of GLFW.
2024-01-30 20:20:41 +01:00
Camilla Löwy
bc95384f4c Remove platform-specific logic from shared header
The public header already defines APIENTRY, which is functionally
identical to EGLAPIENTRY.
2024-01-30 20:20:41 +01:00
Bruce Mitchener
becf1dc14b Update to actions/checkout@v4 from v3
This mainly updates the version of NodeJS used internally to keep
up with what's going on at GitHub Actions.

Closes #2447
2024-01-30 20:20:41 +01:00
Camilla Löwy
86bf5698ec Fix glfwGetKeyName incorrectly emitting error
glfwGetKeyName emitted GLFW_INVALID_VALUE when passed GLFW_KEY_UNKNOWN
and any scancode not associated with a key token on that platform.

This causes physical keys with no associated key token to emit
GLFW_INVALID_VALUE when the key and scancode are passed directly from
the key event to glfwGetKeyName.  This breaks the promise made in the
reference documentation for glfwGetKeyName.

This commit removes that error for the whole range of valid scancodes.

Fixes #1785
2024-01-30 20:14:57 +01:00
Camilla Löwy
7e2470d343 Use designated initializers for platform structs
This should make platform struct initializers slightly more resistant to
merge mistakes.
2024-01-29 21:09:10 +01:00
Camilla Löwy
bbf661ca38 Replace comments with designated initializers
We can finally have the compiler verify that the values go to the
correct struct member.

With this commit GLFW no longer compiles with Visual Studio 2012 or
earlier.  If you must compile GLFW on Windows XP, check out MinGW-w64.

Fixes #2465
2024-01-29 21:09:10 +01:00
Camilla Löwy
d81fcb93f1 Clarify event test reporting of keys
Reshuffled line to group key-related items together.  Omitted key code
output for unknown keys to put focus on the (lack of) name.
2024-01-29 21:09:10 +01:00
Camilla Löwy
c339dfc63d Update changelog for 3.4 release
This adds some missing entries and splits them all into what has already
been released and what hasn't.
2024-01-29 21:09:10 +01:00
Camilla Löwy
9afbcb442b Wayland: Clean up pointer axis handler 2024-01-29 21:05:35 +01:00
Doug Binks
d79afa8055 Win32: Minor changes to disabled cursor fix over RDP
- Use _glfw_calloc and _glfw_free
- Exit from _glfwInitWin32 with error if we fail to create a blank cursor on a remote session
2024-01-28 17:45:03 +00:00
Doug Binks
996826eec6 Reorder and add details to changelog entry 2024-01-28 17:30:15 +00:00
Doug Binks
1de78b2ff9 Cleanup 2024-01-28 17:24:14 +00:00
Doug Binks
7321b56cad
Reorder credit 2024-01-28 17:18:11 +00:00
Hilderin
c8521b7fda
Win 32: Fix disabled cursor mode when connected over RDP
Fixes #1276
Based on PR #1279 by @Pokechu22

Co-authored-by: Pokechu22 <8334194+Pokechu22@users.noreply.github.com>
2024-01-28 17:08:27 +00:00
Camilla Löwy
8e6c8d7eff Remove reminders to use C89 for some source files
This is part of removing support for VS versions older than VS 2013.
See #2465 for details and feedback.

Related to #2465
2024-01-15 20:17:18 +01:00
Camilla Löwy
ba796ec9c6 Document VS 2013 as minimum VS version
This is part of removing support for VS versions older than VS 2013.
See #2465 for details and feedback.

Related to #2465
2024-01-15 20:17:18 +01:00
Camilla Löwy
d107e497a9 Remove superfluous CMake flag in AppVeyor build
The source directory already defaults to the current directory.
2024-01-15 20:17:18 +01:00
Camilla Löwy
d2058526cc Make VS 2013 the oldest tested VS version
This is part of removing support for VS versions older than VS 2013.
See #2465 for details and feedback.

Related to #2465
2024-01-15 20:17:15 +01:00
Camilla Löwy
cf29ff2b9d Update CODEOWNERS file 2024-01-15 00:31:45 +01:00
Camilla Löwy
8ff8d67560 Set timeout for build GH workflow jobs
This is in order to catch and stop any malfunctioning job.
2024-01-15 00:31:38 +01:00
Camilla Löwy
d2b88cf7ab Update documentation for native access errors
The GLFW_PLATFORM_UNAVAILABLE error was not listed for those native
access function that can emit it.

The order of errors for many functions in glfw3native.h did not match
the order used in glfw3.h.

The documentation for GLFW_PLATFORM_UNAVAILABLE was a little bit terse.
2024-01-13 22:13:56 +01:00
Camilla Löwy
200639712b Add initial .editorconfig file 2024-01-13 22:13:56 +01:00
Camilla Löwy
507621977f Win32: Remove unofficial support for VS 2008
Related to #2465
2024-01-13 22:13:56 +01:00
Camilla Löwy
29885c6942 Win32: Improve clipboard contention issue
This is primarily a workaround for a GLFW application reading and/or
writing to the clipboard in rapid succession and catching up with the
Windows Clipboard History, which also has to contend for the lock.
2024-01-13 22:13:56 +01:00
Camilla Löwy
2c3eb75748 Wayland: Remove dependency on wayland-protocols
This brings the latest released versions of all used Wayland protocol
files into this repository, removing the need for the user to arrange
a sufficiently new version of wayland-protocols.

The wayland.xml protocol file was copied from wayland 1.22.0.
The additional protocol files were copied from wayland-protocols 1.32.

Because of how files are moved and renamed inside the wayland-protocols
repository, it will not always be possible to update all our protocol
files from a single release without also potentially updating related
code (acceptable) and prematurely breaking compatibility with
compositors that still only support an earlier incompatible version
(unacceptable).

The macro in src/CMakeLists.txt has been modified to hopefully make it
easier to add new protocol files.  This made it necessary to change the
name of a few of the generated header files.

Closes #2053
2024-01-13 22:13:56 +01:00
Camilla Löwy
73948e6c0f Fix missing error in docs for glfwCreateWindow
The GLFW_NO_WINDOW_CONTEXT error can be emitted if the window passed in
for context sharing does not have a context.

Fixes #2456
2024-01-13 22:13:56 +01:00
Camilla Löwy
5a9ea8f99f Add build- prefix to .gitignore 2024-01-13 22:13:56 +01:00
Camilla Löwy
4e8c4901e9 Wayland: Fix segfault on termination
A segfault could occur during termination if libdecor was found but no
windows were created between initialization and termination.  The wait
for libdecor to finish its initialization was only performed before
window creation, not at termination.

Regression introduced by 9fdc425931.
2024-01-13 22:13:56 +01:00
Camilla Löwy
d9646631d6 Removed unused header in sharing example 2024-01-13 22:13:56 +01:00
Camilla Löwy
6b39ab0074 Improve coverage of GH build workflow
This adds Null-only and Wayland-only builds, while rearranging jobs by
host OS instead of by target platform.

Every useful combination of platforms is now being built, except for
Null-only with Win32 time and threading.  This combination does not
compile on VS due to some non-standard array initializers.
2024-01-13 22:13:31 +01:00
Camilla Löwy
40aa77a160 Remove superfluous CMake flag in GH build workflow
The source directory already defaults to the current directory.
2024-01-13 21:04:50 +01:00
Camilla Löwy
9f6da7e7c6 Win32: Fix some of the errors for Null-only on VS
This workaround is needed whenever windows.h is included after glfw3.h.
2024-01-13 21:04:41 +01:00
Camilla Löwy
ab09dc8fb1 Add credit
I lost track of the existing PR #2245 when fixing #2161 with
5e4496cb42.

Closes #2245
2023-12-26 14:47:51 +01:00
Doug Binks
b4c3ef9d0f
Clarify documentation for contributing
Added location of credits, news and guides.
2023-12-24 12:23:23 +00:00
Camilla Löwy
2c1d31009f Cocoa: Fix segfault querying joystick elements
It is reportedly possible for IOHIDDeviceCopyMatchingElements to return
NULL on macOS 13 if the application lacks input monitoring permissions.

This commit only prevents the segfault.  More work will be needed to
correctly handle this situation, including Game Controller support.

Related to #2320
Closes #2321
2023-12-12 18:36:14 +01:00
Camilla Löwy
ea3ea62708 Update changelog and add credit
Related to #2348
2023-12-12 13:47:37 +01:00
lo-v-ol
eeeb56eb23 EGL: Fix GLFW_CONTEXT_NO_ERROR on Mesa
Mesa EGL requires the context version to be set to 2.0 or greater before
EGL_CONTEXT_OPENGL_NO_ERROR_KHR in the attribute list.

Without this, context creation via Mesa EGL with
EGL_CONTEXT_OPENGL_NO_ERROR_KHR set fails with EGL_BAD_ATTRIBUTE.

Fixes #2348
2023-12-12 13:47:37 +01:00
Camilla Löwy
378e5fc814 Fix Markdown formatting for changelog entry 2023-12-12 13:46:48 +01:00
Camilla Löwy
7b152019da Add credit
Related to #2377
Related to #2405
2023-12-11 21:28:48 +01:00
FuzzyQuills
8e9a5d29a8
Cocoa: No NSWindowStyleMaskResizable in fullscreen
On macOS 10.15 Catalina and earlier, not having the resizable bit
cleared in NSWindowStyleMask in fullscreen leads to windows minimising
when clicked anywhere in the content area.

On all tested macOS versions it also causes the fullscreen window to be
resizable by the user.

Regression introduced by 0d599026d0.

Fixes #2377
Closes #2405
2023-12-11 21:25:44 +01:00
Camilla Löwy
46cebb5081 EGL: Only use EGL_EXT_present_opaque on Wayland
The EGL_EXT_present_opaque extension is primarily a workaround meant for
Wayland, even if the language in it doesn't mention this.  GLFW
previously always enabled this extension where supported.  This caused
issues on X11 when running the Nvidia binary blob.

This commit ensures the extension is only enabled on Wayland.

Fixes #2365
2023-12-07 16:51:13 +01:00
Camilla Löwy
68edc66aa4 Add credit
Fixes #2397
2023-12-07 16:01:47 +01:00
Camilla Löwy
ddd92a4fa8 Update changelog and add credit
Related to #2327
2023-12-06 18:34:22 +01:00
Camilla Löwy
5e4496cb42 Cocoa: Fix compilation error on OS X 10.8
The occlusion state parts of NSWindow are OS X 10.9+ only but we still
(technically) support building for only 10.8.

Fixes #2161
2023-12-06 18:34:22 +01:00
Camilla Löwy
0ede5f58c6 Simplify joystick hat value assertions 2023-12-06 18:34:22 +01:00
Peter Johnson
52405a9d59 Win32: Fix invalid hat bit mask being accepted
It is reportedly possible to get opposing directions of an XInput DPad
bit mask set simultaneously with some controllers.

This commit ensures that those values are not passed on to other parts
of GLFW.

This commit is based on the PR #2291 by @ PeterJohnson but with the
following changes:
 - moved XInput-specific special case to XInput implementation
 - attempt to preserve data by only masking out the invalid axis
 - admin (credit, changelog, commit message)

Closes #2291
2023-12-06 18:34:12 +01:00
Camilla Löwy
9959dc69ca Improve documentation relating to key tokens
Shifted the documentation away from the term 'named keys' as something
different than keys that glfwGetKeyName will return a name for.  The
already existing term 'key token' should now be used to refer to the
GLFW_KEY_* constants.

The associated term 'named mouse button' was also replaced with
'supported mouse button'.

The parts explaining which key tokens will return a valid scancode from
glfwGetKeyScancode have hopefully been clarified.  This issue was
reported in #2055.

The GLFW_KEY_UNKNOWN constant has been moved out of the list of key
tokens to simplify and hopefully clarify the related documentation.

Various other keyboard key related edits were made, hopefully resulting
in improvements.

Related to #2055
2023-12-05 19:10:06 +01:00