Commit Graph

9706 Commits

Author SHA1 Message Date
Ryan C. Gordon 16e7fdc4f2 audio: Add channel remapping to SDL_AudioSpec and SDL_AudioStream.
Fixes #8367.
2024-07-03 14:38:33 -04:00
Sam Lantinga 61441c2be9 Fixed the French numeric keycode from varying based on shift state 2024-07-03 10:33:08 -07:00
Sam Lantinga ed9bbb2dca Restore default behavior for keypad keycodes
Added a hint to translate numpad keycodes into their non-numpad versions based on the NumLock state
2024-07-02 18:34:35 -07:00
Ryan C. Gordon bafd04ecdb
camera: small Media Foundation backend init tweak. 2024-07-02 15:16:10 -04:00
Sam Lantinga 109f268972 Added support for non-US keyboard layouts in Emscripten 2024-07-01 13:56:49 -07:00
Sam Lantinga 2c333c7355 The mode modifier only affects character keys 2024-07-01 13:56:49 -07:00
Sam Lantinga d4497ecdbd Numpad scancodes have non-numpad keycodes
This allows the numpad to work as the user expects based on the numlock state. If the application needs to distinguish the keys, it can check to see whether the scancode is a numpad key or not.
2024-07-01 13:56:49 -07:00
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 9601d98e7f SDL_test: always use symbols with 64-suffix from DbgHelp 2024-07-01 20:49:40 +02:00
Frank Praznik 1f0bc4b808
x11: Check for button presses before clearing an XInput2 pointer grab
XInput2 will grab the pointer on button presses, which causes the grab attempt to fail and ultimately timeout since the pointer is already grabbed, however, ungrabbing the pointer when no buttons are pressed and the pointer is outside the window can generate enter/leave notify events, which result in further calls of the grab function. The end result is an infinite loop of grab/ungrab attempts generating enter/leave events. This causes a hang in testautomation when creating a window with the grabbed flag if the pointer is not positioned within window bounds.

Check the button state and only ungrab if a mouse button is in the pressed state.
2024-06-30 12:16:50 -04: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 b72c22340e We don't need to pull scancode state to see if ALT is held down 2024-06-29 13:05:07 -07:00
Sam Lantinga 017a1039e2 Removed unnecessary cast 2024-06-29 13:05:07 -07:00
Sam Lantinga 7258b36e30 Make it easier to turn on Windows message logging 2024-06-29 13:05:07 -07:00
Sam Lantinga 5322b3528a Losing keyboard focus doesn't automatically mean you lose mouse capture
Fixes https://github.com/libsdl-org/SDL/issues/5616
2024-06-29 11:15:21 -07:00
Sam Lantinga 2a58e7b11c Respect SDL_HINT_RENDER_DRIVER when creating an accelerated window surface
Fixes https://github.com/libsdl-org/SDL/issues/10061
2024-06-29 10:47:28 -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 22bca55d84 Minor blitting cleanup 2024-06-29 00:10:08 -07:00
1F616EMO 79f6baa494 Remove the inconsistent and lag-causing usleep call in SDL_fcitx.c
(cherry picked from commit 3bf2b90da0)
2024-06-29 00:09:12 -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 e47179c4c7 We should still set the text input area if SDL_DISABLE_WINDOWS_IME is defined
Fixes https://github.com/libsdl-org/SDL/issues/6254
2024-06-28 18:28:19 -07:00
Sam Lantinga a7d4f0a76c Center the composition text in the text input area 2024-06-28 17:09:22 -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 d9d7104feb Removed unneeded Text Services Framework code from IME handling
We can get the candidate list in uiless mode using ImmGetCandidateListW() once message processing has completed
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 e324c7d692 Fixed event spam caused by repeated calls to IME_SetTextInputRect() 2024-06-28 17:09:22 -07:00
Sam Lantinga 42d8db7e34 Current Korean IMEs don't have candidates 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
Frank Praznik 44ec57626f vulkan: Don't set the opaque bit on transparent windows
If window transparency was requested via the SDL_WINDOW_TRANSPARENT flag, don't set the opaque bit on the swapchain composite alpha value. Fixes transparent windows when using the Vulkan renderer (e.g. testsprite --transparent).
2024-06-28 14:47:32 -04:00
hwsmm 915ef28753 Fix mouse button not changing in pen mouse emulation 2024-06-28 11:27:35 -04:00
Ryan C. Gordon 87439c0008 x11: Fix build when `X_HAVE_UTF8_STRING` is not defined.
Fixes #10094.

