Commit Graph

15126 Commits (2f26c585048622790349bb202fdaa45d2430caaa)

Author SHA1 Message Date
Anonymous Maarten 2f26c58504 cmake: fix typo in cmake/sdlplatform.cmake 2024-04-02 23:44:15 +02:00
Clownacy 65e7c8e265 Fix default Windows window icon not suiting the DPI.
For whatever reason, `ExtractIconEx` returns icons whose sizes are
inappropriate for the current DPI, resulting in terribly-blurry
window icons at higher DPIs.

To solve this, the window icon is now set to the first icon group
that is present in the executable. This behaviour should match what
Explorer does. By selecting an icon group instead of a specific icon,
Windows is free to select the icon within the group that best suits
the current DPI.

(cherry picked from commit 1fa6142903b88007c7b77d324ee78fad9966871a)
2024-04-02 12:04:52 -07:00
Anonymous Maarten 143b070074 cpuinfo: fix -Wmissing-prototypes warning 2024-04-02 18:57:36 +02:00
Ryan C. Gordon 58529c1827
stdlib: SDL_utf8strlen and SDL_utf8strnlen now use SDL_StepUTF8 internally.
Otherwise, they might find out strings with malformed UTF-8 sequences produce
a different amount of codepoints than the count returned here, overflowing
buffers that might be allocated based on the results.
2024-04-01 22:43:19 -04:00
Sam Lantinga 17d4f8d699 Updated to version 3.1.1 for the preview release 2024-04-01 17:03:46 -07:00
Brian Collins 560daa07f2 Workaround a macOS cursor-related bug.
This fixes an macOS bug that is only known to occur in fullscreen windows on the built-in displays of newer MacBooks with camera notches. When the mouse is moved near the top of such a window (within about 44 units) and then moved back down, the cursor rects aren't respected. This can cause the default cursor to be visible when it should not be.

