1487 Commits

Author SHA1 Message Date
Sam Lantinga
e8dbbf8380 Renamed SDLK_a-z to SDLK_A-Z
Made the symbols uppercase for consistency with the other SDLK_* constants, but the values are still lowercase.
2024-07-01 13:56:49 -07:00
Sam Lantinga
d9dc4b320a The keycode in key events is the base, unmodified, keycode for the current keyboard layout 2024-07-01 13:56:49 -07:00
Anonymous Maarten
8290c4e82e sdlprocdump: also print a stacktrace on a fatal exception 2024-07-01 20:49:52 +02:00
Sam Lantinga
473257cce6 Added SDL_GetRenderLogicalPresentationRect()
Fixes https://github.com/libsdl-org/SDL/issues/8815
2024-06-29 14:25:59 -07:00
Sam Lantinga
a522bfe3f1 Clean up any renderer in SDL_DestroyWindowSurface()
Also added an automated test to verify window surface functionality.

Fixes https://github.com/libsdl-org/SDL/issues/10133
2024-06-29 10:47:28 -07:00
Sam Lantinga
6f199eabb8 Removed SDL_RenderGeometryRawFloat()
After discussion with @ocornut, SDL_RenderGeometryRaw() will take floating point colors and conversion from 8-bit color can happen on the application side.  We can always add an 8-bit color fast path in the future if we need it on handheld platforms.

If you need code to do this in your application, you can use the following:

