Commit Graph

7758 Commits (d4519aafd3d1f3f54cef62ba09c016e6f913a772)

Author SHA1 Message Date
Sam Lantinga af45ae7296 Update the SDL HIDAPI API to match upstream hidapi 0.14.0 2023-05-26 08:19:04 -07:00
Sam Lantinga 003a9b9666 Added interface_class, interface_subclass, and interface_protocol to USB device info
Currently only filled in for libusb
2023-05-26 08:19:04 -07:00
Sam Lantinga 55ed69fc9a Fixed building SDL_hidapi.c with new hidapi 2023-05-26 08:19:04 -07:00
Sam Lantinga 651d9c4a6e Fixed compiling hidapi in SDL build environment 2023-05-26 08:19:04 -07:00
Sam Lantinga 2004304348 Directly include hidapi.h bundled with the hidapi source code 2023-05-26 08:19:04 -07:00
Sam Lantinga 3b7b8f3c09 Updated hidapi to 0.14.0 release
Upstream: https://github.com/libusb/hidapi/releases/tag/hidapi-0.14.0
2023-05-26 08:19:04 -07:00
Sam Lantinga b252ecec6d Fixed crash if trying to dump a packet larger than USB_PACKET_LENGTH 2023-05-26 08:19:04 -07:00
Sam Lantinga 2bf6a7c6af Fixed build warning on Xcode 14.3 2023-05-26 08:19:04 -07:00
Sam Lantinga b0d52f11f4 Added udev_device_get_syspath() to udev context 2023-05-26 08:19:04 -07:00
Sam Lantinga c9d8a04945 Added SDL_swprintf() and SDL_vswprintf() 2023-05-26 08:19:04 -07:00
Sam Lantinga 6c28546828 Added SDL_wcstol() 2023-05-26 08:19:04 -07:00
Ryan C. Gordon 35292d7dba pulseaudio: Redesigned to use pa_threaded_mainloop.
We weren't meant to have multiple contexts and mainloops, but we had one
for each opened device and the hotplug detection thread. Instead, use
pa_threaded_mainloop, which can be shared between threads and objects, and
a single context (which, according to the PulseAudio documentation, is
usually meant to be a singleton that represents a global server connection,
possibly with multiple streams hung on it).

Now instead of polling in a loop, threads will block until the
threaded_mainloop runs a callback, and the callback will fire a signal to
unblock the thread.

Prior to this, the code upset ThreadSanitizer, as Pulse has some unprotected
global resource that each mainloop/context would touch.

Reference Issue #7427.
2023-05-26 09:07:33 -04:00
Ryan C. Gordon 81fe505c31 audio: remove is_in_audio_device_thread()
SDL mutexes are always recursive in modern times, so no need to check this,
plus the test triggers a false-positive on ThreadSanitizer.

Reference Issue #7427.
2023-05-26 09:07:33 -04:00
Ryan C. Gordon d4bc393efe
video: Only specify some GL context attributes if not the explicit default.
Just in case it upsets some OpenGL drivers unnecessarily.

Fixes #7730.
2023-05-25 10:04:44 -04:00
David Edmundson a6bb00f399 x11: Use XResources font DPI as a fallback for X11 content scale
There are many toolkit specific ways to set a font DPI in X11 desktop
environments. The primary approach of reading a Gnome specific setting
from the portal is ok, it will work on Gnome and on Plasma most the
time.

The current fallback GDK_SCALE is less great; it's an internal GTK
setting relating to the mapping of logical pixels to device pixels
within the toolkit, it's a developer setting for GTK devs. We were
instructed within Plasma to not set this as it caused issues.

Xft.dpi in xresources is a good universal fallback, it's very dated to
the point that it works in clients like xterm, Qt on X11 uses it in our
font DPI path.
2023-05-24 13:58:42 -07:00
Sam Lantinga a9c988b2a9 Fixed building on 32-bit Linux 2023-05-23 14:36:25 -07:00
Sam Lantinga 06d5989157 Fixed crash if video isn't initialized in SDL_CreatePopupWindow() 2023-05-23 13:41:34 -07:00
Sam Lantinga e92e4d8b50 Save waitable timers in thread local storage instead of continuously allocating and freeing them
Fixes https://github.com/libsdl-org/SDL/issues/6597
2023-05-23 11:32:40 -07:00
Sam Lantinga ddbdd73258 Updated source to match SDL function prototype style 2023-05-23 11:29:41 -07:00
Sam Lantinga 737aa881fa Updated source to match SDL function prototype style 2023-05-23 09:37:07 -07:00
Linus Probert da3fefc65c x11: Adds support for generic clipboard data in X11
Re-writes clipboard data handling in X11 to an on demand approach where
data can be produced on request instead of storing it in X11 properties
on the window.
Primary selection has been changed to mimic this behavior even though
it's only possible to use it for text as of now.
2023-05-23 08:51:56 -07:00
Sam Lantinga 61ef4efdfa Fixed duplicate Joy-Con controllers on macOS
If both Apple and HIDAPI drivers see the controller, HIDAPI will be preferred.

Fixes https://github.com/libsdl-org/SDL/issues/7479
2023-05-22 13:54:15 -07:00
Sam Lantinga cf0abf9911 Fixed handling the Saitek P3600, which doesn't use the Xbox 360 controller protocol 2023-05-22 12:41:03 -07:00
Frank Praznik 1cadf4bab9 wayland: Validate surfaces and window data before sending touch events
Ensure that incoming touch events originate from valid surfaces owned by SDL and have proper window data before forwarding them to the touch subsystem, or the window focus pointer that is sent with the event may not be a pointer to an SDL window.

Additionally, ensure that allocated touch events are always cleaned up on exit.
2023-05-22 14:40:09 -04:00
Sam Lantinga 4dd9f61bfd Don't map the top keyboard row to numbers when using the one-handed DVORAK layouts (thanks @tormol!)
Fixes https://github.com/libsdl-org/SDL/pull/5127

(cherry picked from commit a2f4783e753e499c7f6660bf34e337618239a72f)
2023-05-22 11:33:47 -07:00
Caleb Cornett 376a3cd100 Fix Xbox link error from IsRectEmpty 2023-05-21 19:09:28 -07:00
Sam Lantinga d7a56b93d5 Revert "Popups don't accept first focus clicks"
This reverts commit 9d40d619709ce830372835ca29f516b73a685317.
2023-05-21 08:18:46 -07:00
Sam Lantinga e1a28bc16f Popups don't accept first focus clicks
I'm not sure if this is is what we want, but it matches Windows behavior
2023-05-21 08:17:42 -07:00
M. P. Halpin bbf38bbbc3 Stop beep when running iOS apps on ARM-based Macs 2023-05-20 11:20:38 -07:00
Sam Lantinga a6a222095e Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
Fixes https://github.com/libsdl-org/SDL/issues/7160
2023-05-20 11:14:34 -07:00
Sam Lantinga f005106d1b Make sure the sentinel is at the end of the current event pump cycle
If we're waiting, it's possible to not get any events, then add the sentinel, then pump again and then add another sentinel. We want to make sure we only have one sentinel and that it's at the end of the currently pumped events.

Testing:
* Verified test case in https://github.com/libsdl-org/SDL/issues/6539
* Verified test case in https://github.com/libsdl-org/SDL/issues/5350

Fixes https://github.com/libsdl-org/SDL/issues/6539

(cherry picked from commit 00b87f1ded0a4fdb6a0bab611171f37eeb0b2ebb)
2023-05-20 10:37:40 -07:00
Sam Lantinga 1a3b713524 Added support for the PowerA MOGA XP-Ultra Controller 2023-05-19 14:39:30 -07:00
Sam Lantinga 517a2afcbd Added support for the PowerA MOGA XP-Ultra Controller 2023-05-19 14:38:50 -07:00
Sam Lantinga f60622c510 Undo name change for the controller list 2023-05-19 14:26:37 -07:00
Sam Lantinga 24007b00b2 Moved the controller list out so it can be included elsewhere 2023-05-19 14:22:35 -07:00
Sam Lantinga 4e9cfad558 Cache window manipulation calls while an SDL_Window is hidden and replay them when the window is set visible
- SDL_MaximizeWindow, MinimizeWindow, SetFullScreenWindow, etc are not meant to show the window if it isn't currently visible, but on some platforms
  (e.g. Windows) it isn't possible to set this state without also showing the window so cache the flags in a pending_flags field until SDL_ShowWindow is
  called. Then replay the pending flags through ApplyPendingFlags (hoisted out from SDL_FinishWindowCreation).
2023-05-19 10:23:16 -07:00
Ozkan Sezer 5c019bc97e style fixes for SDL_PROC macros. 2023-05-19 14:10:02 +03:00
Frank Praznik d5f07730be x11: Dynamically update the scale factor
If the text-scaling-factor setting is available via D-Bus, add a listener and update the content scale values for the displays if the value is changed during runtime.

