Commit Graph

12589 Commits (0b28cbe385c808b3cbe89b8eb7c2b10d7849599b)

Author SHA1 Message Date
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 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 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
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 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