Commit Graph

15303 Commits (72dfb4f05a1403407f81f58a323a1de408995a1e)

Author SHA1 Message Date
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
Sam Lantinga c8489a3710 Disable XInput2 keyboard events
It turns out they're only delivered to the window with mouse focus, not keyboard focus.

Fixes https://github.com/libsdl-org/SDL/issues/9374
2024-03-28 08:50:47 -07:00
danginsburg fb5307c1b3 Vulkan Renderer - fix synchronization validation issues with testrendertarget and testcopyex. When a texture is destroyed, VULKAN_IssueBatch is called to make sure the texture isn't referenced in any outstanding command work. This path did not wait on the semaphore from vkAcquireNextImageKHR, which would create a hazard. 2024-03-28 07:37:49 -07:00
Ryan C. Gordon 0d007bbb01
psp: Fixed building with pspdev when not using CMake.
(psp-cmake defines `__PSP__` on the command line, but the compiler itself
only defines `__psp__` and some variations.

Fixes #9378.
2024-03-28 09:27:21 -04:00
Ryan C. Gordon ad92c9e300
README-main-functions.md: Added notes about the new `appstate` parameter. 2024-03-27 23:04:36 -04:00
Sam Lantinga 7a9f99cff3 Corrected migration documentation for SDL_GetDisplayDPI()
Fixes https://github.com/libsdl-org/SDL/issues/9386
2024-03-27 18:27:57 -07:00
Ryan C. Gordon d00ccc1546
audio: Fix audio stream incorrectly not unlocking during unbind.
(This patch was from @0x1F9F1, thanks!)

Fixes #9379.
2024-03-27 17:36:26 -04:00
Ryan C. Gordon 38e3c6a4aa
main: Add an optional `appstate` param to main callback entry points.
This allows apps to maintain state data without using global variables.

Fixes #9377.
2024-03-27 17:22:08 -04:00
Sam Lantinga a9dbdb1947 Removed SDL_RenderSetIntegerScale() renaming note
Fixes https://github.com/libsdl-org/SDL/issues/9384
2024-03-27 12:47:23 -07:00
Sam Lantinga cde2dcd0d4 Note that SDL_EVENT_SYSWM has been removed
Fixes https://github.com/libsdl-org/SDL/issues/9382
2024-03-27 11:39:10 -07:00
SDL Wiki Bot 05b3605a41 Sync SDL3 wiki -> header 2024-03-27 18:02:23 +00:00
Frank Praznik 5abcfad352 video: Document that renderer lifetimes are tied to their associated windows 2024-03-27 11:01:41 -07:00
Sam Lantinga 02c63667c7 Only clear the raw input queue status if we don't call GetRawInputBuffer()
GetRawInputBuffer() will do that for us when we read all the queued events
2024-03-26 15:27:57 -07:00
Sam Lantinga d6fc629b5b Fixed Windows rawinput crash
RAWINPUT structures are variable size
2024-03-26 15:27:57 -07:00
Frank Praznik a7df28201b Revert "testautomation: fix renderer leak in video tests"
This reverts commit 2f13f66c71.

Not needed if renderers are once again implicitly cleaned up when their associated windows are destroyed.
2024-03-26 13:10:14 -07:00
Frank Praznik 8f14fa1113 video: Destroy the associated renderer when a window is destroyed
This was previous behavior that used window userdata and was lost during the move to properties.  Renderer objects need to be cleaned up when their associated windows are destroyed, or they can be leaked and backend refcounts won't be properly updated, leading to them not being properly shut down when SDL_Quit() is called.
2024-03-26 13:10:14 -07:00
Sam Lantinga f0cd3ed330 x11: don't send raw mouse motion when the application doesn't have focus 2024-03-26 13:10:54 -07:00
Sam Lantinga c47f9b9b54 x11: fixed mouse and keyboard input when XInput2 isn't available 2024-03-26 13:01:00 -07:00
Sam Lantinga fed5f3a81b We no longer automatically set up a logical presentation mode 2024-03-26 10:40:40 -07:00
Sam Lantinga 823ab13b9c SDL_CreateTexture() takes a SDL_PixelFormatEnum format parameter 2024-03-26 10:40:40 -07:00
Sam Lantinga 35785d1354 SDL_CreateWindowTexture() shouldn't use 10-bit or float textures 2024-03-26 10:40:40 -07:00
Sam Lantinga 696ecca499 Fixed SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB() and SDL_GetRGBA() when used with 10-bit pixel formats
Fixes https://github.com/libsdl-org/SDL/issues/9367
2024-03-26 10:40:40 -07:00
Sam Lantinga 3eb8f35f3b windows: handle the Pause key sequence for raw keyboard input 2024-03-26 09:22:00 -07:00
Daniel Ludwig 4562b41a4d VisualC-GDK: Add missing dialog sources, fix Xbox builds 2024-03-26 07:28:22 -07:00