Frank Praznik
3ed80843fe
video: Fix boolean logic for getting the pending window position
...
(cherry picked from commit 03cdd297e0 )
2025-03-21 11:36:46 -07:00
hwsmm
4029521a63
Don't send text event while ctrl/alt is held on X11/Wayland
...
(cherry picked from commit ac5b2b6102 )
2025-03-20 21:27:22 -07:00
Sam Lantinga
59857acd08
Always show the on-screen keyboard on Steam Deck
...
Steam will eventually have smarts about whether a keyboard is active and will igore the request appropriately.
Fixes https://github.com/libsdl-org/SDL/issues/12595
(cherry picked from commit 03a53ce0d1 )
2025-03-20 16:30:04 -07:00
Sam Lantinga
8129b637f3
A Steam Controller might be generating keyboard input
...
We can't use keyboard input as a signal about whether a keyboard is attached. There might be keyboard input from any number of generated inputs or non-keyboard devices.
(cherry picked from commit 8caeaaacdd )
2025-03-20 16:30:04 -07:00
Sam Lantinga
9e1675671d
Show the on-screen keyboard if we don't have active keyboard input
...
Active keyboard input is based on the input the user has most recently sent.
Fixes https://github.com/libsdl-org/SDL/issues/12595
(cherry picked from commit cbb83be895 )
2025-03-20 16:30:04 -07:00
Sam Lantinga
d8756582f9
Don't create surfaces with invalid pixel formats
...
Fixes https://github.com/libsdl-org/SDL/issues/12556
(cherry picked from commit 476e7e54cb )
2025-03-20 09:43:40 -07:00
Sam Lantinga
ff90984dc3
Fix illegal calls to DwmGetWindowAttribute()
...
DWMWA_WINDOW_CORNER_PREFERENCE and DWMWA_BORDER_COLOR are only supported for DwmSetWindowAttribute(), they can't be queried.
Fixes https://github.com/libsdl-org/SDL/issues/12206
Closes https://github.com/libsdl-org/SDL/pull/12209
(cherry picked from commit f2ed5c7a1b )
2025-03-19 22:03:18 -07:00
Sam Lantinga
81952f9f96
Windows allows windows to be resized to zero height.
...
Changed the window client rect validation to take this into account.
Fixes https://github.com/libsdl-org/SDL/issues/9796
(cherry picked from commit 96bf12444c )
2025-03-19 21:23:06 -07:00
Sam Lantinga
7a36aa37aa
Fixed crash if a window couldn't be created on Windows
...
Fixes https://github.com/libsdl-org/SDL/issues/11482
(cherry picked from commit 3415bc920a )
2025-03-19 20:10:49 -07:00
Frank Praznik
6f1afe7084
video: Send pending coordinates for moved, hidden windows
...
Some backends can't actually position a window until it is shown/mapped, so assume that it will be where it was asked to be as long as it is hidden.
(cherry picked from commit d66483dfcc )
2025-03-18 19:56:25 -04:00
Sam Lantinga
6302589829
Use an autoreleasepool in Cocoa_GetDisplayUsableBounds()
...
Fixes https://github.com/libsdl-org/SDL/issues/12571
(cherry picked from commit 8b924df48b )
2025-03-18 14:40:01 -07:00
Sam Lantinga
0799237d74
Added unaligned version of SDL_ConvertPixels_SwapNV_std()
...
Fixes https://github.com/libsdl-org/SDL/issues/12546
(cherry picked from commit 501e71f25f )
2025-03-15 09:25:39 -07:00
Frank Praznik
a530df20b2
cocoa: Set the internal window data before calling methods that may result in referencing the internal data
...
(cherry picked from commit 512d97eaba )
2025-03-12 17:09:37 -04:00
Sam Lantinga
9f32fafe21
Use sized types when fixing undefined behavior
...
(cherry picked from commit 24339524c5 )
2025-03-10 09:54:05 -07:00
rohlem
74b3b8e9e3
avoid UB (left shift of negative number) in SDL_windowsevents.c
...
(cherry picked from commit f1d16e9b4d )
2025-03-10 09:54:05 -07:00
Frank Praznik
fa4a9ba74e
wayland: Fix enum/boolean comparison and assignment
...
(cherry picked from commit f2866418d4 )
2025-03-09 12:28:39 -04:00
bobsayshilol
1173bc2dde
emscripten: Fix handling of special HTML targets
...
With ASAN enabled the existing code triggered null-pointer-dereference
in the strcmp since EMSCRIPTEN_EVENT_TARGET_WINDOW is a "fake" pointer
with the value ((const char*)2). In fixing this it was also noticed
that using the #window/#document/#screen targets as mentioned in the
docs fails since document.querySelector() returns null for them and we
should instead be mapping them to the special HTML targets provided.
(cherry picked from commit 65cd2256c5 )
2025-03-08 17:16:57 -08:00
Sam Lantinga
7c82171a85
Fixed pen events on iOS after reinitializing SDL
...
We weren't resetting apple_pencil_id, so not re-registering it later.
(cherry picked from commit 3353b92a96 )
2025-03-07 16:33:09 -08:00
Sam Lantinga
2aec1c2ef6
Added support for SDL_PIXELFORMAT_MJPG to SDL_DuplicateSurface()
...
Fixes https://github.com/libsdl-org/SDL/issues/12472
(cherry picked from commit 4c82b5843e )
2025-03-05 23:39:33 -08:00
Sam Lantinga
d75ba9c2d2
Added SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT
...
(cherry picked from commit fe9bdcf508 )
2025-03-05 09:13:10 -08:00
Sam Lantinga
cd8bffb2dd
Fixed continuous logging if returning to desktop mode fails on X11
...
(cherry picked from commit aef240b2e4 )
2025-03-04 17:26:03 -08:00
Sam Lantinga
9646e3cc1b
Handle XWayland not sending display disconnected events
...
Also updated X11_CheckDisplaysMoved() to handle multiple X11 screens
Fixes https://github.com/libsdl-org/SDL/issues/12462
(cherry picked from commit e9632c83c7 )
2025-03-04 17:26:03 -08:00
Sam Lantinga
6b3dafa4d3
Fixed crash when restoring the desktop mode on macOS
...
Fixes https://github.com/libsdl-org/SDL/issues/12460
(cherry picked from commit 80ae3a7516 )
2025-03-04 14:34:10 -08:00
Frank Praznik
ac09af2600
video: Synthesize fullscreen related moves if the driver does not.
...
(cherry picked from commit 9f9a442823 )
2025-03-04 12:49:56 -05:00
Frank Praznik
26d1afa29c
x11: Synthesize fullscreen size events on Openbox
...
Openbox doesn't send size events when entering fullscreen, so they must be synthesized. This is not desirable on any other window manager, as it can break fullscreen positioning on multi-monitor configurations.
(cherry picked from commit e7abbf158a )
2025-03-04 12:49:56 -05:00
Volian0
6aab3b9da8
Fix for Message Box failing to init on X11 ( #12455 )
...
Fixed X11 message boxes failing to initialize, because the proper X Logical Font Description could not be found
(cherry picked from commit debbe1cf75 )
2025-03-04 08:34:58 -08:00
Sam Lantinga
5a7b17fec5
Added fullscreen_active to better track fullscreen state
...
This is true if fullscreen is pending or currently active. This is a better check in SDL_SetDesktopDisplayMode() because a fullscreen mode may be pending and complete asynchronously and the window hasn't been set to fullscreen yet.
(cherry picked from commit 7c29c8b266 )
2025-03-03 21:19:15 -08:00
Frank Praznik
1d6bb62870
Use _this pointer to reference the video device
...
(cherry picked from commit 3b9f0dff10 )
2025-03-03 19:01:40 -05:00
Frank Praznik
0c3603d893
Check the display device before dereferencing
...
It can be null if the desktop mode is set early during initial display enumeration.
(cherry picked from commit 0ccf272eea )
2025-03-03 11:25:25 -05:00
Frank Praznik
38a5bca892
video: Handle Cocoa desktop mode switch inhibition in the video layer
...
The X backend had the same issue, so both Cocoa and X can be handled in the same location.
(cherry picked from commit 6c347cbf33 )
2025-03-03 11:05:32 -05:00
Sam Lantinga
70a289076a
Don't save temporary mode changes to the desktop mode
...
Fixes https://github.com/libsdl-org/SDL/issues/12441
(cherry picked from commit 24ec2ed785 )
2025-03-03 11:05:20 -05:00
Frank Praznik
6a9e970880
cocoa: Don't overwrite the desktop mode when changing the fullscreen mode
...
Changing the mode triggers a display reconfiguration event, which will overwrite the desktop mode with the set fullscreen mode, preventing proper restoration when leaving fullscreen. Don't overwrite the desktop mode if the reconfiguration is due to a fullscreen mode switch.
(cherry picked from commit b69201daeb )
2025-03-01 23:43:29 -05:00
Frank Praznik
4e3058ce82
cocoa: Run pending events to completion
...
Fullscreen spaces and miniaturization will always give us some notification that they succeeded or failed, so the timeout isn't required. This prevents errant timeouts when live-resize is active.
(cherry picked from commit 078d737a27 )
2025-03-01 19:34:00 -08:00
Sam Lantinga
f0cb78e082
Handle XCreateIC() failing when composition UI is enabled
...
Fixes https://github.com/libsdl-org/sdl2-compat/issues/328
2025-03-01 13:54:07 -08:00
Sam Lantinga
55484ef023
Moved WIN_UpdateMouseCapture() to be with the other mouse functions
2025-03-01 12:54:17 -08:00
Sam Lantinga
020664bd10
Update mouse button state when re-entering a window
...
Fixes https://github.com/libsdl-org/SDL/issues/12423
2025-03-01 12:54:17 -08:00
Sam Lantinga
ef23ebfb5a
Fixed the cursor clip rect when toggling window borders on macOS
2025-02-28 11:57:34 -08:00
Sam Lantinga
281f0fae1c
Include the VID/PID of generic keyboard/mouse devices on Windows
2025-02-27 14:03:39 -08:00
Frank Praznik
7b9036bea6
wayland: Don't overwrite clipboard data with the primary selection text
...
Primary selection text is handled separately, and shouldn't clobber the clipboard data.
2025-02-27 12:35:37 -05:00
Sam Lantinga
1ea99bc904
Early out if setting a duplicate window title
...
Setting the window title is an expensive windowing operation, so short circuit it if possible.
2025-02-26 17:10:41 -08:00
Frank Praznik
fab52b578f
wayland: Ensure that color descriptions are always retrieved
2025-02-26 15:15:44 -05:00
Sam Lantinga
e6a24fcbb5
fix stbi__parse_png_file() reading too much bytes (thanks @miniupnp!)
...
just "rewind" the bytes that have been read past the IEND chunk.
2025-02-24 17:29:25 -08:00
Sam Lantinga
db4e6c1931
Cocoa metal layers need their size updated before renderer updates
...
Also refactored event watch code so it can be shared between internal window event dispatch and public event watchers.
Fixes https://github.com/libsdl-org/SDL/issues/12376
2025-02-24 15:37:13 -08:00
Frank Praznik
52af81ea17
wayland: Fix mapping borderless windows under libdecor
...
Additionally, add a warning about calling the frame visibility function universally during the mapping process, as the libdecor Cairo plugin has a bug that will cause a crash in this scenario.
2025-02-23 11:04:29 -05:00
Frank Praznik
1a0a94b501
x11: Accommodate the borders when setting the initial window position
2025-02-23 10:49:40 -05:00
Sam Lantinga
52e64f816c
Use SDL C runtime functions in OpenVR driver
...
Fixes link errors when building with -DSDL_LIBC=OFF
2025-02-22 12:41:03 -08:00
Sam Lantinga
7224b40407
Fix errors when building stb_image with -DSDL_LIBC=OFF
...
I integrated changes from SDL_image and updated as needed for JPEG memory loading functionality.
Fixes https://github.com/libsdl-org/SDL/issues/12364
2025-02-22 12:41:03 -08:00
Sam Lantinga
fdf72d1e45
Use the keyboard/mouse vendor if available
...
Fixes the 8BitDo Micro gamepad so it shows up as "8BitDo HID-compliant mouse" and "8BitDo HID Keyboard Device" in keyboard mode over USB.
2025-02-22 09:19:59 -08:00
Sam Lantinga
fcd41c1d2c
Check desired window area when checking zoom state
...
isZoomed returns true if the window has the size and position that it would if it were maximized, so we need to check to see if our floating state matches that before saying we're zoomed.
This fixes calling zoom:nil on a borderless resizable window that was created with the same size as the usable desktop area, which happens to also be the maximized state.
Fixes https://github.com/libsdl-org/SDL/issues/12228
2025-02-21 18:38:12 -08:00
Petar Popovic
b5297de56f
Add 'const' to pointer parameters
2025-02-21 15:59:40 -08:00