Commit Graph

4778 Commits

Author SHA1 Message Date
Camilla Löwy
203002ef2c Wayland: Fix latent bug for glfwGetWindowTitle 2022-06-21 21:47:35 +02:00
Camilla Löwy
85f5a51912 Wayland: Fix events emitted before ack_configure
Window iconfication and maximization events were being emitted before
xdg_surface::configure, making it possible for user code to indirectly
commit surface changes from those event callbacks before
xdg_surface::ack_configure.

This postpones those events until after the ack has been sent.
2022-06-21 21:47:35 +02:00
Camilla Löwy
9ad9f5c52a Wayland: Fix missing error reporting 2022-06-21 21:47:32 +02:00
Camilla Löwy
5002522f73 Wayland: Cleanup
Make Wayland code use 'native' in the same senses as the rest of GLFW.
2022-06-21 21:44:15 +02:00
Camilla Löwy
91f18fb576 Wayland: Fix error from glfwSetWindowAspectRatio
The aspect ratio was applied during resize but any call to
glfwSetWindowAspectRatio emitted a GLFW_FEATURE_UNIMPLEMENTED error.
2022-06-21 20:46:06 +02:00
Camilla Löwy
e37ba80b13 Wayland: Fix reporting of monitor scale changes
Content scale events would be emitted when a window surface entered or
left an output, but not when one of a window's current outputs had its
scale changed.
2022-06-21 20:46:06 +02:00
Camilla Löwy
c3ad3d49ed Wayland: Fix duplicate monitor connection events
GLFW would report a monitor as connected each time its wl_output
received an update, for example if its scale changed.

This would also cause the monitor to be added to the monitor array
again, causing glfwTerminate to segfault when it attempted to destroy
its already destroyed wl_output.
2022-06-21 20:46:06 +02:00
Camilla Löwy
209f6cf093 Wayland: Add support for wl_output::name
We now use wl_output::name as the GLFW monitor name, on compositors that
provide this event.
2022-06-21 20:44:52 +02:00
Camilla Löwy
33d37782c6 Wayland: Cleanup 2022-06-21 16:00:33 +02:00
Camilla Löwy
229d628ec4 Wayland: Fix toggling of server-side decorations
This is a temporary local fix to have updates to GLFW_DECORATED mostly
work as intended.  The whole decoration state machine needs to be
restructured, but not by this commit.
2022-06-21 16:00:33 +02:00
Camilla Löwy
c28d420060 Wayland: Remove duplicate fullscreen check
This check is already performed in shared code.
2022-06-21 16:00:20 +02:00
Camilla Löwy
18df0baea6 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
a7b6f35500 Wayland: Fix size limits for fallback decorations
The size limits set on our XDG surface did not include the sizes of the
fallback decorations on all sides, when in use.  This led to its content
area being too small.

Related to #2127
2022-06-20 00:57:17 +02:00
Camilla Löwy
0f5b095042 Wayland: Fix erratic fallback decoration behavior
The handler for xdg_toplevel::configure treated the provided size as the
content area size when instead it is the size of the bounding rectangle
of the wl_surface and all its subsurfaces.

This caused the fallback decorations to try positioning themselves
outside themselves, causing feedback loops during interactive resizing.

Fixes #1991
Fixes #2115
Closes #2127
Related to #1914
2022-06-20 00:57:17 +02:00
Camilla Löwy
24cdc5afda Wayland: Rename window frame size constants 2022-06-20 00:57:17 +02:00
Camilla Löwy
75295f4878 Wayland: Remove unused code path 2022-06-20 00:57:17 +02:00
Camilla Löwy
040712ce99 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
2877fea550 Wayland: Remove superfluous comments
These are just repeating parts of the identifier.
2022-06-20 00:57:17 +02:00
Camilla Löwy
e33db6d7aa Wayland: Fix resize events before ack_configure
The surface was resized and the size event was emitted before we had
sent xdg_surface::ack_configure.  If user code then called some GLFW
function that commited the surface, those changes would all get applied
to the wrong configure event.

This postpones size changes until after the ack.
2022-06-20 00:57:17 +02:00
Camilla Löwy
afb127769a Wayland: Add tracking of XDG fullscreen state 2022-06-20 00:57:17 +02:00
Camilla Löwy
ed39ff43f9 Wayland: Use named constants for version checks
The wayland-scanner output provides really nice, self-documenting
version macros, so we should use them whenever possible.
2022-06-20 00:57:17 +02:00
Camilla Löwy
98c9961f32 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
3bbb41eacc Wayland: Fix glfwInit closing stdin on failure
If platform initialization failed before either timer fd member had been
set to -1 or a valid fd, termination would close stdin.
2022-06-20 00:57:17 +02:00
Camilla Löwy
0b76e3a6f1 Wayland: Fix duplicate window content scale events
The window content scale event was emitted every time the window content
area was resized, even if its scale had not changed.
2022-06-20 00:57:17 +02:00
Camilla Löwy
6857995498 Wayland: Fix glfwSetWindowSize resizing fs windows
glfwSetWindowSize would change the size of fullscreen mode windows as
if they were windowed mode.
2022-06-20 00:57:17 +02:00
Camilla Löwy
fdc72edf81 Wayland: Fix missing fullscreen code path
glfwRestoreWindow assumed it was only called in windowed mode.
2022-06-20 00:57:17 +02:00
Camilla Löwy
f39ffefb6a Wayland: Fix maximization by user being ignored
The internal maximization state was not updated when an event was
received that the user had changed the maximization state of a window,
and no maximization events were emitted.

