This slightly newer device than the one from #7814 is functionally
equivalent when connected via USB. When connected via Bluetooth, it has
a different button mapping.
Thanks to Sam Lantinga.
Signed-off-by: Simon McVittie <smcv@collabora.com>
https://github.com/ValveSoftware/steam-devices/pull/34 lists several
more devices that are functionally equivalent to this one from the
point of view of their evdev metadata. Thanks to apgrc.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Also make details of PS4 gamepads (which are very similar from an evdev
point of view) more specific.
Thanks to Sam Lantinga and Jeremy Whiting for recording these.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Like the Stadia controller, this is unusual because it represents the
Share button as the Record key from a multimedia keyboard (as of Linux
6.2.11 with the xpad driver). Thanks to Jeremy Whiting.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This is a bit unusual because it has a small number of what would
ordinarily be keyboard keys. Thanks to Jeremy Whiting for recording
this.
Signed-off-by: Simon McVittie <smcv@collabora.com>
A newer evemu-describe transcript has this same controller with its
buttons mapped differently, presumably a result of driver changes in
the Linux kernel. Either way, we should recognise it as a gamepad.
Thanks to Jeremy Whiting.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This didn't include any buttons, which I assume was because I
transcribed them incorrectly rather than reflecting reality. Confirmed
against another Switch Pro Controller on a more recent kernel (thanks
to Jeremy Whiting).
Signed-off-by: Simon McVittie <smcv@collabora.com>
We don't need to re-test the heuristic with the same input data, but
knowing that another device has equivalent evdev metadata is useful
information to record. Thanks to Jeremy Whiting.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This was reported by Rémi Bernon as an example of older SDL's non-udev
code path going wrong for touchpads when the invoking user happens to
be in the input group, which I believe was fixed by fdd945f2.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Ideally we'd detect these as "joysticks" (or more generally, gaming
controllers), but in most cases their evdev flags are indistinguishable
from an accelerometer or gyro, so the only way to achieve this would be
a table of known devices that doesn't currently exist.
One exception is the one that reports a THROTTLE axis and TRIGGER, THUMB
buttons, which would be reasonable to detect via the joystick heuristic.
Signed-off-by: Simon McVittie <smcv@collabora.com>
There are some devices for which SDL's device classification heuristic
is known not to give the ideal result. Add a way to incorporate these
into our test data, so that when the heuristic is improved we can
detect them as their intended device type, without making the test fail
before that has been implemented.
Signed-off-by: Simon McVittie <smcv@collabora.com>
We have gotten feedback that abstracting the coordinate system based on the display scale is unexpected and it is difficult to adapt existing applications to the proposed API.
The new approach is to provide the coordinate systems that people expect, but provide additional information that will help applications properly handle high DPI situations.
The concepts needed for high DPI support are documented in README-highdpi.md. An example of automatically adapting the content to display scale changes can be found in SDL_test_common.c, where auto_scale_content is checked.
Also, the SDL_WINDOW_ALLOW_HIGHDPI window flag has been replaced by the SDL_HINT_VIDEO_ENABLE_HIGH_PIXEL_DENSITY hint.
Fixes https://github.com/libsdl-org/SDL/issues/7709
Re-writes the clipboard data handling in wayland to an on demand
solution where callbacks are provided to generate/provide the clipboard
data when requested by the OS.
- SDL_AudioCVT is gone, even internally.
- libsamplerate is gone (I suspect our resampler is finally Good Enough).
- Cleanups and improvements to audio conversion interfaces.
- SDL_AudioStream can change its input/output format/rate/channels on the fly!
Otherwise they'll try to run with no arguments, and fail, when run by
ginsttest-runner.
Fixes: 81ca9d61 "cmake+test: add more automated tests + use properties"
Signed-off-by: Simon McVittie <smcv@collabora.com>
It turns out there's a race condition on X11 where the window could be placed by the window manager while being placed by the application, so we need to have the initial position available at window creation.
* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINDOWS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_ANDROID
* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DUMMY
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_COCOA
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_UIKIT
* Fix -Wundef warnings due to use of unguarded SDL_TIMERS_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_TIMER_DUMMY
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_SENSOR_DISABLED
* Fix -Wundef warnings due to use of unguarded __ANDROID__
* Fix -Wundef warnings due to use of unguarded __IOS__
* Fix -Wundef warnings due to use of unguarded EMULATE_CAS
* Fix -Wundef warnings due to use of unguarded SDL_ATOMIC_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_SNDIO
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_NETBSD
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_WASAPI
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DSOUND
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_HAIKU
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_COREAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_AAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OPENSLES
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ANDROID
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PS2
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_VITA
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_N3DS
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_NEON_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_ALTIVEC_BLITTERS
* Fix -Wundef warnings due to use of unguarded __VITA__
* Fix -Wundef warnings due to use of unguarded __3DS__
* Fix -Wundef warnings due to use of unguarded SDL_DYNAPI_PROC_NO_VARARGS
* Fix -Wundef warnings due to use of unguarded __APPLE__
* Fix -Wundef warnings due to use of unguarded __WINRT__
* Fix -Wundef warnings due to use of unguarded SDL_HIDAPI_DISABLED
* Fix -Wundef warnings due to use of unguarded __TVOS__
* Fix -Wundef warnings due to use of unguarded HAVE_DRIVER_BACKEND
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_XINPUT
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_WGI
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DINPUT
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_MFI
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PS2
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PSP
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VITA
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_N3DS
* Fix -Wundef warnings due to use of unguarded __MACOS__
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINRT
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RPI
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR_OGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D11
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D12
* Fix -Wundef warnings due to use of unguarded SDL_RENDER_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_METAL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PS2
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_VITA_GXM
* Fix -Wundef warnings due to use of unguarded SDL_ARM_SIMD_BLITTERS
* Fix -Wundef warnings due to use of unguarded SDL_ARM_NEON_BLITTERS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_HAIKU
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PS2
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VITA
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_N3DS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_KMSDRM
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_NGAGE
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_METAL
* Fix -Wundef warnings due to use of unguarded SDL_LSX_INTRINSICS
* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_NP_H
* Fix -Wundef warnings due to use of unguarded __RISCOS__
* Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX
* Fix -Wundef warnings due to use of unguarded USE_POSIX_SPAWN
* textureData is only needed when SDL is built with YUV support
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ALSA
* Fix -Wundef warnings due to use of unguarded SDL_SSE3_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE4_2_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE4_1_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_AVX512F_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_AVX_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_AVX2_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_MMX_INTRINSICS
* Fix -Wundef warnings due to use of unguarded HAVE_CLOCK_GETTIME
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DUMMY
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_DUMMY
* Fix -Wundef warnings due to use of unguarded HAVE_GCC_ATOMICS
* Fix -Wundef warnings due to use of unguarded HAVE_GCC_SYNC_LOCK_TEST_AND_SET
* Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_JACK
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_LINUX
* Fix -Wundef warnings due to use of unguarded HAVE_LIBC
* Fix -Wundef warnings due to disabling SDL_LIBC
* Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND
* Fix -Wundef warnings due to use of unguarded DEBUG
* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H
* Fix -Werror=unused-variable when building with SDL_LIBC=OFF
* Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV
* Use SDL alloc functions in libusb/hid.c
* Fix -Wundef warnings due to use of unguarded HAVE_LIBUDEV_H
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_OFFSCREEN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_GLX
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL_ES2
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OSS
* Remove SDL_AUDIO_DRIVER_SUNAUDIO reference since it is never set
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PIPEWIRE
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PULSEAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XCURSOR
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XDBE
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XFIXES
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XINPUT2
* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XRANDR
* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XSHAPE
* Don't call XShape functions when XShape is diabled
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND
* Fix -Wundef warnings due to use of unuarded SDL_VIDEO_DRIVER_X11
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL
* Disable array when compiled with SDL_EVENTS=OFF
* Fix -Wundef warnings due to use of unguarded SDL_INPUT_LINUXEV
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_WINDOWS
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PS2
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PSP
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_VITA
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_N3DS
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_STDCPP
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_NGAGE
* Fix -Wundef warnings due to use of unguarded __WINDOWS__
* Fix -Wundef warnings due to use of unguarded __WINGDK__
* Fix -Wundef warnings due to use of unguarded __ANDROID__
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_GENERIC_COND_SUFFIX
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PIB
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR
* Fix -Wundef warnings due to use of unguarded SDL_FILE_DISABLED
* Fix -Wundef warnings due to use of unguarded __XBOXONE__
* Fix -Wundef warnings due to use of unguarded __XBOXSERIES__
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_WGL
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_QNX
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_QNX
* Fix -Wundef warnings due to use of unguarded DEBUG_RAZOR
* Fix -Wundef warnings due to use of unguarded WINAPI_FAMILY_PHONE_APP
* Fix -Wundef warnings due to use of unguarded SDL_MAC_NO_SANDBOX
* Fix -Wundef warnings due to use of unguarded __(IPHONE|APPLETV|MAC)_OS_VERSION_MAX_ALLOWED
* Fix C4090 warning ('function': different 'const' qualifiers)
* ci: use -isystem for include dirs of pspdev toolchain
* cmake: add -Wundef option
* Fix remaining -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN and SDL_VIDEO_METAL
* Fix -Wundef warnings due to use of unguarded __MACOS__
* DEBUG_CONVERT is guaranteed to be defined in src/audio/SDL_audiocvt.c
* Fix -Wundef warnings due to use of unguarded HAVE_NANOSLEEP
* Fix -Wundef warnings due to use of unguarded HAVE_DXGI_H
* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H
* fix SDL_VIDEO_DRIVER_WAYLAND
* fix SDL_VIDEO_DRIVER_X11
* Fix -Wundef warnings due to use of unguarded HAVE_MMDEVICEAPI_H
* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SETNAME_NP
* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SET_NAME_NP
* Fix -Wundef warnings due to use of unguarded HAVE_SETJMP
* Fix -Wundef warnings due to use of unguarded HAVE_SIGNAL_H
* Fix -Wundef warnings due to use of unguarded HAVE_TPCSHRD_H
* Fix -Wundef warnings due to use of unguarded MACOSX_COREAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DINPUT
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_IOKIT
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_XINPUT
* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_KEYBOARD
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_RAWINPUT
* Fix -Wundef warnings due to use of unguarded SDL_POWER_ANDROID
* Fix -Wundef warnings due to use of unguarded SDL_POWER_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_POWER_HAIKU
* Fix -Wundef warnings due to use of unguarded SDL_POWER_LINUX
* Fix -Wundef warnings due to use of unguarded SDL_POWER_MACOSX
* Fix -Wundef warnings due to use of unguarded SDL_POWER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_POWER_UIKIT
* Fix -Wundef warnings due to use of unguarded SDL_POWER_VITA
* Fix -Wundef warnings due to use of unguarded SDL_POWER_WINDOWS
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE_VDK
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_CGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL
* Fix -Wundef warnings due to use of unguarded __MACOS__
* Fix -Wundef warnings due to use of unguarded __OpenBSD__
* Fix -Wundef warnings due to use of unguarded __FreeBSD__
* Fix -Wundef warnings due to use of unguarded __MWERKS__
* Fix -Wundef warnings due to use of unguarded __WIN32__
* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_LAUNCHSCREEN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2
* Remove unused HAVE_CONST, HAVE_INLINE and HAVE_VOLATILE
* Revert "Use SDL alloc functions in libusb/hid.c"
This reverts commit 847c64b00da12ca08bef9e947eb948e378eeaef8.
* Handle FAKE_RECURSIVE_MUTEX in similar way as SDL2
* Don't use defined in macro
Right click to create new popup menus. Clicking over an existing popup menu will create a child menu. Left click to close all menus. Hover to display a tooltip that is the child of the window below it. Closing the application closes the root window, which should automatically destroy any open popup windows and exit gracefully.
- Revert resampler workaround
- Avoids precision loss caused by large floating point numbers
- Adds unit test to test the signal-to-noise ratio and maximum error of resampler
- Code cleanup
This function wasn't consistently correct across platforms and devices.
If you want the UI scale factor, you can use display_scale in the structure returned by SDL_GetDesktopDisplayMode(). If you need an approximate DPI, you can multiply this value times 160 on iPhone and Android, and 96 on other platforms.
This fixes rounding errors with coordinate scaling and gives more flexibility in the presentation, as well as making it easy to maintain device independent resolution as windows move between different pixel density displays.
By default when a renderer is created, it will match the window size so window coordinates and render coordinates are 1-1.
Mouse and touch events are no longer filtered to change their coordinates, instead you can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into the rendering viewport.
SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been renamed SDL_RenderCoordinatesFromWindow() and SDL_RenderCoordinatesToWindow() and take floating point coordinates in both directions.
The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
Rather than iterating over display modes using an index, there is a new function SDL_GetFullscreenDisplayModes() to get the list of available fullscreen modes on a display.
{
SDL_DisplayID display = SDL_GetPrimaryDisplay();
int num_modes = 0;
SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
if (modes) {
for (i = 0; i < num_modes; ++i) {
SDL_DisplayMode *mode = modes[i];
SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gHz, %d%% scale\n",
display, i, mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f));
}
SDL_free(modes);
}
}
SDL_GetDesktopDisplayMode() and SDL_GetCurrentDisplayMode() return pointers to display modes rather than filling in application memory.
Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFullscreenMode(). The fullscreen mode for a window can be queried with SDL_GetWindowFullscreenMode(), which returns a pointer to the mode, or NULL if the window will be fullscreen desktop. SDL_SetWindowFullscreen() just takes a boolean value, setting the correct fullscreen state based on the selected mode.
SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
* SDL 3.0 is going to be high DPI aware and officially separates screen coordinates from client pixel area
The public APIs to disable high DPI support have been removed
Work in progress on https://github.com/libsdl-org/SDL/issues/7134