Factors out the D-Bus message pump from the system theme detection code to the general D-Bus code, as it's now used for more purposes than just the system theme.
2023-05-18 16:16:00 -07:00
Sam Lantinga 068d3da366 Fixed window and backbuffer size on Android 2023-05-18 16:11:57 -07:00
Sam Lantinga a66cad79c1 SDL_GetClosestFullscreenDisplayMode() now takes a boolean whether to include high density modes
Also changed the match to prioritize resolution over refresh rate
2023-05-18 12:15:23 -07:00
Frank Praznik 32ab1183c7 x11: Expose the text/global scaling factor as the display content scale
Expose the text scaling factor (aka the global scale factor on KDE) as the display content scale value so applications can scale themselves as necessary.

If D-Bus is unavailable or retrieving the setting fails, fall back to trying the legacy GDK_SCALE envvar before reverting to the default 1.0 value.
2023-05-18 14:34:25 -04:00
Sam Lantinga 87186a893c Integrate 8067023 and 8067041 to SDL3:
Change 8067023 by mikela:
	Add SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED to SDL_RaiseWindow

	- When set to false, this allows SDL_RaiseWindow to bring a chosen window to the top of the stack but not force input focus to it

Change 8067041 by mikela:
	Rename SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN to SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN
2023-05-18 09:21:29 -07:00
Sam Lantinga 887a1b5969 Print some newly added window flags 2023-05-18 07:33:49 -07:00
Sam Lantinga cc94f600fd Officially added the concept of window pixel density
The SDL_WINDOW_ALLOW_HIGHDPI flag has been renamed SDL_WINDOW_HIGH_PIXEL_DENSITY, and added the function SDL_GetWindowPixelDensity()
2023-05-17 17:54:03 -07:00
Sam Lantinga e708674416 Always expose the high density video modes in the mode list
The SDL_HINT_VIDEO_ENABLE_HIGH_PIXEL_DENSITY hint is going away, so this matches the macOS logic
2023-05-17 17:40:16 -07:00
Ryan C. Gordon 2e646c7141
audio: Load .WAV files with format->blockalign==0.
In theory this is illegal, but legit wavefiles in the field do it, and
it's easy to bump it to 1 for general purposes.

Formats with more specific alignment requirements already check for them
separately.

Fixes #7714.
2023-05-17 20:06:58 -04:00
Ryan C. Gordon d05639a626
dynapi: Accept a comma-separated list of libraries to attempt to load.
First one to load and have the necessary symbol is the one we accept,
if any. Once we accept one, we won't try loading others.

Fixes #7613.

(cherry picked from commit 32999798e0232cdeda777a32ce2fe6b78ec2bb4e)
2023-05-17 20:03:36 -04:00
Frank Praznik 68edc72ae8 wayland: Fixups for new DPI code
Add support for the pixel density hint and fix integer scaling to assume that exclusive fullscreen pixel density values are always 1.
2023-05-17 19:01:14 -04:00
Sam Lantinga a3ce0d03e3 Fixed building with older macOS SDK 2023-05-17 13:32:21 -07:00
Sam Lantinga 26e780bc9e Fixed warning "A function declaration without a prototype is deprecated in all versions of C" 2023-05-17 12:58:00 -07:00
Sam Lantinga c699f3d1d8 Updated SDL high DPI support
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
2023-05-17 12:58:00 -07:00
valid-ptr 0fbb9c779c SDL emscripten port: preventDefault should not be called on mousedown. Otherwise mouseup will not be fired outside iframe in Chrome-based browsers
(cherry picked from commit 424bc4bcf75cebc86b693b4b920ee686ce6550ea)
2023-05-17 12:35:02 -07:00
Ryan C. Gordon b5cd0749b2
blit: Add a case for 8-bit blits that sdl12-compat exposed.
sdl12-compat can get into a state where a color-keyed surface is
marked for blending, but wants to blend with full alpha (which
is the same as _not_ blending), so rather than fail to find a
blitter in that case, it just selects the colorkey blitter.

Reference https://github.com/libsdl-org/sdl12-compat/issues/233

(cherry picked from commit 0eea92c8fcc4b5c572a0dd9848ca8886978ee0a2)
2023-05-16 14:42:16 -04:00
Vid Tadel f94aa6208a Implement generic clipboard data on MacOS 2023-05-16 11:02:18 -07:00
Sam Lantinga 642504bc59 Check to make sure the Windows joystick device has buttons and axes
This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10
2023-05-15 21:43:55 -07:00
Sam Lantinga 4de7433a9e Use the term "points" instead of "screen coordinates"
It turns out that screen coordinates were confusing people, thinking that meant pixels, when instead they are virtual coordinates; device independent units defined as pixels scaled by the display scale. We'll use the term "points" for this going forward, to reduce confusion.
2023-05-15 11:20:38 -07:00
Ryan C. Gordon 9facc86b6a
audio: more AudioStream allocation work.
This was only including the resampling buffer needs if it was larger
the other allocation needs, but it needs to be included unconditionally.

For safety's sake, we also make sure the pre-resample buffer doesn't risk
overflow, too, but this might not be necessary in practice.
2023-05-12 21:35:23 -04:00
Sam Lantinga e596dd8dad Fixed crash creating a window with the Vivante video driver 2023-05-12 16:24:13 -07:00
Linus Probert 19adfa3ad9 wayland: Add support for images in clipboard.
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.
2023-05-12 07:54:56 -07:00
Sylvain dfd80f3d76 Android: control activity re-creation 2023-05-12 07:48:33 -07:00
Sam Lantinga 2e6c48dcb4 Added support for the GameSir-G7 Controller for Xbox 2023-05-11 17:44:56 -07:00
Ryan C. Gordon 80a8691098
audio: Fixed buffer overflow in SDL_AudioStream resampling. 2023-05-11 16:25:20 -04:00
Ryan C. Gordon 9bf0934877
audio: SDL_memcpy() params were backwards. :O 2023-05-11 15:13:11 -04:00
Sam Lantinga d98bd67733 Fixed lockup while waiting for events 2023-05-10 17:35:13 -07:00
Sylvain 6d9ccbb3c7 Android: use the headers to have the audio pause/resume definitions
and make SDL_PriveAudioData more private
2023-05-10 09:34:53 +02:00
Sam Lantinga 28f891ad0a Allow the application to send rumble packets to Nintendo Switch controllers 2023-05-09 17:08:47 -07:00
Frank Praznik 785b7c6636 wayland: Implement global mouse coordinate emulation
Wayland doesn't support getting the true global cursor position, but it can be faked well enough for what most applications use it for: querying the global cursor coordinates and transforming them to the window-relative coordinates manually.

The global position is derived by taking the cursor position relative to the toplevel window, and offsetting it by the origin of the output the window is currently considered to be on. The cursor position and button state when the cursor is outside an application window are unknown, but this gives 'correct' coordinates when the window has focus, which is good enough for most applications.
2023-05-09 14:17:18 -07:00
Ryan C. Gordon 7b6dabd81f
audio: AudioStreams shouldn't overflow output buffers.
Before, as ConvertAudio might have expanded data in-place temporarily during
its work, this could blow up. Now if there's a chance of that, it'll
work out of an internal buffer and copy the final results to the output
buffer.

If the output format can handle the temporary expansion, we write directly
to the output buffer without the extra copy.

Fixes #7668.
2023-05-09 14:19:16 -04:00
Sylvain 04e17d4e46 Remove _THIS in src/audio/ 2023-05-09 11:29:33 -04:00
Sylvain 81ff49f4b5 Remove _THIS in src/video and in src/events (also VideoDevice) 2023-05-09 11:29:33 -04:00
Sylvain df314ba93e Remove _THIS in src/core: EVDEV UDEV 2023-05-09 11:29:33 -04:00
Ryan C. Gordon 0e1669e296
audio: Fixed audiostreams converting incorrect channel counts. 2023-05-09 10:58:32 -04:00
Ryan C. Gordon 7f219aa369
audio: Make sure AudioStream's internal buffers are large enough.
It needs to deal with ConvertAudio growing buffers in-place, as it might
convert smaller types to float as an intermediate step.
2023-05-09 10:57:23 -04:00
Ryan C. Gordon c7629704b4
audio: SDL_ConvertAudioSamples shouldn't calculate its output buffer size.
Just use what the AudioStream calculates instead.
2023-05-09 10:56:34 -04:00
Ryan C. Gordon a88aeb2a8a coreaudio: Flush/stop the AudioQueue before disposing of it.
Otherwise, a CoreAudio thread lingers forever, and coreaudiod eats CPU
until the SDL process terminates.

Fixes #7689.