(cherry picked from commit f1690e265e306818882c7c876a9e85492eeefa42)
2024-04-01 16:21:24 -07:00
Sam Lantinga a82ed82bc7 SDL_QueryTexture() fills in a pointer to SDL_PixelFormatEnum 2024-04-01 15:45:22 -07:00
Sam Lantinga aea44cff6b Fixed warning C4702: unreachable code 2024-04-01 14:30:11 -07:00
Sam Lantinga 85b7f131b0 Fixed warning C4701: potentially uninitialized local variable 'percent' used 2024-04-01 14:27:19 -07:00
Sam Lantinga c10a3df552 Only add the UniformTypeIdentifiers framework if we're building the dialog subsystem
This framework isn't available on older SDKs
2024-04-01 14:13:31 -07:00
SDL Wiki Bot 18c8af6e48 Sync SDL3 wiki -> header 2024-04-01 21:00:26 +00:00
Sam Lantinga 8847b35244 Separate joystick power state into battery status and percentage
This allows you to see battery percentage while the controller is charging
2024-04-01 13:59:00 -07:00
Sam Lantinga 5e624c2083 Moved display and window event renaming to the correct header section
Closes https://github.com/libsdl-org/SDL/pull/9396
2024-04-01 13:57:05 -07:00
Anonymous Maarten 63cb541797 cmake: set SYSTEM property in SDL3Config.cmake for compatibility with older CMake versions 2024-04-01 20:09:51 +02:00
Susko3 5f763083fc Use SDL_EventType and fix event name in comment 2024-04-01 11:04:02 -07:00
Susko3 c40e9cc634 Sort includes 2024-04-01 11:04:02 -07:00
Anonymous Maarten 4eb0f10dda cmake: install SDL headers with SYSTEM property disabled
This causes the SDL include path to be added using -I instead of -isystem
2024-04-01 18:38:47 +02:00
Anonymous Maarten fb8ac1ab7d ci: verify SDL build system does not include installed SDL headers 2024-04-01 18:38:47 +02:00
Anonymous Maarten 19b01c39b0 ci: don't fix pspsdk toolchain anymore 2024-04-01 18:38:47 +02:00
Frank Praznik a00ac61514 time: Fix UWP build 2024-04-01 10:53:35 -04:00
danginsburg 650ba8f3ec Vulkan Renderer - closes #9385. When the vertex buffer size is exceeded, make sure to wait for outstanding work before resizing it. This fixes validation errors/crash found with using Imgui SDL3 renderer on Vulkan. 2024-04-01 07:38:31 -07:00
Sean Ridenour 3448273be1 Weakly link UniformTypeIdentifiers.framework 2024-04-01 07:38:05 -07:00
Sean Ridenour feebb9fcf8 Fix file selection dialog boxes not working on macOS 11.0+ 2024-04-01 07:38:05 -07:00
Frank Praznik c0bfd8bafd time: Only call GetSystemTimePreciseAsFileTime if available
GetSystemTimePreciseAsFileTime is only available on Win8/Server 2012 or higher, so it must be dynamically loaded and only used if available.  Fixes compatability with Win7 and XP.
2024-04-01 10:23:02 -04:00
Susko3 c96bc8b1a2 Add missing includes for SDL_MouseID
Missed in f8844d387c and d1eb4adb16.
2024-03-31 16:11:23 -07:00
Ryan C. Gordon 74b58aebb9
README-migration: fix function signature on SDL_(Read|Write)IO docs. 2024-03-31 16:43:53 -04:00
Ryan C. Gordon 6b20152bda
README-migration: Removed duplicate paragraph.
(Exact same text also exists earlier in the SDL_audio.h section.)
2024-03-31 16:26:08 -04:00
Sam Huang a9cab01185 Don't change cwd with file dialogs 2024-03-31 12:50:29 -07:00
Mirko Galimberti 60cacc8277 README-migration: Fix wrong new name for SDL_WINDOWEVENT_ENTER and SDL_WINDOWEVENT_LEAVE 2024-03-31 12:47:55 -07:00
Sam Lantinga fbbee04423 Revert "Only clear the raw input queue status if we don't call GetRawInputBuffer()"
This reverts commit 02c63667c7.

It turns out that QS_RAWINPUT isn't actually cleared by GetRawInputBuffer(). See https://github.com/libsdl-org/SDL/issues/9409 for more details.
2024-03-31 12:44:13 -07:00
Ryan C. Gordon e055a9fc2d
wikiheaders.pl: Report a function's header file name. 2024-03-31 12:56:00 -04:00
Mathieu Eyraud 4d00706f57 Do not store pointer before potentialy freeing it
Store data to windows->driverdata after call to SetProp() in case it fails.
2024-03-30 11:07:42 -07:00
Mathieu Eyraud 36dec0bf4e Fix return value of WIN_GetMonitorPathInfo 2024-03-30 11:04:32 -07:00
Sam Lantinga 8201b6dc4d Added support for raw mousewheel events 2024-03-30 07:38:38 -07:00
Sam Lantinga 4a00d34a86 Always send raw mouse button state changes
Fixes https://github.com/libsdl-org/SDL/issues/9395
2024-03-30 07:30:43 -07:00
Semphris 335fa5d6e4 Disable SDL dialogs for tvOS and iOS 2024-03-29 23:13:15 -07:00
Anonymous Maarten 72cf9c0ef4 test: don't run testautomation in parallel 2024-03-29 21:11:35 +01:00
SDL Wiki Bot 96c93d2252 Sync SDL3 wiki -> header 2024-03-29 19:02:25 +00:00
Ryan C. Gordon 49029c8454 stdinc: Document a bunch of ctype/string functions.
This is intended to help codify the rules for locale and Unicode in SDL3,
which were less-well defined in SDL2.
2024-03-29 15:01:40 -04:00
Ryan C. Gordon a5c892d2c3 stdlib: Improve Unicode support and consistency in string comparison functions.
SDL_strcasecmp (even when calling into a C runtime) does not work with
Unicode chars, and depending on the user's locale, might not work with
even basic ASCII strings.

