Commit Graph

14428 Commits

Author SHA1 Message Date
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
e61b5ceefe The SDL_WINDOW_ALLOW_HIGHDPI flag has been renamed SDL_WINDOW_HIGH_PIXEL_DENSITY 2023-05-18 07:34:45 -07:00
Sam Lantinga
d1ee44b65e Add the pixel density to the display mode list in testwm 2023-05-18 07:34:16 -07:00
Sam Lantinga
887a1b5969 Print some newly added window flags 2023-05-18 07:33:49 -07:00
SDL Wiki Bot
f9ecc841ca Sync SDL3 wiki -> header 2023-05-18 00:55:15 +00: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 32999798e0)
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
SDL Wiki Bot
5836e057de Sync SDL3 wiki -> header 2023-05-17 19:59:14 +00: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 424bc4bcf7)
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 0eea92c8fc)
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 86786ed544)
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