Commit Graph

15734 Commits

Author SHA1 Message Date
Sam Lantinga b0e93e4e63 Prevent crashes if freed objects are passed to SDL API functions
Instead of using the magic tag in the object, we'll actually keep track of valid objects

Fixes https://github.com/libsdl-org/SDL/issues/9869
Fixes https://github.com/libsdl-org/SDL/issues/9235
2024-06-03 08:54:46 -07:00
Ryan C. Gordon 57a15933cd SDL_GetCSSCursorName: Don't assert on unrecognized cursor types.
These values are passed through from the calling app and shouldn't trigger
asserts when they are bogus.
2024-06-01 22:32:43 -04:00
Ryan C. Gordon 9a9a3d1a33 SDL_SystemCursor: rename enum items to match CSS.
Fixes #9079.
2024-06-01 22:32:43 -04:00
Ozkan Sezer 49b6c24722 always define PRI?64 using 'I64' when targeting windows
avoids -Wformat warnings from mingw toolchains -- e.g.:
src/test/SDL_test_harness.c:581:37: warning: unknown conversion type character 'l' in format [-Wformat=]
2024-06-01 22:35:40 +03:00
Anonymous Maarten fd2b9c0602 cmake: don't check c++ compiler flags for asan when CXX is not enabled 2024-06-01 10:18:15 +02:00
Frank Praznik 85a2a201b1
x11: Always disable the borders when leaving fullscreen from a borderless window created as fullscreen
Borderless windows flagged as fullscreen at creation time turn on the borders, because doing so prevents some window managers from wrongly positioning the borderless window, and in these cases the borders need to be removed whether fullscreen is exited programmatically or via a compositor event. Set a flag when forcing the borders on, so they will be removed in all cases later.
2024-05-31 19:11:50 -04:00
Sam Lantinga 4c7459eda8 SDL_cocoawindow: Fix setting parent-relative coordinates for child windows in Cocoa_SetWindowSize 2024-05-31 15:29:19 -07:00
Sam Lantinga e3beaa1972 Added support for the Razer Kitsune in PS5 mode 2024-05-31 15:18:15 -07:00
Sam Lantinga cd9c25e800 Don't set the borderless flag if we're about to go fullscreen.
This prevents the GNOME window manager from moving the window to a different display before the window goes fullscreen.

Fixes https://github.com/libsdl-org/SDL/issues/9915
2024-05-31 11:35:18 -07:00
Anonymous Maarten 6896c4c3bf tests: testcases accept a void pointer argument 2024-05-31 19:18:24 +02:00
Anonymous Maarten d5060423a2 testplatform: fix leak at exit time
A leak was present at exit time on the Emscripten platform
2024-05-31 18:53:36 +02:00
Anonymous Maarten 4b0f52b04e cmake: fall back to per-cpu test when all-in-one test fails
The 'all-in-one' test fails for Emscripten because try_compile does not copy back the actual binary:
the wasm file contains the machine parseable strings, not the html or js file(s).
2024-05-31 18:53:21 +02:00
mechakotik 8f88c32ca6 android: Default to custom theme in styles.xml
Custom theme file exists in project, but is not used by app, which is kinda unintuitive. Using it by default so people who not familiar with Android development won't spend lots of time troubleshooting.
2024-05-31 09:04:06 -07:00
Ozkan Sezer 550d5b95c0 fix type redefinition errors after commit b1b4638cac. 2024-05-31 17:47:20 +03:00
Ozkan Sezer 5aa9ee8446 SDL_windowsmodes.c (WIN_GetDisplayNameVista): fix return after PR/9923
why haven't any of the build tests catch this..
2024-05-31 11:33:50 +03:00
Sam Lantinga 90beffdeb1 Revert "WASAPI_WaitDevice: Check current padding before waiting on event"
This reverts commit 09fbb2a07d.