(cherry picked from commit 86786ed5447fe32ea2e48f12f0598816a76721c2)
2023-05-08 14:26:34 -04:00
Semphris 7f2ef4d02f Implement SDL_GetPath stub for all OSes 2023-05-08 09:36:39 -07:00
Ozkan Sezer ef2ad2b0c6 windows/SDL_sysfilesystem.c: fix SHGetKnownFolderPath calling convention 2023-05-08 11:55:32 +03:00
Frank Praznik b92eaddbbd wayland: Fix the corner case when positioning popups
If the popup is positioned such that it requires correction on both the x and y axes, it will be aligned with parent only at the window corners, which is neither overlapping nor adjacent. In this case, nudge the window plus or minus one screen unit on the x axis so it is properly adjacent to the parent and within spec guidelines.
2023-05-06 12:35:47 -04:00
Sam Lantinga b6df25c334 Removed redundant __powerpc__ check 2023-05-06 08:44:19 -07:00
Jeremy Rand 9142292f4a SDL_blit_N.c: Move ppc64le swizzle outside of loop
An in-place swizzle mutation was erroneously inside of a loop, which
caused each consecutive 4-pixel vector to alternate between correct and
incorrect endianness.

The bug was introduced in 715e070d29.

Thanks to RobbieAB for reporting the bug.

