Commit Graph

4741 Commits

Author SHA1 Message Date
Victor Chernyakin
edd38207a6 Linux: Set O_CLOEXEC on evdev fd
Closes #2446
2024-02-12 13:06:59 +01:00
Camilla Löwy
9953f7ead1 Wayland: Cache framebuffer size
The calculation of framebuffer size is about to get more complicated
with the introduction of fractional-scale-v1, so only do it in one
place.

This is also a tiny preparation for eventually behaving better towards
wl_egl_window_resize.
2024-02-12 13:06:59 +01:00
Camilla Löwy
1be7bc546b Wayland: Clean up data types related to scales 2024-02-12 13:06:59 +01:00
Camilla Löwy
4c283e4a3c Wayland: Be more specific about scales
We are about to introduce another scaling method (fractional-scale-v1),
so it will become more important to be specific about what scales are
used where and what their units are.

This removes 'content scale' from window and monitor structs.  A monitor
(output) now has just a 'scale', which becomes a 'buffer scale' when
applied to a window.  A window now has a list of 'output scales' to
select its buffer scale from.  Content scales are calculated from the
respective monitor or window when queried, even if the calculation right
now is to just return the same value as before.
2024-02-12 13:06:59 +01:00
Camilla Löwy
e25c1cc74f Wayland: Make fallback concepts more distinct 2024-02-12 13:06:59 +01:00
Camilla Löwy
72164e6921 Wayland: Remove fallback decoration edge enum 2024-02-12 13:06:32 +01:00
Camilla Löwy
a268b4b3a4 Wayland: Cleanup 2024-02-11 12:32:46 +01:00
Camilla Löwy
4baeadbd66 Wayland: Put fallback decorations behind a boolean 2024-02-11 12:32:27 +01:00
Camilla Löwy
6ac0835ad2 Wayland: Cleanup 2024-02-09 14:33:13 +01:00
Camilla Löwy
ea6dd72c71 Wayland: Fix GLFW_HOVERED for fallback decorations
When using the fallback decorations, GLFW_HOVERED was true also when the
cursor was over one of the window decorations.

This also disentangles the GLFW_HOVERED state from the fallback
decorations.  Because GLFW_HOVERED should have had the same behavior as
GLFW_MAIN_WINDOW, the latter has been removed.
2024-02-09 14:33:01 +01:00
Camilla Löwy
5e97447dd5 Wayland: Clarify fallback decoration struct name
We now have three window decoration paths in the Wayland backend:
libdecor decorations, XDG decorations and fallback decorations.

This makes it clearer when code relates to the fallback decoration path,
which should increasingly (hopefully) not get used.
2024-02-09 14:22:23 +01:00
Camilla Löwy
d3a7362430 Wayland: Separate window and framebuffer resizing 2024-02-09 14:01:57 +01:00
Camilla Löwy
1fe98a0d53 Fix missing list entry dash in README 2024-02-09 14:00:02 +01:00
Camilla Löwy
a360198f8f Wayland: Implement glfwFocusWindow
This implements window focus requests via the xdg-activation-v1
protocol.  These requests will likely only work when another window of
the same application already has input focus, but that isn't unlike the
behavior of other platforms.

The GLFW_FEATURE_UNAVAILABLE error has been removed from this function
for now.

Related to #2284
Related to #2306
Related to #2439
2024-02-09 13:52:54 +01:00
Camilla Löwy
eeb403135d Add minor features and updates to window test
- Button label reflects window mode
- Window attention request button
- Slightly less bad button layout possibly
- Applicable button labels list expected delay
- Less telegraphic message for positions being unsupported
- Window size more likely to fit contents
2024-02-09 13:45:48 +01:00
Camilla Löwy
00e86d4b73 WGL: Fix pixel format count in a Parallels VM
In a Parallels VM wglGetPixelFormatAttribivARB returns fewer pixel
formats than DescribePixelFormat.  This broke context creation on
Windows in Parallels since the changes in
2c0f34b60f.  The previous version of the
code worked accidentally.

This adds a workaround by iterating through the minimum of both counts.
It should have no effect when running on conforming implementations.

Tested on Parallels by @ dougbinks.

Closes #2191
Fixes #2406
Fixes #2467
2024-01-30 20:22:10 +01:00
Camilla Löwy
86d7bcb124 Fix missing checks for platform mismatch
The native access functions for monitor objects did not check whether
the correct platform was initialized and would return invalid handles if
it was not.
2024-01-30 20:20:42 +01:00
Camilla Löwy
d7aeb1eae8 Fix function return value when uninitialized 2024-01-30 20:20:42 +01:00
Camilla Löwy
f74ff2aa10 Fix function return value when uninitialized 2024-01-30 20:20:42 +01:00
Camilla Löwy
c47894a9a3 Update compilation-related parts of README 2024-01-30 20:20:42 +01:00
Camilla Löwy
42afff41fe Remove reminders to use C99 from more source files 2024-01-30 20:20:42 +01:00
Camilla Löwy
23962c9dc7 Remove further traces of IRC channel 2024-01-30 20:20:42 +01:00
Camilla Löwy
ad264f5061 Update URL for xdg-activation-v1 protocol docs 2024-01-30 20:20:42 +01:00
Camilla Löwy
94310c5281 Wayland: Move listener to correct section 2024-01-30 20:20:42 +01:00
Camilla Löwy
bdedec9932 Wayland: Fix formatting of attention request 2024-01-30 20:20:42 +01:00
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