This was causing issues in CS2 and DOTA:
https://old.reddit.com/r/DotA2/comments/1d4bqe3/dota_2_sound_crackling_since_this_morning/
https://old.reddit.com/r/DotA2/comments/1d44udf/anyone_having_sound_issues_or_any_clue_how_to_fix/
2024-05-30 16:50:30 -07:00
Ozkan Sezer e4518af377 move vista+ display config function ptr calls to device->driverdata
.. and change hdr code's display config function calls to use those
function ptrs.
2024-05-31 02:50:02 +03:00
Sam Lantinga fb2287dd47 Fixed updating NV12 and YV12 textures on the direct3d11 renderer
Fixes https://github.com/libsdl-org/SDL/issues/9928
2024-05-30 14:19:34 -07:00
Hunter Kvalevog 8604847214 SDL_SetEventFilter: Don't flush when removing filter
Don't flush the event queue if the filter paramter is NULL.
2024-05-30 13:06:01 -07:00
Hunter Kvalevog 0136bf2f8f SDL_SetEventFilter: Don't flush good events
Only cut events that don't pass the user filter instead of flushing the
entire list.

Fixes #9592
2024-05-30 13:06:01 -07:00
Sam Lantinga 4954690828 Fixed warning C4244: '=': conversion from 'double' to 'float', possible loss of data 2024-05-30 07:44:00 -07:00
Sam Lantinga 690d73f5c9 Fixed warning C4244: 'initializing': conversion from 'WPARAM' to 'Uint32', possible loss of data 2024-05-30 07:42:35 -07:00
Ozkan Sezer d41e48e4c6 WIN_AdjustWindowRectWithStyle: silence gcc maybe-uninitialized warnings
/tmp/SDL3/src/video/windows/SDL_windowswindow.c: In function 'WIN_SetWindowPositionInternal':
/tmp/SDL3/src/video/windows/SDL_windowswindow.c:216:17: warning: 'h' may be used uninitialized in this function [-Wmaybe-uninitialized]
     rect.bottom = *height;
     ~~~~~~~~~~~~^~~~~~~~~
/tmp/SDL3/src/video/windows/SDL_windowswindow.c:320:12: note: 'h' was declared here
     int w, h;
            ^
/tmp/SDL3/src/video/windows/SDL_windowswindow.c:215:16: warning: 'w' may be used uninitialized in this function [-Wmaybe-uninitialized]
     rect.right = *width;
     ~~~~~~~~~~~^~~~~~~~
/tmp/SDL3/src/video/windows/SDL_windowswindow.c:320:9: note: 'w' was declared here
     int w, h;
         ^
2024-05-29 16:39:03 -07:00
Sam Lantinga a801f81132 Revert "Fix flickering of window when using desktop-fullscreen and borderless window on multiple monitors on Linux. Closes #8186."
This reverts commit 2de2e9d031.

The fullscreen state is no longer available to check, and the actual bug this was trying to work around was fixed in ad813a65e7
2024-05-29 14:15:59 -07:00
Frank Praznik 63c164f778 x11: Use the floating size for the constraints on non-resizable windows
Otherwise, the window manager can think that the window is larger than it is and try to reposition it.
2024-05-29 14:09:29 -07:00
Ozkan Sezer 384e5486bc SDL_windows.h: set _WIN32_WINNT to 0xA00 dxgi1_6.h is available
to make sure DISPLAYCONFIG_SDR_WHITE_LEVEL is visible to us.
2024-05-30 00:05:55 +03:00
Ozkan Sezer b1c7b2f44f SDL_wasapi.c: avoid unused warning if IAudioClient3 isn't available 2024-05-29 15:43:33 -04:00
Ozkan Sezer dde9c10e79 SDL_camera_mediafoundation.c: hardcode MF_DEVSOURCE_ATTRIBUTE_* GUIDs 2024-05-29 15:33:42 -04:00
Ramez Ragaa 6bb91c7c08 Support X11 incremental clipboard transfers.
This adds support for pasting large clipboard contents using the INCR
property mechanism

Fixes #8871
2024-05-29 12:30:34 -07:00
Sam Lantinga 652b34bd15 Added SDL_DumpProperties() for internal debugging 2024-05-29 10:30:31 -07:00
Sam Lantinga ae59afa7d0 Fixed building with ENABLE_SDL_CALL_LOGGING enabled 2024-05-29 10:30:31 -07:00
Frank Praznik 57504385e0 wayland: Maintain aspect ratio while resizing the window
Note that Wayland places a restriction on windows being resized, where the requested size passed to the configuration event is a maximum, and attempting to exceed it is a protocol violation, so trying to grow the window by dragging the sides only vertically or horizontally is limited, as the provided dimensions can't be exceeded.