Fixes https://github.com/libsdl-org/SDL/issues/3428
2023-05-06 11:05:48 -04:00
Ozkan Sezer 26903f237f windows/SDL_sysfilesystem.c: replace KNOWNFOLDERID type usage with GUID 2023-05-06 01:10:02 +03:00
Frank Praznik 1bf5a78b53 wayland: Don't print an error when moving a hidden popup window
Repositioning a hidden popup window is valid behavior, so don't print an error message in this case.
2023-05-05 14:05:34 -04:00
Frank Praznik 27085df50d wayland: Remove redundant window geometry configuration
The window geometry will be updated when in underlying shell surface config handler, before the config is ack-ed, so no need to do it in the popup config handler.
2023-05-05 13:54:10 -04:00
Frank Praznik eb6837e353 wayland: Validate and trigger the repositioning of popups in more cases
Validate and reposition popups in any case where the position or size may have changed. In particular, this fixes cases where the position parameters were adjusted while the window was hidden, as the new values weren't being applied in all cases.
2023-05-05 13:54:10 -04:00
Frank Praznik 17fba24e21 wayland: Adjust overlap required for popups to be considered adjacent
Popups beyond the right and bottom borders of the window must be width/height minus one in order to be considered adjacent and not be instantly closed or cause a protocol error.
2023-05-05 13:54:10 -04:00
Anonymous Maarten c810e5f63d video: set error code when SetWindowPosition fails 2023-05-05 17:50:32 +02:00
Ozkan Sezer 52c19bd21b attempt to fix more build failures against older Win32 SDKs. 2023-05-05 03:33:10 +03:00
Ozkan Sezer d7f1719777 fixed -Wundef warning due to HAVE_MMDEVICEAPI_H 2023-05-05 03:32:56 +03:00
Sam Lantinga 450c947949 Actually define the folder GUIDs 2023-05-04 16:39:16 -07:00
Sam Lantinga e0e95b1ea9 Fixed coding style and building on older Windows SDKs 2023-05-04 16:28:16 -07:00
Sam Lantinga 9b87de258f Fixed crash in new audio channel conversion code
Each loop needs to be run num_frames times, and the source and destination pointers are incremented by the number of channels during the conversion.
2023-05-04 15:50:38 -07:00
Semphriss c1dab7745a
Add SDL_GetPath() for default OS folders (#7665) 2023-05-04 11:38:11 -07:00
Ryan C. Gordon e191bc8491 audio: Simplified GetFirstAudioFormat/GetNextAudioFormat.
Now it just returns an iterable array and needs no global state.
2023-05-03 22:37:23 -04:00
Sam Lantinga b6ca360228 Added support for the Saitek Cyborg V.3 Rumble Pad in PS3 mode 2023-05-03 09:47:16 -07:00
Sam Lantinga 3f0c2a6694 Don't set the display scale if DPI scaling isn't enabled
In this case we want the display mode pixel to screen coordinates to be 1:1 ... but we lose information about the UI scaling of the display - is that okay?
2023-05-03 09:47:13 -07:00
Brick 86b5f40b53 Fixed CalculateAudioStreamWorkBufSize 2023-05-02 11:16:20 -04:00
Brick 079ae065f1 Added SDL prefix AUDIO_* constants 2023-05-02 08:09:06 -07:00
Brick 1ee2832326 Fixed SDL_ConvertMonoToStereo_SSE reading out of bounds 2023-04-30 13:14:20 -04:00
Sam Lantinga 255c3b7c82 By default, OpenBSD uses Linux controller mappings
Fixes https://github.com/libsdl-org/SDL/issues/7609
2023-04-29 17:09:17 -07:00
Sam Lantinga 0d559b7cb3 Fixed parsing SDL_mutex.h 2023-04-29 10:14:03 -07:00
Frank Praznik bee6099372 events: Emit an event when a window is destroyed
As child windows can be recursively destroyed when their parents are destroyed, emit an event to notify the application when a window is being or has been implicitly destroyed so that it can appropriately clean up any associated resources.

If the application has registered an event watch, the destroy message will be received when the window handle is still valid, so the application can retrieve and release any userdata associated with the window. If the message is processed at any time after that, the window handle is already invalid and the ID is only useful for application-side bookkeeping purposes.
2023-04-28 15:09:47 -04:00
Sam Lantinga 87ad71f9b2 Rename SDL mutex, semaphore and condition variable types to match SDL 3.0 naming convention 2023-04-28 12:08:33 -07:00
Sam Lantinga 61c0c009ab Rename SDL semaphore and condition variable functions to match SDL 3.0 naming convention
Fixes https://github.com/libsdl-org/SDL/issues/7642
2023-04-28 12:08:33 -07:00
Ryan C. Gordon e474047ff8 rwlock: Added SDL_rwlock API for shared locks. 2023-04-27 21:54:02 -04:00
Ryan C. Gordon 776820526b windows: Use InitializeSRWLock explicitly.
The docs say you should, if not statically initializing an SRWLOCK--which
we aren't--but in practice this is probably just being pedantic.

Still, better (thread) safe than sorry!
2023-04-27 21:54:02 -04:00
Ryan C. Gordon 70a501d8ec winrt: Don't reference generic Condition Variables at all.
It always has the SRWLOCK implementation available to it, so let the
linker throw away the generic version if possible.
2023-04-27 21:54:02 -04:00
Sam Lantinga a4b4dff4a2 Added support for the Astro C40 in Xbox 360 mode 2023-04-27 17:10:44 -07:00
Ryan C. Gordon e5a6c24c82 audio: Redesigned audio conversion code for SDL3.
- 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!
2023-04-27 18:35:15 -04:00
Sam Lantinga 44bec9c01c Fixed build 2023-04-27 13:06:21 -07:00
Sam Lantinga c10849b40b Added support for new Xbox Elite 2 firmware 2023-04-27 12:33:33 -07:00
Sam Lantinga eaf17050b4 Allow popup windows to be raised through SDL_RaiseWindow
- This allows specific child popup windows to be activated explicitly.
2023-04-26 16:31:18 -07:00
Linus Probert 43f65a6ef0 wayland: Fixes a memory leak wheere primary selection isn't freed 2023-04-24 11:59:39 -07:00
Ozkan Sezer ae9119c36b hidapi/mac: replace sprintf uses with snprintf.
Reference issues:
-  https://github.com/libusb/hidapi/pull/509
-  https://github.com/libusb/hidapi/pull/511
2023-04-24 10:46:05 -07:00
Ozkan Sezer 62d1a2c836 hidapi/mac: import mainstream commit c1b9d2ad
c1b9d2ad98
Properly handle the close of run loop on macOS
(https://github.com/libusb/hidapi/pull/522)
- as per documentation `kCFRunLoopRunStopped` should be handled once the runloop is closed via `CFRunLoopStop`;
- if it is not handled - a race condition/crash may happen on the latest macOS when a device gets disconnected while being open;
2023-04-24 10:46:05 -07:00
Mingjie Shen ac607c1088 SDL_ConvertSurface(): add null pointer check
Check return values of SDL_CreateSurface()
and SDL_ConvertSurface().
2023-04-23 17:43:10 -07:00
Mingjie Shen bf8c9d2d70 Check return value of VIRTUAL_HWDataForIndex() 2023-04-23 17:40:15 -07:00
Mingjie Shen a4604cb0d6 Check return value of SDL_malloc() 2023-04-23 08:57:12 -04:00
Frank Praznik f431037f62 wayland: Insert new displays at the end of the output list
Insert new displays at the end of the list instead of the front so that the initial ordering, as exposed by the compositor, is preserved. This is particularly important when the compositor exposes the xdg-output instance after the wl_output instance, as xdg-output must be attached to the outputs in the same order that wl_output exposed them, or they can be added to the SDL output list in reverse order.
2023-04-21 12:59:36 -04:00
Sam Lantinga 0467301baf Report PS3 accelerometer values in m/s2 instead of Gs 2023-04-19 13:10:39 -07:00
Sylvain 9d18b4b5ed Android: fix crash when AAUDIO isn't used (bug #7620) 2023-04-18 21:34:18 +02:00
Frank Praznik bad4f4e5ac wayland: Destroy proxy wrappers before and callbacks before event queues
Destroy any proxy wrappers and callbacks before the associated event queues to silence libwayland warnings about destroying the queues while proxies are still attached.
2023-04-18 14:37:16 -04:00
Sylvain 7afe735b5f SDL_test: add more color when success/fail/skip 2023-04-14 12:12:45 +02:00
Sylvain 117169d610 Android AAUDIO: handle multiple devices 2023-04-14 11:31:47 +02:00
Ozkan Sezer c41a76657e SDL_timer.c: silence a minor warning. 2023-04-12 12:55:40 +03:00
Sylvain ec053ec4f8 Android: need to save/restore the swap interval / vsync
otherwise, there is a difference of framerate, either with gles2 or SDL_renderer (testspriteminimal, testgles2).
2023-04-12 11:09:59 +02:00
Frank Praznik 8162d6659a wayland: Use the integer buffer scale event when applicable
wl_compositor v6 introduces the preferred buffer scale event, which serves a similar function to the fractional scale protocol, but deals in integer scale factors. Listen to this event when the wl_compositor version is >= 6 and the fractional scale protocol is not present to set the scale factor for surfaces.
2023-04-10 10:16:33 -04:00
Sam Lantinga 05b701f12e Fix win32 windows with WS_EX_COMPOSITED style continuing to receive WM_PAINT messages after ValidateRect
- Composited windows seem to need to actually paint (or appear to paint) through calls to Begin/EndPaint to properly validate
  their update region. If not done they will continue to receive WM_PAINT messages for the same region.
2023-04-07 06:20:28 -07:00
Sam Lantinga 17bdea7a91 Fix pop-up windows changing position for each HideWindow()/ShowWindow() cycle
When X11_UpdateWindowPosition() was called and the position didn't update
we would fire an SDL_EVENT_WINDOW_MOVED event with the global x,y for
the pop-up instead of the relative position for the pop-up.

This change ensures we always have a relative position for pop-ups before sending
the SDL_EVENT_WINDOW_MOVED event.
2023-04-06 15:12:09 -07:00
Sam Lantinga 92821f7a82 Fixed Visual Studio warning 4389: '==': signed/unsigned mismatch 2023-04-06 15:11:56 -07:00
Sam Lantinga acadb6f873 More defensive coding against dangling device pointers 2023-04-06 11:33:27 -07:00
Sam Lantinga 558bbbb07a The latest Armor-X Pro firmware update fixes the sign on the Z axis of the sensors 2023-04-06 09:55:01 -07:00
Sylvain 3c703f2061 Android: message to indicate that main() is called for the 1 or n'th time 2023-04-06 10:08:07 +02:00
Cyril Dubet 60dcaff7eb Fix key code names for ISO keyboard layouts 2023-04-05 17:03:05 -07:00
Sam Lantinga e13b74ccf0 Fixed crash if joystick->hwdata != NULL && device->driver == NULL
This should never happen, but we're seeing it in the wild, so make sure that we can never call into a NULL device driver.
2023-04-05 11:24:27 -07:00
Frank Praznik a21ee02095 wayland: Use the output description from wl_output as of v4
xdg-output names and descriptions are deprecated in favor of those provided by the core wl_output protocol as of v4. Bump wl_output support to v4 and ignore the xdg-output description in favor of the wl_output description when appropriate.
2023-04-05 10:24:23 -04:00
Frank Praznik 5c27bc81d8 wayland: Use release for display and seat objects, if available
wl_seat and wl_output gained release methods, which should be preferred over destroy methods if they are available.

Bumps wl_output to version 3.
2023-04-05 10:24:23 -04:00
Frank Praznik 9084b6c666 wayland: Remove some unused variables 2023-04-05 10:24:23 -04:00
Ethan Lee 3ac48053bc wayland: Minor whitespace cleanup
Co-authored-by: Frank Praznik <frank.praznik@gmail.com>
2023-04-05 08:58:12 -04:00
David Edmundson 0c551e7069 wayland: Support axis relative direction
This allows clients to be aware of "natural scrolling" settings in the
compostior and adjust accordingly to optionally keep the same wheel and
trackpad behaviour accross platforms.

Testing using the "testmouse" example, behaviour in the demo is now the
same regardless of the compositor setting for scrolling.
2023-04-05 08:58:12 -04:00
Anonymous Maarten ac72cdcf79 Fix -Wmissing-prototypes warning
./src/video/SDL_video.c:1734:13: warning: no previous prototype for function 'SDL_CreateWindowInternal' [-Wmissing-prototypes]
SDL_Window *SDL_CreateWindowInternal(const char *title, int x, int y, int w, int h, SDL_Window *parent, Uint32 flags)
            ^
./src/video/SDL_video.c:1734:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
SDL_Window *SDL_CreateWindowInternal(const char *title, int x, int y, int w, int h, SDL_Window *parent, Uint32 flags)
^
static
2023-04-05 05:39:48 +02:00
Sam Lantinga cf2c6fa58d Fixed crash if dbus can't be initialized 2023-04-04 12:34:00 -07:00
Sylvain 407b85c506 Android: audio change audio assert when try to open concurrent device to a real error 2023-04-04 09:43:01 +02:00
Frank Praznik a874f6c993 wayland: Send system timestamps for relative pointer events 2023-04-02 10:51:37 -04:00
Frank Praznik 1869e1247d wayland: Track the serial numbers for implicit grab events and use them when raising windows
Track the serial numbers of key events, mouse button presses, touch down events, tablet tool down events, and tablet button presses, and pass the serial, along with the seat, to the xdg-activation protocol when raising windows to increase the chances of it succeeding.
2023-04-02 10:51:37 -04:00
Frank Praznik 6119ac8bb4 wayland: Don't round trip when setting the initial minimized and maximized states during window creation
Don't perform a round trip when setting the minimized and maximized window states during initial window creation, as it will be done later in the window creation process.
2023-04-02 10:51:37 -04:00
Frank Praznik ab948123c2 wayland: Avoid recursive calls into fullscreen setting functions
When changing the fullscreen state and performing a roundtrip, more than one configure event can be sent before getting the event that changes the fullscreen state. Don't change the higher-level window state and avoid recursive calls back into the video system during these events.
2023-04-02 10:51:37 -04:00
Frank Praznik 1f177cf93e wayland: Refactor constraint handling
According to the xdg-shell spec, xdg-toplevel min/max values are just hints, which compositors are free to ignore, and they often do so in several cases (usually when tiling, maximizing, or entering fullscreen). Even with the hints set, manually constraining the surface dimensions for non-maximized, non-fullscreen surfaces is required for consistent behavior.

In the case of maximized windows, the dimensions as specified in the configure event are non-negotiable and must be respected by the client, as not doing so is a protocol violation.

This also eliminates some redundant calls to set the libdecor resizable state, which can cause unnecessary commits internally.
2023-04-02 10:51:37 -04:00
Sam Lantinga 2aa2fa5449 Added SDL_CreateWindowWithPosition()
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.
2023-03-31 17:21:44 -07:00
Anonymous Maarten b6ae281e97 Use #ifdef/#ifndef instead of #if defined/#if \!defined 2023-03-30 21:35:01 +00:00
Sam Lantinga 308bcbbe76 Fixed Visual Studio warning 4244 2023-03-30 14:04:32 -07:00
Sam Lantinga 85ee1498a5 Fixed Visual Studio warning 4245 2023-03-30 14:02:06 -07:00
Sam Lantinga f341c06552 Fixed Visual Studio warning 4310 2023-03-30 14:02:05 -07:00
Sam Lantinga 0bd77a5b93 Fixed Visual Studio warning 4389 2023-03-30 14:02:04 -07:00
Sam Lantinga d135daad5b Fixed Visual Studio warning 4459 2023-03-30 14:02:03 -07:00
Sam Lantinga b078122c53 Fixed Visual Studio warning 4701 2023-03-30 14:02:02 -07:00
Sam Lantinga 28d687aae0 Fixed Visual Studio warning 4702 2023-03-30 10:48:50 -07:00
Sam Lantinga e2f560d4bb Fixed build error
'__inline__' is not at beginning of declaration [-Werror=old-style-declaration]
2023-03-30 10:48:48 -07:00
Frank Praznik 1fd15c9b4e x11: Don't allow the changing of certain scancodes
The X11 driver uses scancodes derived from keysyms to map the scancodes for extended keys to the physical keyboard, however, this can be incorrect when using certain XKB options (e.g. caps:swapescape), which changes the keysyms emitted by certain keys, but does not imply that their scancodes or positions should be altered. Mark selected scancodes as being non-remappable so that their scancodes aren't changed by toggling XKB mapping options.
2023-03-30 11:25:23 -04:00
Sam Lantinga 655a07bdd8 Don't probe for PlayStation controllers when we already know the controller type
Fixes https://github.com/libsdl-org/SDL/issues/7556
2023-03-30 07:36:40 -07:00
Sam Lantinga a67d410501 Fixed analog triggers on the DualSense controller 2023-03-30 07:25:49 -07:00
Jérôme Duval 2d64f419c5
Haiku: use a BLooper for events, only create a BApplication when it doesn't already exist. (#7555) 2023-03-30 07:12:10 -07:00
Sylvain cae6b4489d - simplication and factorization around CalculateSize and Pitch, RGB/YUV
- update SDL_CalculateYUVSize pitch to size_t
2023-03-30 12:05:35 +02:00
Anonymous Maarten eed266d266 SDL_syshaptic.c and SDL_sysjoystick.c need string.h for strerror 2023-03-30 04:19:43 +02:00
Sam Lantinga c07e966690 Fixed build 2023-03-29 16:36:13 -07:00
Anonymous Maarten 3472dc11d6
Fix uses of undefined macro identifiers (-Wundef)
* 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
2023-03-29 21:49:01 +00:00
Sam Lantinga c3d3c2c672 Fixed crash if SDL_GetDisplays() is called before video is initialized 2023-03-29 14:44:03 -07:00
Sam Lantinga aec0cfe5ee Added !SDL_CPUINFO_DISABLED to #endif 2023-03-29 08:24:04 -07:00
Emily Banerjee 8973d20f39
Fixed audiotypecvt assertion when without CPUInfo (#7464) 2023-03-29 08:22:57 -07:00
Sam Lantinga f1099f8e70 The Xinmotek Controller is used in multiple products with different mappings
The mapping included here is for the Ultimate Atari Fight Stick
2023-03-28 15:14:00 -07:00
Sam Lantinga 8df7b4d853 Fixed gyro values for the Armor-X Pro controller 2023-03-28 14:44:28 -07:00
Sam Lantinga 37517557ae Fixed the accelerometer and gyro axes for the Armor-X Pro controller 2023-03-28 12:28:15 -07:00
Anonymous Maarten 0c3777d566 video: fix warnings about unused variables when building without duff's loop 2023-03-28 16:59:27 +00:00
Anonymous Maarten f7961b7c9a video/blit: fix -Wimplicit-fallthrough warnings 2023-03-28 16:59:27 +00:00
Sylvain c838ccf0e3 Safety fix: clear "_this->wakeup_window" when destroying the window 2023-03-28 08:28:31 -07:00
Sylvain 0c048d98af Safety fix: clear "_this->current_glwin" when destroying the window 2023-03-28 08:28:31 -07:00
Sylvain e494844e9a Fixed bug #7515 - Window still grabbed after destroying 2023-03-28 09:42:19 +02:00
Sylvain 1fe2110755 Don't clear checked_texture_framebuffer 2023-03-28 09:40:17 +02:00
Elad Lahav 2a03ad2cbf AUDIO_U16 support was removed from SDL3 2023-03-27 15:33:08 -07:00
Elad Lahav 5fee62d774 Rename files under src/video/qnx 2023-03-27 15:33:08 -07:00
Elad Lahav b4f28fb532 Define _LARGEFILE64_SOURCE as 1 for all platforms 2023-03-27 15:33:08 -07:00
Elad Lahav b98a501e0d glGetProcAddress() should return SDL_FunctionPointer 2023-03-27 15:33:08 -07:00
Elad Lahav b026f588d6 Update to use SDL_GetFirstAudioFormat() and SDL_GetNextAudioFormat() 2023-03-27 15:33:08 -07:00
Elad Lahav 49a8b16ffd Fix use of _LARGEFILE64_SOURCE 2023-03-27 15:33:08 -07:00
Elad Lahav 4374645738 Add QNX video and audio modules 2023-03-27 15:33:08 -07:00
Sam Lantinga 8029a767ee Fixed the accelerometer sensitivity for the Armor-X Pro controller 2023-03-27 14:27:22 -07:00
Sam Lantinga 3340864786 Increased precision for PS4 sensor data conversion 2023-03-27 14:21:05 -07:00
Pierre Wendling 975039ce0d SDL_hidapi_steam.c: Fix compilation under c2x.
When N2935 is implemented, the enum breaks compilation. Use a #define of
the SDL booleans instead.
2023-03-27 09:02:14 -07:00
Sylvain d3faec0b6e testcommon/automation: add [--audio driver] option
allow to use --audio --video --renderer for testautomation
2023-03-27 10:23:18 +02:00
Anonymous Maarten 9ada9daf51 SDL_blit_copy: Don't call potentially FPU using SDL_memcpy in SDL_memcpyMMX 2023-03-27 06:12:49 +00:00
Anonymous Maarten b0a5182e84 Sunset SDL_HasRDTSC 2023-03-27 06:12:49 +00:00
Anonymous Maarten 513025b182 Implement _intel_fast_(memcpy|memset)
The classic Intel compiler generates calls to these functions when
building the SDL library with SDL_LIBC=OFF.
2023-03-27 06:12:49 +00:00
Anonymous Maarten a06046c55c memset and memcpy are not intrinsic functions in new LLVM-based Intel compiler 2023-03-27 06:12:49 +00:00
Anonymous Maarten 09832c701c cpuinfo: use __cpuidex instead of __cpuid
The classic Intel Compiler does not clear the ecx register prior
to executing the cpuid opcode.
2023-03-27 06:12:49 +00:00
Frank Praznik 203a2a76fc events: Increase the size of the name buffer when logging events
Event names have grown in length and are occasionally truncated when being logged (e.g. SDL_EVENT_WINDOW_PIXEL_SIZE_CHA). Increase the event name buffer size to handle the longer names.
2023-03-26 13:01:26 -04:00
Frank Praznik 5a0095d373 video: Try to match the requested video mode when moving fullscreen windows
Try to match the requested video mode when a fullscreen window is moved to a new display, or it may not be returned to the requested mode if it is moved to a display with no matching mode, then back to the original display.
2023-03-26 12:50:32 -04:00
Sylvain f5dc1c0176 Add some color in testautomation logs! 2023-03-24 13:55:20 -07:00
Frank Praznik 11323abf57 wayland: Set the minimized flag on windows until cleared by a focus event
The behavior when minimizing a window on Wayland is compositor dependent and clients are not informed when windows enter or leave the minimized state, however we can assume that, when receiving a minimize request from the application, the minimized window should set and keep the minimized status flag until the window regains focus.

This is required when attaching a renderer context to a minimized window, as the renderer creation process destroys and recreates the target window, and without retaining the minimized flag, the recreated window will lose the minimized state.
2023-03-24 16:17:16 -04:00
Frank Praznik 6bb48b4fe9 wayland: Unref the libdecor window when hiding
Hiding the decorations while not unreferencing the frame was a workaround for an internal libdecor use-after-free bug that was fixed some time ago. Revert to unreferencing the window when hiding to ensure that it is properly destroyed.

Reverts dd2e318
2023-03-24 16:17:16 -04:00
Sam Lantinga 26f511a8f4 Add SWP_NOACTIVATE to SetWindowPos flags passed in WIN_SetWindowAlwaysOnTop 2023-03-24 10:39:56 -07:00
Sylvain 8d3d4e523e Fix sdltest_randomAsciiStringWithMaximumLength() where it requests a string a size 0
seen with: ./testautomation --seed MILAFAP2AKVP3V4G --filter sdltest_randomAsciiStringWithMaximumLength
2023-03-24 09:52:05 +01:00
Sylvain d4d26e0ddb testautomation_video: if SDL_SetWindowSize/Position isn't honored, we should check there is an event
x11: send the events if various occasions
2023-03-24 09:52:05 +01:00
Sylvain 4b1378fe8e X11: fix size/position (test video_setWindowCenteredOnDisplay)
this fix x11 backend to correctly pass video_setWindowCenteredOnDisplay()
- get border values early  (eg status bar)
- wait for size/position change to get valid values

Fix set topleft is client rendering area
2023-03-24 09:52:05 +01:00
Anonymous Maarten 749f3ebd14 Fix arguments of SDL_BlitCopyMMX 2023-03-24 02:18:06 +01:00
Ozkan Sezer 0ef85873a2 fixed uninitialized warnings from gcc7, gcc8, and gcc9. 2023-03-22 01:56:20 +03:00
Ozkan Sezer 2e4ce78b33 tidy-up SDL_yuv.c 2023-03-21 23:03:02 +03:00
Anonymous Maarten b5b9ddb205 SDL_intrin.h: define SDL_<simd>_INTRINSICS in user-visible header 2023-03-21 23:03:02 +03:00
Ozkan Sezer 41c693dc25 build fix for non-x86 targets. 2023-03-21 23:03:02 +03:00
Ozkan Sezer 79513afc19 build fixes to SDL_yuv.c 2023-03-21 23:03:02 +03:00
Ozkan Sezer 69de6964e5 use target attributes of gcc / clang for SIMD code. 2023-03-21 23:03:02 +03:00
Anonymous Maarten 773aad14f8 cmake: Fix building without libsamplerate library
On Fedora, the headers for 32-bit and 64-bit are shared.
When building a 32-bit library, CMake found the header (that was installed
for the 64-bit libsamplerate development package). Because no 32-bit libsamplerate
library was installed, linking failed. (SDL_LIBSAMPLERATE_DYNAMIC was set to FALSE
because CMake could not find a library)
2023-03-20 05:34:41 +01:00
Ivan Mogilko f360965db6 Fixed SDL_RenderSetVSync does not update flags if simulated vsync is on
This lets the user to correctly detect current vsync state by reading SDL_RendererInfo.
Also fixes SetVSync's return value check (it may be positive for error too).

(cherry picked from commit d78072fcd46943288a6007cd6f4ab1f98f446b1d)
2023-03-18 11:44:45 -07:00
Sam Lantinga 08d5c1386e Fixed always on top windows on Windows
Also cleaned up some SetWindowPos() calls and made it explicit when we change the topmost flag
2023-03-17 10:37:21 -07:00
Anonymous Maarten 774e51627e SDL_test: fix infinite loop when passing invalid argument 2023-03-17 17:54:16 +01:00
Anonymous Maarten c52ad54b05 SDL_test: don't parse audio/video arguments when its subsystem is not enabled 2023-03-17 17:54:16 +01:00
Anonymous Maarten c8d4ca35ad SDL_test: always print common log usage, even without audio/video backend 2023-03-17 17:54:16 +01:00
Anonymous Maarten 08c85ebae0 SDL_test: introduce SDLTest_CommonDestroyState to only destroy SDLTest_CommonState 2023-03-17 17:54:16 +01:00
Anonymous Maarten 5109e19935 SDL_test: remove unused BuildCommonUsageString 2023-03-17 17:54:16 +01:00
Anonymous Maarten 9451d3079d dynapi: SDL_DYNAPI_entry must be in version script
For SDL dynapi to work, the SDL_DYNAPI_entry symbol must be externally visible.
Adding __attribute__((visibility(default))) would not work
since version scripts override these.
2023-03-17 08:53:14 -07:00
Sam Lantinga e4be1247d0 Added a hint to retain window content during state changes
In my testing window content is always retained, but this makes our intent explicit.
2023-03-16 20:43:07 -07:00
Sam Lantinga ed0937598e Added gamepad mapping for Flydigi Vader 2 with the latest firmware (6.0.4.9) 2023-03-16 20:01:45 -07:00
Sam Lantinga a776188d77 Don't change the Z order when moving or resizing windows 2023-03-16 17:19:38 -07:00
Sam Lantinga 9ee71f0ddf Added --skip-taskbar and --always-on-top command line options 2023-03-16 16:58:01 -07:00
Sam Lantinga 3f67f02d0e Fixed SDL_WINDOW_SKIP_TASKBAR on Windows
The WS_EX_APPWINDOW forces a window onto the taskbar, which is not what we want. Set the style to 0 to use the default behavior.
2023-03-16 16:56:46 -07:00
Sam Lantinga c7ab378c61 We don't need to track whether we were hidden by parent focus change 2023-03-16 14:11:41 -07:00
Sam Lantinga 76176c9845 Conversely, we shouldn't automatically show children when we get focus 2023-03-16 14:09:46 -07:00
Sam Lantinga 0cb7c4ba58 Don't hide popups when losing focus
This isn't the behavior on Windows, and this should probably be an application defined behavior.

If we decide we want this globally, it should probably be implemented at a higher level in SDL_OnWindowFocusLost(), and properly handle the transition of focus to a child window.
2023-03-16 14:04:12 -07:00
Sylvain 5da9e99da0 Fixed bug #7462 - 8888 as default GL backbuffer red/green/blue/alpha bit sizes 2023-03-16 13:54:11 -07:00
Sylvain f9ac7b4044 Fixed bug #7467 - testautomation_audio currently fails because of invalid src/dst rate 2023-03-16 20:49:22 +01:00
Sylvain 899ee8f75a Change SDL_BLENDMODE_MUL for gl renderers
Add FIXME for PSP
2023-03-16 20:25:59 +01:00
Sylvain b95b203116 Refresh generation of SDL_blit_auto.c after simplifying sdlgenblit.pl 2023-03-16 20:25:59 +01:00
Sylvain 41b8fee833 Simplify SDL_BLENDMODE_MUL in sdlgenblit.pl 2023-03-16 20:25:59 +01:00
Sylvain 99668c286b Simplify SDL_BLENDMODE_MUL 2023-03-16 20:25:59 +01:00
Sylvain ad1a216d65 Refresh generation of SDL_blit_auto.c 2023-03-16 20:25:59 +01:00
Sam Lantinga 66eff69d2b Don't update hidden child windows, their relative position doesn't change
This improves performance when moving a top level window that has many hidden child windows
2023-03-16 11:24:21 -07:00
Frank Praznik a8ea8db6d7 wayland: Update the popup window geometry on configure events 2023-03-16 14:01:42 -04:00
Frank Praznik be70d9a9c7 wayland: Clarify the popup position restriction purpose
Child popups don't necessarily need to be within, but must intersect or be partially adjacent to the parent, per the xdg-positioner spec.
2023-03-16 14:01:42 -04:00
Frank Praznik c270d151b0 wayland: Handle cases where the compositor does not scale the monitor viewport in its compositing space
The xdg-output spec was updated to clarify its usage rules, and what was previously thought to be a bug is actually valid behavior. Gnome, when not using 'scale-monitor-framebuffer', does not scale the viewport of the display in the global compositor space, and thus the physical and logical sizes of the display will match. This value still needs to be divided by the integer scale value to get the logical output dimensions in screen units though.
2023-03-16 14:01:42 -04:00
Sam Lantinga 5dd317b869 Fixed position when setting WM hints on X11 popup windows 2023-03-15 20:23:03 -07:00
Sam Lantinga 422517c036 Allow passing 0 to SDL_SetWindowMinimumSize() and SDL_SetWindowMaximumSize() to indicate no limit 2023-03-15 16:13:56 -07:00
Anonymous Maarten d27db3defa cmake+video: always use altivec.h header for detection + introduce SDL_ENABLE_ALTIVEC 2023-03-15 14:54:20 +01:00
Anonymous Maarten 9cb5f0bfc6 video: fix ARM neon and simd 2023-03-15 14:54:20 +01:00
Anonymous Maarten ba5b1f2fd2 Fix build with -DX11MODES_DEBUG in CPPFLAGS 2023-03-15 14:54:20 +01:00
Anonymous Maarten d24ef0213b SDL_threadprio.c uses SCHED_RR and SCHED_FIFO from sched.h 2023-03-15 14:54:20 +01:00
Anonymous Maarten fc4085b54e cmake: Allow build system to disable arm neon intrinsics 2023-03-15 14:54:20 +01:00
Anonymous Maarten 46de6241d7 cmake: Allow build system to disable loongarch intrinsics 2023-03-15 14:54:20 +01:00
Anonymous Maarten 4681240241 cmake: Detect AVX + allow build system to disable Intel intrinsics 2023-03-15 14:54:20 +01:00
Sam Lantinga a17ad65f2b Revert "Popup window parent defaults to the first toplevel window"
This reverts commit e8e2c8175c.

Conceptually tooltips and context menus always have parent windows
2023-03-14 14:53:54 -07:00
Frank Praznik 969e0842e6 video: Preserve the flag to restore popup windows with the parent when recreating the window during renderer initialization 2023-03-14 16:37:09 -04:00
Sam Lantinga e8e2c8175c Popup window parent defaults to the first toplevel window 2023-03-14 11:42:58 -07:00
Sam Lantinga 3951cae4a5 Ignore the PS4 packet CRC if it's not being set correctly
This fixes handling the 8BitDo SN30 Pro with the 2.00 firmware in PS4 mode

Fixes https://github.com/libsdl-org/SDL/issues/7270
2023-03-13 19:58:35 -07:00
Sylvain 2cafa52598 - Added SDL_WINDOW_TRANSPARENT to request a window with transparent framebuffer
- Remove SDL_VIDEO_EGL_ALLOW_TRANSPARENCY hint, EGL now checks 'window->flags & SDL_WINDOW_TRANSPARENT'
2023-03-13 21:23:04 +01:00
Frank Praznik 4dededd345 wayland: Don't throttle presentation until the first swap has occurred
Don't throttle window updates until the first swap has occurred, as the window won't actually be shown or receive the frame callback until that point and this causes new window creation to have a full 1 second delay.
2023-03-13 15:36:55 -04:00
Sam Lantinga 4dd26698fc Added SDL_GetWindowParent() to get the parent of popup windows 2023-03-13 11:21:02 -07:00
Sam Lantinga ebe3a9dc44 Spacing cleanup 2023-03-13 11:21:02 -07:00
Frank Praznik 1f35fd6939 video: Update the popup window creation documentation and disallowed flags
Update the popup window creation documentation with additional info, remove the SDL_WINDOW_MOUSE_GRABBED flag check since it isn't a valid window creation flag and will be removed automatically elsewhere, and check for and remove the explicit skip taskbar and borderless flags since they are implicit for popup windows.
2023-03-13 13:56:01 -04:00
Frank Praznik f97b469184 video: Disallow additional operations on popups where appropriate
Disallow additional window operations on popups where they have no functionality or otherwise don't make sense:

- Popups cannot be set as modal to other windows (they're already child windows of a parent)
- Other windows cannot be set as modal of popups
- Popups cannot explicitly grab the mouse/keyboard (the topmost popup menu takes the keyboard focus implicitly)
- Popups cannot flash or be raised
2023-03-13 13:56:01 -04:00
Frank Praznik d5b5e524af wayland: Set the EGL swap timeout to one second from the current time
Set the timeout max to one second from the current time or presentation time will always be greater than the timeout and the application will run unthrottled.
2023-03-12 17:07:32 -04:00
David Carlier 3990c71726 SDL_GetBasePath simplification for Haiku.
when solely looking for the path for the current binary
in the current team, find_path is sufficient.
2023-03-12 08:29:42 -04:00
Sam Lantinga 67e2558310 Check tooltip and popup window flags during parameter validation 2023-03-11 12:44:57 -08:00
Rudolf Polzer de3909a190 Android: indicate gamepaddb entries where axis order changed.
Axis order was changed in 6f1f586086 to improve
default mappings.
2023-03-11 12:43:48 -08:00
Frank Praznik 3e28588bb6 wayland: Never use the cached size for maximized or tiled windows
Don't use the cached floating window size for maximized or tiled windows. Fixes the initial window size when creating a window with the maximized flag set.
2023-03-11 11:40:57 -05:00
Sam Lantinga f4c1260120 More changes to fix building with older macOS SDKs 2023-03-10 16:38:45 -08:00
Sam Lantinga c044cff4c7 Rewrite WIN_GetSystemTheme() so we don't need to bump Windows SDK versions 2023-03-10 16:29:42 -08:00
Sam Lantinga edc8f0b841 Fixed building on older macOS SDKs 2023-03-10 16:15:46 -08:00
Sam Lantinga ffe6e58c85 Fixed compiling with older Windows SDKs 2023-03-10 16:12:18 -08:00
Frank Praznik 98e864f286 win32: Implement popup windows 2023-03-10 15:51:13 -08:00
Frank Praznik 77dc1a929a cocoa: Implement popup windows 2023-03-10 15:51:13 -08:00
Frank Praznik f41d3933e6 X11: Implement popup windows 2023-03-10 15:51:13 -08:00
Frank Praznik 68d2d9f76d wayland: Implement popup windows 2023-03-10 15:51:13 -08:00
Frank Praznik e987c4a463 video: Add the concept of child popup windows
Add the CreatePopupWindow function to allow the creation of child tooltip and menu popup windows. Popup windows must be created as either a tooltip or popup menu and cannot be minimized, maximized, made fullscreen, or grab the mouse.

Child popup windows are tracked and will be recursively hidden, shown, or destroyed in tandem with the parent window.
2023-03-10 15:51:13 -08:00
Sam Lantinga fc1af1dfde Added support for the trigger buttons on the Victrix Pro FS for PS5 2023-03-10 15:40:09 -08:00
Sam Lantinga 06183989e1 Removed space between sizeof and parentheses 2023-03-10 08:12:58 -08:00
Sam Lantinga dfa832c5de Make sure our pixel size is up to date at window creation
This guarantees that the application will always get SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED when a window is created.

Fixes https://github.com/libsdl-org/SDL/issues/7441
2023-03-10 08:11:16 -08:00
Sam Lantinga 2af6f4a3e4 Fixed build warning on Android 2023-03-10 08:11:16 -08:00
Qrox 71c80c478a Uses integer arithmetics in SDL_ResampleAudio
- 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
2023-03-09 22:12:03 -08:00
Sam Lantinga 926db1bd54 Removed a duplicate delay accidentally added during code refactor 2023-03-09 16:12:49 -08:00
Sam Lantinga 645823fc90 Wait for the GCController framework to see IOKit devices
It occasionally takes a few millseconds for the GCController framework to handle the device notification and set up the device

Fixes the duplicate controller issue in https://github.com/libsdl-org/SDL/issues/6686
2023-03-09 16:12:49 -08:00
Sam Lantinga 21e444b2e7 Fixed a few additional sizeof locations 2023-03-09 15:25:48 -08:00
Sam Lantinga c6443d86c9 Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!) 2023-03-09 15:10:44 -08:00
Guldoman ad95c93bf4 Add portal interface to support `SDL_GetSystemTheme` in linux 2023-03-09 15:05:16 -08:00
Sam Lantinga 2ca727aec6 If the client rect is empty, use the last known window size
This happens on Windows 11 with fullscreen desktop windows when the desktop is brought up with the Windows+D shortcut.

Fixes https://github.com/libsdl-org/SDL/issues/7419
2023-03-09 10:31:39 -08:00
Ozkan Sezer 34d13cd0a9 made IsModifierKeyPressed() helper static 2023-03-09 20:28:05 +03:00
Deve 4de6ddd07f Fixed incorrect modifier keys handling on macOS 2023-03-09 09:00:53 -08:00
David Demelier d0c4849d0b Rename SDL_atomic_t to SDL_AtomicInt 2023-03-09 09:00:09 -08:00
Sam Lantinga 8994878767 Added SDL_GetSystemTheme() to return whether the system is using a dark or light color theme, and SDL_EVENT_SYSTEM_THEME_CHANGED is sent when this changes
Fixes https://github.com/libsdl-org/SDL/issues/5334
Fixes https://github.com/libsdl-org/SDL/issues/6958
Closes https://github.com/libsdl-org/SDL/pull/6440
2023-03-09 03:25:20 -08:00
Sam Lantinga cabedee4a1 Fixed constraining the mouse to the window in relative mode 2023-03-08 22:29:45 -08:00
Ryan C. Gordon d898dbfe50
render: Make sure logical_target is bound when presenting.
Fixes black screen on macOS.

Fixes #7320.
2023-03-08 22:57:29 -05:00
Lokathor b8bc4a234b Make mappings for "Retrolink SNES Controller" with `SDL_GAMECONTROLLER_USE_BUTTON_LABELS` both on and off
I've only tested this on windows, but I went ahead and made the same changes for linux and mac because I assumed it's the same there and that we'd want to keep the three platforms in sync.
2023-03-08 16:43:12 -08:00
Sam Lantinga ba87b96cea Fixed signed/unsigned warnings
Fixes https://github.com/libsdl-org/SDL/issues/7424
2023-03-08 12:36:44 -08:00
Ozkan Sezer 53bde3abee fix SDL_FindFreePlayerIndex so it can really return -1. 2023-03-08 20:00:00 +03:00
Sam Lantinga dd7cf12206 Fixed instances of SDL_joystick_players being set to -1 (thanks @AntTheAlchemist!)
Fixes https://github.com/libsdl-org/SDL/issues/7426
2023-03-08 08:38:59 -08:00
Sylvain c963f02571 More fix warnings about static function and prototype 2023-03-08 16:14:09 +01:00
Sam Lantinga 61309b4382 Disassociate the SDLOpenGLContext from the view before deleting it
If we don't do this, the view will be blanked even if another context is current and rendering from that context won't be visible.

Fixes https://github.com/libsdl-org/SDL/issues/4986
2023-03-08 01:35:21 -08:00
Sam Lantinga 04a03a3eec Use SDL_GL_DeleteContext instead of Cocoa_GL_DeleteContext for context cleanup
That will make the current context NULL before deleting the context.
2023-03-08 01:33:28 -08:00
Sam Lantinga d08338ddc5 Added mapping for the Xbox Elite Core controller connected via Bluetooth on Android 2023-03-06 15:36:49 -08:00
divVerent 6f1f586086
Fix Xbox One gamepad axis assignment on SDL_JOYSTICK_ANDROID API (#7405) 2023-03-06 15:33:18 -08:00
Sam Lantinga f8106d4f30 Fixed build warning
format '%x' expects argument of type 'unsigned int', but argument 2 has type 'Uint32' {aka 'long unsigned int'}
2023-03-06 13:33:52 -08:00
Sam Lantinga c0e7845874 Be more clear about what flags conflicted 2023-03-06 11:43:28 -08:00
Sam Lantinga c69aea887a Fixed permissions for src/video/x11/SDL_x11modes.c 2023-03-06 11:39:21 -08:00
Sam Lantinga 698dbd8464 SDL_CreateWindow() has been simplified and no longer takes a window position. 2023-03-06 09:50:12 -08:00
Sam Lantinga 7905254087 Updated debug print with new SDL_DisplayMode fields 2023-03-06 09:50:12 -08:00
Sylvain a946a34452 Add Drag and drop position, for x11, wayland and MACOSX 2023-03-06 08:44:05 -08:00
Sylvain 813c586edb Change local (void*) to SDL_FunctionPointer 2023-03-06 12:38:38 +01:00
Sylvain 9b065bf54b Fix various warnings: static /void / comma 2023-03-06 12:37:37 +01:00
Sam Lantinga c9aec268fa SDL_GetJoystickIDForPlayerIndex() should return 0 for invalid ID (thanks @AntTheAlchemist!) 2023-03-03 16:15:28 -08:00
Michal Suchanek 987b748067 evdev_kbd: Use current keymap
keymap can change over time, caching the keymap causes wrong keys
returned when user changes keymap during runtime

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
(cherry picked from commit 96a2a6b94515c5a0c920d5ffd64bf83acb74d7a8)
2023-03-03 14:31:20 -08:00
Sam Lantinga 6b87d1938f Added SDL_EVENT_DISPLAY_SCALE_CHANGED 2023-03-03 11:16:31 -08:00
Sam Lantinga 16f4e37bb5 Fixed build 2023-03-03 09:49:48 -08:00
Sam Lantinga e3d90c694c Make sure the window is valid in SDL_SetKeyboardFocus() 2023-03-03 09:09:11 -08:00
Sam Lantinga f1c3d3be97 Default to using newer D3D renderers in SDL 3.0 2023-03-02 15:09:57 -08:00
Ryan C. Gordon 8b9a938413
dataqueue: Make thread safe.
Each data queue gets its own mutex and each function obtains it.

Fixes #7390.
2023-03-02 16:35:16 -05:00
Eddy Jansson 91b9ba8c54 Correct typo GetSlectionText -> GetSelectionText 2023-03-02 16:29:18 -05:00
Ryan C. Gordon f833e005e1
dataqueue: Removed non-public SDL_ReserveSpaceInDataQueue function
This wasn't used, and it was just asking for trouble.
2023-03-02 16:09:23 -05:00
Ozkan Sezer ea824c6d20 hidapi/windows tidy-up. 2023-03-02 21:40:02 +03:00
Sam Lantinga 3bba33932f Fixed testshape on high DPI displays
Since the shape is set based on the pixels in the image, we want the window to have the same number of pixels.
2023-03-02 10:15:14 -08:00
Sam Lantinga bd2e2ee7aa SDL_RenderTexture() and SDL_RenderTextureRotated() take floating point source coordinates
See the discussion at https://discourse.libsdl.org/t/sdl-rendercopyf-uses-ints/36732/8
2023-03-02 09:42:32 -08:00
Ozkan Sezer 199a7af296 hidapi/windows: fix build using older toolchains. 2023-03-02 20:21:20 +03:00
Sam Lantinga c887b55964 Fixed mingw build 2023-03-02 08:58:52 -08:00
Sam Lantinga a5fba759b3 Get the name, manufacturer and serial number for Bluetooth devices on Windows
Adapted from upstream hidapi code
2023-03-02 08:20:38 -08:00
Sam Lantinga 727c7d4e2f Don't clobber an existing entry with a different version when adding a gamepad mapping 2023-03-01 16:38:48 -08:00
Sam Lantinga add980efb7 Unfixed spacing
From @ozkan: Except for line 2537, all those trailing whitespace are from original code which had left in as-is in case we want to upgrade to a newer version more easily.
2023-03-01 11:19:52 -08:00
Sam Lantinga 2f14b36709 Fixed spacing 2023-03-01 10:02:14 -08:00
Sam Lantinga cfb96e260b Fixed spacing 2023-03-01 09:51:27 -08:00
David Carlier 8d24381e7e SDL_GetSystemRAM completion for Haiku system.
using native system_info's api.
2023-03-01 09:50:03 -08:00
Sam Lantinga d5775f6708 The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.
Fixes https://github.com/libsdl-org/SDL/issues/7375
2023-03-01 09:48:28 -08:00
Ryan C. Gordon f48d0cc164
audio: Remove AUDIO_U16* support.
It wasn't heavily used, and you can't use memset to silence a U16 buffer.

Fixes #7380.
2023-03-01 10:26:01 -05:00
Sam Lantinga ebdb320651 Follow the same pattern for releasing the window data in the UIKit driver
Possible fix for https://github.com/libsdl-org/SDL/issues/7361
2023-02-28 15:56:49 -08:00
Eddy Jansson 5f5abb6805 Always allocate zt in output of SDL_iconv_string()
Before this, the function could not be used on buffers,
as it would not account for the zero-termination unless
it was included in the input.
2023-02-28 09:26:01 -08:00
Sam Lantinga 6aeb07d4c2 Fixed SDL windows getting the maximized state after leaving fullscreen on macOS 2023-02-28 09:03:28 -08:00
Sam Lantinga da134a3039 Fixed locking up the Logitech F310 with the PlayStation controller detection 2023-02-28 08:36:31 -08:00
Sam Lantinga c824060503 Fixed missing line 2023-02-27 21:08:50 -08:00
Sam Lantinga a6d8cdf186 Setting a window to non-fullscreen when it's not fullscreen is a no-op
Also explicitly reset fullscreen mode when destroying a window, eliminating the need for doing that in SDL_HideWindow(), as that's already taken care of in SDL_OnWindowHidden() normally.
2023-02-27 21:06:05 -08:00
Sam Lantinga fcc9deb365 Only restore desktop mode when hiding a window if that window was fullscreen 2023-02-27 15:38:48 -08:00
Sam Lantinga 206fa4dafb Added mapping for DualSense Edge Wireless Controller on Linux
This is a mapping when using evdev, not the more advanced HIDAPI support.
2023-02-27 15:19:34 -08:00
David Carlier a5a53c12bf USE_DEV_RANDOM close the file descriptor even in the rare case it can't read it 2023-02-26 14:00:00 +03:00
Torge Matthies f18b5656f6 x11: Fix duplicate Xinput2 event reception
Passing True for owner_events in the XGrabPointer call makes all
XI_RawMotion events appear in the queue twice, with the only difference
between them being the value of XGenericEventCookie::cookie. These have
always been filtered out by a check in the XI_RawMotion handler,
however with a mouse that polls at more than 1 kHz frequency, there
also exist legitimate events that appear indistinguishable from these
duplicated events. These must not be filtered out, otherwise the
pointer may move at an inconsistent speed, appearing like a bad pointer
acceleration implementation.

Change owner_events to False in the XGrabPointer and remove the
duplicate event detection code to fix this.

Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
2023-02-25 10:04:46 -08:00
David Carlier d73f2d76a0 Haiku modernizing a bit the C++ code with C++11 heuristics
with BApplication
2023-02-24 20:54:41 -08:00
Sam Lantinga 2897de9efc Clear the undefined position state when the window is placed
This allows the window to be recreated in the same location if needed, for example if recreated because of switching to OpenGL rendering.
2023-02-24 18:04:54 -08:00
Sam Lantinga 4d9d343662 Added handling for undefined window position on X11 2023-02-24 17:49:45 -08:00
Sam Lantinga 3bfd596608 Added handling for undefined window position on Windows 2023-02-24 17:06:47 -08:00
Sam Lantinga daffe02b11 Fixed relative mouse motion over remote desktop
Setting the cursor clip area to a single pixel prevents the relative mouse motion remote desktop warping from working, so the mouse is never recentered.
2023-02-24 09:20:38 -08:00
Anonymous Maarten f2a277414f raspberry: SDL_DisplayMode's w/h members have been renamed to screen_w/screen_h
Found by running the coccinelle script on SDL's source tree.
2023-02-24 06:55:28 -08:00
Sam Lantinga 516e48515e Changed the VID/PID used for the Backbone One controller on iOS 2023-02-23 12:24:15 -08:00
Sam Lantinga 59bf1c2853 Added support for the Backbone One PlayStation Edition 2023-02-23 11:57:48 -08:00
Sam Lantinga b2d913883c Fixed view frame from flipping back and forth between landscape and portrait on iOS 2023-02-23 09:14:53 -08:00
Frank Praznik e8fd7f74bd windows: Track the window display ID locally
Track the current window display ID locally so as not to depend on specific behavior of the video layer, which may change the value at times when it isn't expected.
2023-02-23 07:39:16 -08:00
Frank Praznik 9f1a7bb94c wayland: Track the window display ID locally
Track the current window display ID locally so as not to depend on specific behavior of the video layer, which may change the value at times when it isn't expected.
2023-02-23 07:39:16 -08:00
Frank Praznik d9fadb8b47 video: Update the current display when moving a window programmatically
When moving a window programmatically, the move event will be deduplicated due to the window x and y coordinates already being updated, so the window's current display ID needs to be explicitly updated.
2023-02-23 07:39:16 -08:00
Frank Praznik e8076b78ef video: Move fullscreen windows via SDL_UpdateFullscreenMode()
Update the target display ID and use SDL_UpdateFullscreenMode() when moving a fullscreen window to handle the case where the target display has an existing fullscreen window.
2023-02-23 07:39:16 -08:00
Sam Lantinga c2f8a478d8 Don't set a logical presentation mode by default
SDL3 applications are DPI aware by default, and can set the logical presentation mode as appropriate.
2023-02-22 22:27:01 -08:00