This affected both the GLFW_MAXIMIZED attribute and glfwRestoreWindow.
2022-06-20 00:57:17 +02:00
Camilla Löwy
ddd087d662 Wayland: Fix behavior of leaving full screen mode
These changes make GLFW fullscreen more consistent, but unfortunately
also make GLFW even more oblivious to user-initiated XDG shell
fullscreen changes.

Fixes #1995
2022-06-20 00:57:17 +02:00
Camilla Löwy
523fdf50c1 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
d3ede7b684 Add credit
Related to #2108
2022-06-10 00:14:05 +02:00
Camilla Löwy
a465c1c32e Win32: Simplify window class handling
By using window class atoms, we only need to mention each window class
name once, also removing the need to define _GLFW_WNDCLASSNAME.  It can
still be defined by the user as before.
2022-06-09 18:39:37 +02:00
Camilla Löwy
2ae3e0c8d7 Win32: Add separate window class for helper window
The current window procedure needs to deal with messages both for user
created windows and the hidden helper window.

This commit separates out the device message handling of the helper
window, allowing both window procedures to be less complicated.
2022-06-08 23:56:20 +02:00
Camilla Löwy
ad3dbeb65f Add basic assertions for event API arguments 2022-06-08 22:14:38 +02:00
Camilla Löwy
05f6c13d11 Add support for GLFW_NATIVE_INCLUDE_NONE macro
By default, the glfw3native.h header will include the platform-specific
headers necessary for the return types of GLFW native access functions.

Sometimes it is preferrable to declare those types

This commit adds support for the GLFW_NATIVE_INCLUDE_NONE macro, which
when defined disables the inclusion of all platform-specific headers.

Fixes #1348
2022-06-08 22:14:38 +02:00
Camilla Löwy
edec334b32 Cocoa: Use system header to declare id type
Related to #1348
2022-06-08 22:14:38 +02:00
Camilla Löwy
26920a1a38 X11: Fix previous error handler not being restored
GLFW did not restore the previous Xlib error handler when removing its
own, instead resetting to the default handler.

This commit saves and restores the previous error handler.

None of this is thread-safe or could ever be.

Fixes #2108
2022-06-08 22:14:38 +02:00
Camilla Löwy
736a88b067 Fix return type of functions returning bool values 2022-06-08 22:14:38 +02:00
Camilla Löwy
2c204ab52e Fix joystick user pointer NULL during disconnect
The joystick code did not distinguish between the allocation status of
the GLFW joystick object and whether it is connection to an OS level
joystick object.

These are now tracked separately.

Fixes #2092
2022-06-08 22:14:38 +02:00
Camilla Löwy
e9c58bc181 Wayland: Fix missing lock key modifier bits
The modifier bits for lock keys were only set when the corresponding key
was reported as held down or latched, but not when it was released and
locked.
2022-06-08 19:20:01 +02:00
Camilla Löwy
62e175ef9f Win32: Add comment clarifying use of ToUnicode
Fixes #2100
2022-05-06 19:19:25 +02:00
Camilla Löwy
ce85c7dcaf Fix GLAPIENTRY not being defined for native access
This is a follow-up to 535c3ce632.

That commit made glfw3native.h undefine GLAPIENTRY whenever
GLFW_EXPOSE_NATIVE_GLX or GLFW_EXPOSE_NATIVE_OSMESA was defined, on the
assumption that it was glfw3.h that had defined GLAPIENTRY.

If gl.h or an extension loader header has been included before glfw3.h,
then it has defined inclusion guards preventing GLAPIENTRY from being
defined later when the GLX or OSMesa header includes gl.h.

This commit ensures GLAPIENTRY is only undefined if glfw3.h defined it.

Related to #2010
2022-05-06 19:18:47 +02:00
Camilla Löwy
5c3ebfb9cc Remove OSMesa specific code from offscreen example
The OSMesa specific path is more appropriate for a test than an example.
2022-05-06 19:06:13 +02:00
Camilla Löwy
7dfd84c458 Win32: Make monitor area retrieval more consistent
The rest of this file uses GetMonitorInfoW to retrieve this information.
2022-04-28 21:58:44 +02:00
Camilla Löwy
685de9089f Fix and clarify comments for GLFWAPI 2022-04-28 21:58:44 +02:00
Camilla Löwy
09653b8c54 Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_FEATURE_UNAVAILABLE or
GLFW_FEATURE_UNIMPLEMENTED on Wayland because shared code was calling
unimplemented or unavailable platform functions during final setup.

It also makes it consistent with the final setup of full screen windows.
2022-04-28 21:58:06 +02:00
Camilla Löwy
72642ea0d1 Simplify struct stitching for sync primitives
There will not currently be more than one set of threading or timer APIs
selected regardless of how many window systems are enabled, so there is
no need for this extra complexity.
2022-04-28 21:54:25 +02:00
Camilla Löwy
8f050b5655 Wayland: Add support for older wayland-scanner
Versions of wayland-scanner prior to 1.17.91 named every global array of
wl_interface pointers 'types', making it impossible to combine several
unmodified private-code files into a single compilation unit.

This overrides that name with a macro for each file, allowing them to
coexist.

Fixes #2016
Closes #2032
2022-04-28 21:54:24 +02:00
Camilla Löwy
acf0c10e7a Win32: Fix message reported by VS 2022 2022-04-28 21:54:24 +02:00
Camilla Löwy
80e31ce9e1 Win32: Remove superfluous cast 2022-04-28 21:54:24 +02:00
Camilla Löwy
d3c2121221 Move CODEOWNERS to .github directory
This slightly de-clutters a directory mostly intended for human-readable
documentation.
2022-04-28 21:19:10 +02:00