This implements the function from scratch, using "case-folding,"
which is a more robust method that deals with various languages. It
involves a hashtable of a few hundred codepoints that are "uppercase" and
how to map them to lowercase equivalents (possibly increasing the size of
the string in the process). The vast majority of human languages (and
Unicode) do not have letters with different cases, but still, this static
table takes about 10 kilobytes on a 64-bit machine.

Even this will fail in one known case: the Turkish 'i' folds differently
if you're writing in Turkish vs other languages. Generally this is seen as
unfortunate collateral damage in cases where you can't specify the language
in use.

In addition to case-folding the codepoints, the new functions also know how
to decode the various formats to turn them into codepoints in the first
place, instead of blindly stepping by one byte (or one wchar_t) per
character.

Also included is casefolding.txt from the Unicode Consortium and a perl
script to generate the hashtable from that text file, so we can trivially
update this if new languages are added in the future.

A simple test using the new function:

```c
 #include <SDL3/SDL.h>

 int main(void)
 {
     const char *a = "α ε η";
     const char *b = "Α Ε Η";
     SDL_Log("    strcasecmp(\"%s\", \"%s\") == %d\n", a, b, strcasecmp(a, b));
     SDL_Log("SDL_strcasecmp(\"%s\", \"%s\") == %d\n", a, b, SDL_strcasecmp(a, b));
     return 0;
 }
```

Produces:

```
INFO:     strcasecmp("α ε η", "Α Ε Η") == 32
INFO: SDL_strcasecmp("α ε η", "Α Ε Η") == 0
```

glibc strcasecmp() fails to compare a Greek lowercase string to its uppercase
equivalent, even with a UTF-8 locale, but SDL_strcasecmp() works.

Other SDL_stdinc.h functions are changed to be more consistent, which is to
say they now ignore any C runtime and often dictate that only English-based
low-ASCII works with them.

Fixes Issue #9313.
2024-03-29 15:01:40 -04:00
Ryan C. Gordon 4659a84bd1 coreaudio: fix race condition when closing an input device. 2024-03-29 00:55:38 -04:00
Ryan C. Gordon 2fd9447670 coreaudio: Make sure device handles are unique.
AudioDeviceID is not unique (hardware that can do both capture and output
will expose both interfaces off the same AudioDeviceID!).
2024-03-28 21:45:00 -07:00
Sam Lantinga 87235e0f6d Fixed detecting CoreAudio devices that have both capture and output endpoints 2024-03-28 18:35:42 -07:00
Sam Lantinga af5728b94d Fixed event handle accumulation when the SDL window doesn't have focus
This also fixes a crash on shutdown caused by the raw input thread failing to stop
2024-03-28 15:11:45 -07:00
Christoph Reichenbach 6d37f4798e SDL_pen.c: release pen mutex on error return 2024-03-28 20:37:54 +00:00
Susko3 d785a647a4 Fix 'SyntaxWarning: invalid escape sequence' when running gendynapi.py 2024-03-28 13:21:26 -07:00
Ozkan Sezer 6cf71ca9a9 SDL_stdinc.h: Android passes sizeof(ENUM) == sizeof(int) assertion
Reference issue: https://github.com/libsdl-org/SDL/issues/9392 .
2024-03-28 20:28:02 +03:00
Sam Lantinga 47378eddf6 Fixed error: ordered comparison of pointer with integer zero 2024-03-28 09:34:48 -07:00
Sam Lantinga 0aa1022358 Clarify that SDL_SetWindowKeyboardGrab() is only needed if you set SDL_HINT_GRAB_KEYBOARD 2024-03-28 09:25:22 -07:00
Sam Lantinga fc81d4e5fc Fixed 64-bit conversion warnings 2024-03-28 09:12:26 -07:00