int SDL_RenderGeometryRaw8BitColor(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
{
    int i, retval, isstack;
    const Uint8 *color2 = (const Uint8 *)color;
    SDL_FColor *color3;

    if (num_vertices <= 0) {
        return SDL_InvalidParamError("num_vertices");
    }
    if (!color) {
        return SDL_InvalidParamError("color");
    }

    color3 = (SDL_FColor *)SDL_small_alloc(SDL_FColor, num_vertices, &isstack);
    if (!color3) {
        return -1;
    }

    for (i = 0; i < num_vertices; ++i) {
        color3[i].r = color->r / 255.0f;
        color3[i].g = color->g / 255.0f;
        color3[i].b = color->b / 255.0f;
        color3[i].a = color->a / 255.0f;
        color2 += color_stride;
        color = (const SDL_Color *)color2;
    }

    retval = SDL_RenderGeometryRaw(renderer, texture, xy, xy_stride, color3, sizeof(*color3), uv, uv_stride, num_vertices, indices, num_indices, size_indices);

    SDL_small_free(color3, isstack);

    return retval;
}

Fixes https://github.com/libsdl-org/SDL/issues/9009
2024-06-29 00:10:08 -07:00
Sam Lantinga
212a491f7c Renamed SDL_HINT_IME_NATIVE_UI to SDL_HINT_IME_IMPLEMENTED_UI
This inverts the logic to make more sense from an application perspective.
2024-06-28 19:41:37 -07:00
Sam Lantinga
4c7db129df SDL_HINT_IME_INTERNAL_EDITING and SDL_HINT_IME_SHOW_UI are replaced with SDL_HINT_IME_NATIVE_UI 2024-06-28 17:09:22 -07:00
Sam Lantinga
bdd531986b SDL_SetTextInputRect() has been renamed to SDL_SetTextInputArea()
The new function includes the cursor position so IME UI elements can be placed relative to the cursor, as well as having the whole text area available so on-screen keyboards can avoid it.
2024-06-28 17:09:22 -07:00
Sam Lantinga
ed2022a175 Added SDL_EVENT_TEXT_EDITING_CANDIDATES
This allows applications that have set SDL_HINT_IME_SHOW_UI to "0" to get candidates lists they can draw themselves.

Fixes https://github.com/libsdl-org/SDL/issues/4855
2024-06-28 17:09:22 -07:00
Sam Lantinga
8165e96514 Fixed whitespace 2024-06-27 18:35:12 -07:00
Sam Lantinga
dcd7b4e497 testime: highlight selected clauses in Japanese composition mode 2024-06-27 17:43:03 -07:00
Sam Lantinga
50250adba7 testime: draw a blinking cursor at the text insertion point 2024-06-27 17:43:03 -07:00
Sam Lantinga
3d525331aa testime: add a 1 pixel border around glyphs to avoid texture sampling into other glyphs 2024-06-27 17:43:03 -07:00
Sam Lantinga
938c974cca testime: use a replacement character for characters not in the font 2024-06-27 17:43:03 -07:00
Sam Lantinga
a67e6b80de Updated unifont to version 15.1.05 2024-06-27 17:43:03 -07:00
Sam Lantinga
50f50612bd Removed checkkeysthreads
It's out of date relative to the IME changes and doesn't add any value
2024-06-27 17:43:03 -07:00
Ryan C. Gordon
1e0ac5771a testiconv: Remove half-baked SDL_StepUTF8 testing code. 2024-06-27 17:36:09 -04:00
Ryan C. Gordon
a9cfcf6bde stdinc: Drastically improve SDL_StepUTF8() and make it a public API.
Fixes #10105.
2024-06-27 17:36:09 -04:00
Ryan C. Gordon
9b8c5f642f
testaudio: Better fix for NULL dereference.
This code already handled NULL fine, it just got wrapped in a SDL_strdup call
in e23257307e220c7dd3d827e195f52adaabaaeeeb, so make that SDL_strdup check for
NULL first.
2024-06-27 17:24:49 -04:00
Ryan C. Gordon
5631c6dbaa
testaudio: Don't crash if SDL_GetAudioDeviceName() returns NULL.
It definitely will for default devices, so this crash is real, but it's also
good defensive coding if something blows up unexpectedly.

Fixes #10130.
2024-06-27 17:20:11 -04:00
Ryan C. Gordon
982feb7a65 vulkan: SDL_Vulkan_CreateSurface now returns the usual int (0=ok, -1=error).
Fixes #10091.
2024-06-27 15:25:10 -04:00
Sam Lantinga
def7a43a2e SDL_HINT_IME_SHOW_UI defaults to SDL_TRUE
This hint is currently only used on Windows, and this matches the behavior of other platforms.
2024-06-24 20:32:03 -07:00
Sam Lantinga
382494eeda checkkeys: draw the IME composition text 2024-06-24 20:32:03 -07:00
Sam Lantinga
92b3ce20b1 checkkeys: don't toggle text input with the left mouse button
This often gets triggered when clicking back and forth between the language bar and the application
2024-06-24 20:32:03 -07:00
Sam Lantinga
01ae067504 checkkeys: print the start/length values of the SDL_EVENT_TEXT_EDITING event 2024-06-24 20:32:03 -07:00
Sam Lantinga
94ae4e1513 Fixed build warnings 2024-06-24 13:36:56 -07:00
Sam Lantinga
0ff5c05486 Added SDL_GetWindows() 2024-06-24 12:22:12 -07:00
Sam Lantinga
2f5b20fcb5 Updated based on feedback from @JKaniarz 2024-06-24 11:49:15 -07:00
Sam Lantinga
a938e2b979 Replaced test framework random code with SDL random functions 2024-06-24 11:49:15 -07:00
Sam Lantinga
96f2f23240 Simplified SDL random function names and added thread-safe versions 2024-06-24 11:49:15 -07:00
Sam Lantinga
138eb8649d checkkeys: draw a blinking cursor 2024-06-24 11:20:08 -07:00
Sam Lantinga
505badb7af checkkeys: added support for multiple windows 2024-06-24 11:20:08 -07:00
Sam Lantinga
76631a0978 The text input state has been changed to be window-specific.
SDL_StartTextInput(), SDL_StopTextInput(), SDL_TextInputActive(), SDL_ClearComposition(), and SDL_SetTextInputRect() all now take a window parameter.

This change also fixes IME candidate positioning when SDL_SetTextInputRect() is called before SDL_StartTextInput(), as is recommended in the documentation.
2024-06-24 11:20:08 -07:00
Sam Lantinga
258ee05655 checkkeys: enable showing IME candidates 2024-06-24 11:20:08 -07:00
Simon McVittie
2cfeff1505 testevdev: Associate HID reports for pedals with their other test data
This is how these globals were intended to have been used, similar to
what we already did for the Fanatec device.

Fixes: 3772d6cc "testevdev: Add raw HID report descriptors where available"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-24 04:39:34 -07:00
Simon McVittie
3150fdc75e Revert "testevdev.c: comment out two unused data to fix build."
This reverts commit e4f53e6b214cf476c9ad4b035ead97fb62da81c0.
We'll use these in the next commit.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-24 04:39:34 -07:00
Anonymous Maarten
2018882bf2 testmanymouse: enable raw keyboard events on Windows 2024-06-22 11:35:00 -07:00
Anonymous Maarten
99d28ca485 testmanymouse: fix argument parsing 2024-06-22 14:43:06 +02:00
Sam Lantinga
90034b16dc The keycode in key events is affected by modifiers by default.
This behavior can be customized with SDL_HINT_KEYCODE_OPTIONS.
2024-06-22 00:19:06 -07:00
Sam Lantinga
0dd579d40d Removed SDL_Keysym 2024-06-21 22:06:08 -07:00
Sam Lantinga
679e4471ed Added the ability to query the keymap for keycodes based on modifier state 2024-06-21 22:06:08 -07:00
Sam Lantinga
ef9bd8b609 Add the raw platform specific key code to SDL_Keysym
This allows applications to handle keys that SDL doesn't recognize, in a platform dependent way.

Fixes https://github.com/libsdl-org/SDL/issues/6390
2024-06-21 22:06:08 -07:00
Sam Lantinga
9d816c72ef Updated SDL3 scancode list
This adds more app editing and audio control keys and removes keys that launch applications

Work in progress on https://github.com/libsdl-org/SDL/issues/6390
2024-06-21 22:06:08 -07:00
Simon McVittie
53eff7f903 testevdev: Add X-Box One S controller via xpadneo 0.9.x
This is an out-of-tree driver providing an alternative interface to
X-Box gamepads. Compared with the in-kernel driver, it adds four
pseudo-buttons used to indicate which profile is active, and an
optional "misc" axis that combines the two triggers into a rudder.

Partially addresses libsdl-org/SDL#7823

Thanks: @kakra
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-21 07:05:26 -07:00
Simon McVittie
2804f92eff testevdev: Add missing device ID for Wiimote Classic Controller
Thanks: Jeremy Whiting
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-21 07:04:56 -07:00
Simon McVittie
c244eb937b testevdev: Add the virtual X360 controller created by Steam Input
Thanks: Robert Beckett
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-21 07:02:23 -07:00
Simon McVittie
f471392e73 testevdev: Add test data from Steam Deck built-in devices
Thanks: Robert Beckett
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-21 07:02:23 -07:00
Simon McVittie
740850d3ce testevdev: Add a field for the USB device version
For some devices, such as the Steam Deck's built-in Steam Controller,
the version number reported via evdev and the version number reported
via USB are different. We don't currently use this information anyway,
but in case we want to use it in the future, let's include it in our
test data.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-06-21 07:02:23 -07:00
Anonymous Maarten
0f27686a51 tests: run tests under a minimal debugger that can create minidumps
Tests on ci are run using this dumper, and will upload the minidumps.
2024-06-21 12:39:11 +02:00