Commit Graph

4413 Commits

Author SHA1 Message Date
Camilla Löwy
a0259b9426 Wayland: Fix maximized state lost while hidden
If a window was created as maximized, or created as hidden and then
iconified or maximized before first being shown, that state was lost and
the window was shown as restored.

(cherry picked from commit 77819c0c54)
2022-07-13 22:48:35 +02:00
Camilla Löwy
e79d6fe40a 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.

(cherry picked from commit 85f5a51912)
2022-07-13 22:48:35 +02:00
Camilla Löwy
498a4d0635 Wayland: Fix missing error reporting
(cherry picked from commit 9ad9f5c52a)
2022-07-13 22:48:35 +02:00
Camilla Löwy
35fd90aff1 Wayland: Cleanup
Make Wayland code use 'native' in the same senses as the rest of GLFW.

(cherry picked from commit 5002522f73)
2022-07-13 22:48:35 +02:00
Camilla Löwy
6b9087c575 Wayland: Fix error from glfwSetWindowAspectRatio
The aspect ratio was applied during resize but any call to
glfwSetWindowAspectRatio emitted a GLFW_FEATURE_UNIMPLEMENTED error.

(cherry picked from commit 91f18fb576)
2022-07-13 22:48:35 +02:00
Camilla Löwy
48e0e0acf5 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.

(cherry picked from commit e37ba80b13)
2022-07-13 22:48:35 +02:00
Camilla Löwy
557da4cdc4 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.

(cherry picked from commit c3ad3d49ed)
2022-07-13 22:48:35 +02:00
Camilla Löwy
50ea41cb04 Wayland: Add support for wl_output::name
We now use wl_output::name as the GLFW monitor name, on compositors that
provide this event.

(cherry picked from commit 209f6cf093)
2022-07-13 22:48:28 +02:00
Camilla Löwy
2529e663d7 Wayland: Cleanup
(cherry picked from commit 33d37782c6)
2022-07-13 22:47:03 +02:00
Camilla Löwy
8b26801a30 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.

(cherry picked from commit 229d628ec4)
2022-07-13 22:47:03 +02:00
Camilla Löwy
e04a7d152a Wayland: Remove duplicate fullscreen check
This check is already performed in shared code.

(cherry picked from commit c28d420060)
2022-07-13 22:47:03 +02:00
Camilla Löwy
8de0c1cdc1 Wayland: Cleanup
(cherry picked from commit 18df0baea6)
2022-07-13 22:47:03 +02:00
Camilla Löwy
fead23153e 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

(cherry picked from commit a7b6f35500)
2022-07-13 22:47:03 +02:00
Camilla Löwy
cdbcb8c5a7 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

(cherry picked from commit 0f5b095042)
2022-07-13 22:47:03 +02:00
Camilla Löwy
4ba1208239 Wayland: Rename window frame size constants
(cherry picked from commit 24cdc5afda)
2022-07-13 22:47:03 +02:00
Camilla Löwy
941744a59a Wayland: Remove unused code path
(cherry picked from commit 75295f4878)
2022-07-13 22:47:03 +02:00
Camilla Löwy
f454410b79 Wayland: Cleanup
(cherry picked from commit 040712ce99)
2022-07-13 22:47:03 +02:00
Camilla Löwy
5feaa33529 Wayland: Remove superfluous comments
These are just repeating parts of the identifier.

(cherry picked from commit 2877fea550)
2022-07-13 22:47:03 +02:00
Camilla Löwy
e894bf71a2 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.

(cherry picked from commit e33db6d7aa)
2022-07-13 22:47:03 +02:00
Camilla Löwy
ebe2b648ea Wayland: Add tracking of XDG fullscreen state
(cherry picked from commit afb127769a)
2022-07-13 22:47:03 +02:00
Camilla Löwy
51018f19d0 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.

(cherry picked from commit ed39ff43f9)
2022-07-13 22:47:03 +02:00
Camilla Löwy
1ad9c2d5dd Wayland: Cleanup
(cherry picked from commit 98c9961f32)
2022-07-13 22:47:03 +02:00
Camilla Löwy
1c4284e449 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.

(cherry picked from commit 3bbb41eacc)
2022-07-13 22:47:03 +02:00
Camilla Löwy
608007673f 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.

(cherry picked from commit 0b76e3a6f1)
2022-07-13 22:47:03 +02:00
Camilla Löwy
589385aada Wayland: Fix glfwSetWindowSize resizing fs windows
glfwSetWindowSize would change the size of fullscreen mode windows as
if they were windowed mode.

(cherry picked from commit 6857995498)
2022-07-13 22:47:03 +02:00
Camilla Löwy
15050f5711 Wayland: Fix missing fullscreen code path
glfwRestoreWindow assumed it was only called in windowed mode.