In practice, nothing seems to kill clients that do this, but the more immediate problem is that doing so causes GNOME to glitch out.
2024-05-29 12:23:36 -04:00
Sam Lantinga b1b4638cac Add basic vulkan support to offscreen video driver so it doesn't crash if you happen to get the offscreen driver and try to use vulkan.
Enable offscreen video driver in windows to make it easier to test.
Enable offscreen video driver in macos just to complete the desktop computer trio.
2024-05-28 20:02:55 -07:00
SDL Wiki Bot 04a0a85d92 Sync SDL3 wiki -> header 2024-05-29 02:48:51 +00:00
Sam Lantinga 542a3663de Added SDL_GetDefaultKeyFromScancode() to the public API
This is useful when getting the English name of a key for a non-Latin keyboard layout, for example.
2024-05-28 19:48:24 -07:00
Ryan C. Gordon aeb223fc23
pipewire: if no devices seen in "preferred" init, try a different backend.
We're seeing people with legit PipeWire installs that don't export any
devices, that are also running a (not emulated) PulseAudio install that
works.

This solution might still get tweaked some more, but it seems to be working
so far.
2024-05-28 22:17:40 -04:00
Frank Praznik fafc9f642a
win32: Don't set the display HDR values to uninitialized data
The HDR properties are zeroed and set in WIN_GetHDRProperties, and using the struct without calling this function results in sending uninitialized data.
2024-05-28 15:51:02 -04:00
Ozkan Sezer 2b374e6c0f check dxgi1_6.h before enabling sdr/hdr code in SDL_windowsmodes.c
thanks @madebr
2024-05-28 22:11:56 +03:00
Ozkan Sezer 00a7b14ee7 cmake: check mfapi.h before enabling SDL_CAMERA_DRIVER_MEDIAFOUNDATION 2024-05-28 22:11:50 +03:00
Sam Lantinga d141827895 Fixed positioning a window with undefined position on a specific display 2024-05-28 12:06:48 -07:00
SDL Wiki Bot 98fdef75bb Sync SDL3 wiki -> header 2024-05-28 18:54:02 +00:00
Sam Lantinga c74886ab00 Added SDL_SetWindowAspectRatio() and SDL_GetWindowAspectRatio()
Fixes https://github.com/libsdl-org/SDL/issues/1573
2024-05-28 11:52:31 -07:00
Ozkan Sezer aacafd6233 time/windows/SDL_systime.c: remove minwinbase.h & timezoneapi.h includes
core/windows/SDL_windows.h is included in there, which inludes windows.h
which in turn includes winbase.h, which in turn includes the two already
2024-05-28 11:27:37 +03:00
Ozkan Sezer 864df05b19 SDL_windowsevents.c: define RI_MOUSE_HWHEEL if missing. 2024-05-28 11:11:50 +03:00
Ozkan Sezer ba1fdf24c9 fix type redefinition error after commit dfe4445214
In file included from /tmp/SDL3/src/events/SDL_events_c.h:28,
                 from /tmp/SDL3/src/SDL.c:46:
/tmp/SDL3/src/events/../video/SDL_sysvideo.h:31: error: redefinition of typedef 'SDL_VideoDevice'
/tmp/SDL3/src/video/SDL_video_c.h:27: note: previous declaration of 'SDL_VideoDevice' was here
2024-05-28 11:00:02 +03:00
erysdren 2f1384e5d1 SDL_systime.c: missing include for PSP toolchain 2024-05-27 14:36:46 -07:00
Sam Lantinga 36015ad5e5 Fixed compiling SDL_platform_defines.h on macOS with older compilers (thanks @sezero!)
Fixes #9632
2024-05-27 14:34:21 -07:00
Ryan C. Gordon e508d82f74
include: Tweaked some vsync-related documentation.
Reference PR #9903.
2024-05-27 16:57:32 -04:00
SDL Wiki Bot 6524f9c9b8 Sync SDL3 wiki -> header 2024-05-27 20:12:47 +00:00
Sam Lantinga dfe4445214 Added SDL_SetWindowSurfaceVSync() and SDL_GetWindowSurfaceVSync()
Fixes https://github.com/libsdl-org/SDL/issues/9347
2024-05-27 13:12:17 -07:00