12465 Commits

Author SHA1 Message Date
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
SDL Wiki Bot
e2b7b9b91c Sync SDL3 wiki -> header 2023-05-15 18:21:14 +00: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
SDL Wiki Bot
78251f973d Sync SDL3 wiki -> header 2023-05-13 16:55:14 +00:00
Frank Praznik
12e1b2546a docs: Add README-wayland
Add a README file for Wayland that lists common issues and limitations.
2023-05-13 12:54:14 -04: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
SDL Wiki Bot
92a59333ba Sync SDL3 wiki -> header 2023-05-12 14:55:13 +00: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
Sam Lantinga
fd42a2f994 Changed all variadic macros into fixed (thanks @Wohlstand!) 2023-05-10 06:27:38 -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
SDL Wiki Bot
9786d8ac40 Sync SDL3 wiki -> header 2023-05-09 18:27:15 +00:00
Ryan C. Gordon
2b6cb7bfb2
include: SDL_ConvertAudioSamples docs now warn about converting in chunks.
Fixes #7154.
2023-05-09 14:24:22 -04: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 715e070d299fc547cce8c52915b75e6316af6bff.

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
Anonymous Maarten
72e5a52c51 ci: use Haiku cross toolchain
A cross compiler is much faster then an emulated one.
2023-05-04 08:26:54 -04:00