(cherry picked from commit fdc72edf81)
2022-07-13 22:47:03 +02:00
Camilla Löwy
562eca6f28 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.

(cherry picked from commit f39ffefb6a)
2022-07-13 22:47:03 +02:00
Camilla Löwy
dea602623d 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

(cherry picked from commit ddd087d662)
2022-07-13 22:47:03 +02:00
Emmanuel Gil Peyrot
581fed38be Wayland: Remove support for wl_shell
This is adapted to 3.3-stable from
599fb3de34 and
27295b508f.
2022-07-13 22:40:46 +02:00
Camilla Löwy
9f8ec83411 Wayland: Cleanup
(cherry picked from commit 523fdf50c1)
2022-07-12 20:29:22 +02:00
Camilla Löwy
3ec59687f1 Add credit
Related to #2108

(cherry picked from commit d3ede7b684)
2022-07-12 20:29:22 +02:00
Camilla Löwy
aa1efada52 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

(cherry picked from commit 05f6c13d11)
2022-07-12 20:29:22 +02:00
Camilla Löwy
b86fcd7cd0 Cocoa: Use system header to declare id type
Related to #1348

(cherry picked from commit edec334b32)
2022-07-12 20:29:22 +02:00
Camilla Löwy
631da8cc2f 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

(cherry picked from commit 26920a1a38)
2022-07-12 20:29:22 +02:00
Camilla Löwy
416f7828ff 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

This is adapted to 3.3-stable from
2c204ab52e and
fd7e737216.
2022-07-12 20:27:34 +02:00
Camilla Löwy
6de6446aca 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.

(cherry picked from commit e9c58bc181)
2022-06-10 17:11:25 +02:00
Camilla Löwy
2a6d25d1aa Win32: Add comment clarifying use of ToUnicode
Fixes #2100

(cherry picked from commit 62e175ef9f)
2022-06-10 17:11:13 +02:00
Camilla Löwy
f4e36e5389 Win32: Make monitor area retrieval more consistent
The rest of this file uses GetMonitorInfoW to retrieve this information.

(cherry picked from commit 7dfd84c458)
2022-06-10 17:11:13 +02:00
Camilla Löwy
f001aa3490 Fix and clarify comments for GLFWAPI
(cherry picked from commit 685de9089f)
2022-06-10 17:11:13 +02:00
Camilla Löwy
b9ea733ca8 Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_PLATFORM_ERROR 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.

This is adapted to 3.3-stable from
09653b8c54.
2022-06-10 17:11:01 +02:00
Camilla Löwy
c8be8606f0 Win32: Fix message reported by VS 2022
(cherry picked from commit acf0c10e7a)
2022-06-09 19:55:34 +02:00
Camilla Löwy
1b3b2108e3 Win32: Remove superfluous cast
(cherry picked from commit 80e31ce9e1)
2022-06-09 19:55:30 +02:00
Camilla Löwy
af9eb79de4 Move CODEOWNERS to .github directory
This slightly de-clutters a directory mostly intended for human-readable
documentation.

(cherry picked from commit d3c2121221)
2022-06-09 19:55:25 +02:00
Camilla Löwy
65b8c4a46b X11: Fix segfault on malformed INCR response
The code assumed that at least some data would be received via the INCR
mechanism and that, as a result, the string buffer would be allocated.

Bug found by Clang static analysis.

(cherry picked from commit 23e6e8e4b7)
2022-06-09 19:55:18 +02:00
Camilla Löwy
946312fe93 X11: Fix returned clipboard string freed too early
The clipboard string should not be freed on SelectionClear.  The user
may have received it from glfwGetClipboardString and it should remain
valid until the next call to a public clipboard string function.

(cherry picked from commit f60547ac80)
2022-06-09 19:53:23 +02:00
Camilla Löwy
bf5529512c Document delayed initialization of EGL display
(cherry picked from commit 06089a91a6)
2022-06-09 19:50:00 +02:00
Camilla Löwy
0052ddc5e3 Update stb_image_write.h to version 1.16
(cherry picked from commit 82ccbb3ef0)
2022-06-09 19:49:34 +02:00
Camilla Löwy
53d40878c8 X11: Fix OSMesa library not being unloaded
(cherry picked from commit a8d8b760fb)
2022-06-09 19:49:15 +02:00
Camilla Löwy
6dd9bf0bef Wayland: Fix OSMesa library not being unloaded
(cherry picked from commit 2d281d7928)
2022-06-09 19:48:31 +02:00
Camilla Löwy
6d08e52bcf Cocoa: Fix EGL and OSMesa not being unloaded
(cherry picked from commit 89514cf0fc)
2022-06-09 19:47:36 +02:00