(cherry picked from commit 3e4bb5acd0)
2024-06-27 22:14:31 -07:00
Ryan C. Gordon d8e68aea9d
atomic: Solaris needs the `_nv` variant of `atomic_or_uint`.
(This means "new value" and returns the atomically updated value. Before, we
were returning a value from a void function.)

(cherry picked from commit 498cbffd89)
2024-06-27 23:50:31 -04:00
Sam Lantinga b7748c1513 Prevent duplicate calls to start/stop text input 2024-06-27 17:43:03 -07:00
Sam Lantinga 3609b15920 Fixed showing the selected clause in the Japanese IME 2024-06-27 17:43:03 -07: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 982feb7a65 vulkan: SDL_Vulkan_CreateSurface now returns the usual int (0=ok, -1=error).
Fixes #10091.
2024-06-27 15:25:10 -04:00
Ozkan Sezer a4f962fd46 SDL_x11shape.c: fix build if SDL_VIDEO_DRIVER_X11_XSHAPE isn't defined
Fixes :  https://github.com/libsdl-org/SDL/issues/10128.
2024-06-27 05:47:50 +03:00
Frank Praznik 800c35a2c1
dialog: Don't potentially call SDL_free() on an uninitialized value 2024-06-26 21:56:40 -04:00
Frank Praznik 596651f13a dialog: Decodes percent encoded URI paths returned by the xdg file portal 2024-06-26 21:31:35 -04:00
Frank Praznik 71200e94a8 core: Factor out common URI decode functions from Wayland and X11 2024-06-26 21:31:35 -04:00
Sam Lantinga 0ae4fd0ec9 Make sure we don't try to use the XInput DLL after it's unloaded
Steam ran into a crash SDL_XINPUT_JoystickDetect() with XINPUTGETCAPABILITIES being NULL. I'm not sure how that happened, and there may still be a race condition if this is a multi-threaded issue, but at least this is more correct.
2024-06-26 15:44:03 -07:00
Francisco Javier Trujillo Mata d86ea0622d Add slash to cwd call 2024-06-26 13:31:59 -07:00
Sam Lantinga 8949de3978 Fixed building with older libdrm headers 2024-06-26 12:18:43 -07:00
Sam Lantinga 56e85064ff Fixed audio recording latency after a hitch
We want to return any data as soon as it's available, if we get a hitch and always wait, we'll never catch up.
2024-06-26 12:06:03 -07:00
Sam Lantinga 80e64ef921 Windows IME cleanup
* Don't need to initialize values already zeroed
* Added debug message logging
* Don't send duplicate SDL_EVENT_TEXT_EDITING events with empty text
* Send the length of selected text in the SDL_EVENT_TEXT_EDITING event
* Fixed potential crashes when out of memory
2024-06-26 08:26:52 -07:00
hwsmm dc8b06fb5a Check if SDL_GetKeyboardFocus is null in X11/Wayland events 2024-06-26 08:11:54 -07:00
Edoardo Lolletti 64acde86de stdcpp threads, simplify SDL_GetCurrentThreadID implementation
Removed the workaround that handrolled a thread id using a thread_local variable alongside static mutexes
2024-06-26 09:06:27 -04:00
Cecill Etheredge e9a93246ef fix: Use drmModeAddFB2WithModifiers instead of drmModeAddFB to allow using GBM modifiers.
This fixes corrupt framebuffers on platforms that require the use of modifiers.

(cherry picked from commit 620e875335)
(cherry picked from commit 6589287ed6)
2024-06-25 14:21:36 -07:00