Commit Graph

21727 Commits

Author SHA1 Message Date
Michael Fitzmayer
6e65c3fac4 [N-Gage] Remove optimisations except for native texture handling prior to some rework of the rendering back-end
[N-Gage] Set proper brush style to draw filled rects properly.

[N-Gage] Add persistent buffers to avoid per-frame memory allocations (which are expensive)

[N-Gage] Add support for SDL_TEXTURE_ACCESS_TARGET, fixes #13165

[N-Gage] Update README, add hint that the compiler does not support aggregate initializations for structs (knowing this, avoids a lot of headache during debugging)

[N-Gage] Add basic fast-path optimisations for render operations.

[N-Gage] Fix line drawing.
2026-04-18 19:54:30 +02:00
Frank Praznik
b181eb4ed0 x11: Fix #define name 2026-04-17 10:28:50 -04:00
Frank Praznik
75a65e05e1 x11: Use XInput2 events to pass through the keyboard ID to core key events
XInput2 keyboard handling has limitations: system keys that shouldn't be passed through when the keyboard isn't grabbed can be seen, and the text input system needs key events to flow through the X server to function properly (passing synthesized events through the filter function is not sufficient and doesn't work with non-Latin character sets).

The primary bit of information missing from the core X key events that XInput2 provides is the source device, so use the XInput2 slave keyboard device events to store that value, and apply it to core X key events with the same serial. XInput2 events always arrive before core events so this works universally.
2026-04-17 10:03:01 -04:00
Michael Fitzmayer
63901401ca [N-Gage] Micro-optimize main loop handler to improve performance and input latency
- Change active object priority from EPriorityLow to EPriorityStandard
- Process all events in batch before SDL_AppIterate() to reduce input lag
- Remove redundant SDL_PumpEvents() call (already done by SDL_PollEvent)
- Move clean-up logic into ShutdownApp() helper function
2026-04-16 21:38:09 +02:00
Michael Fitzmayer
badc3b82c5 [N-Gage] Micro-optimize rendering back-end
- Skip SDL_GetRenderScale call in Copy() fast path
- Cache last clear color to avoid redundant SetBrushColor calls
- Add whole-image bounds pre-check to skip per-pixel checks in rotation
- Simplify color packing in DrawPoints/FillRects to reduce overhead
2026-04-16 21:38:08 +02:00
Michael Fitzmayer
87e356f102 [N-Gage] Simplify rendering back-end; more micro-optimization
- Remove redundant null checks
- Use cached texture properties instead of API calls (GetBitmapWidth/Height/Pitch)
- Eliminate duplicate SDL_GetRenderScale() call in Copy()
- Reorder CopyEx() fast paths to check no-transform case first
- Combine operations in NGAGE_ConvertColor() to reduce intermediate steps
2026-04-16 21:38:08 +02:00
Michael Fitzmayer
b53b31b74a [N-Gage] Add various micro-optimizations to rendering back-end
- Add reusable line points buffer to eliminate per-call heap allocations in DrawLines.
- Cache last draw color to skip redundant SetPenColor/SetBrushColor calls.
- Pre-compute cardinal angle constants (0°, 90°, 180°, 270°) for CopyEx fast-path.
- Cache color modulation state to avoid redundant LUT rebuilds.
- Add missing break statement in HandleEvent.
- Initialize previously uninitialized lastTime variable in UpdateFPS.
2026-04-16 21:38:07 +02:00
Ryan C. Gordon
847fc72b1b CLAUDE.md: Just copy the text from AGENTS.md in here for now.
Someone mentioned that Claude sees this file's previous text and adds "look at
AGENTS.md" to it's TODO list instead of treating it as the thing it should do
first.

If everything decides to prefer AGENTS.md at some point, we'll delete this
file.

A symlink would apparently also work, but it would be the only symlink in the
SDL git repo, so it seemed less disruptive to just copy the file over for now.
2026-04-16 13:51:49 -04:00
Ryan C. Gordon
1124e44e4c CLAUDE.md: added.
Apparently Claude Code won't read AGENTS.md by default at this moment, but
since that's the direction we're moving, let's just add the file Claude
currently looks for and tell it that the actual instructions are in AGENTS.md.

I thought these things were supposed to be less complicated that interacting
with humans, lol.
2026-04-16 12:22:21 -04:00
Frank Praznik
c1bf0e9de9 wayland: Fix some comments
Fix grammar, and remove a TODO that is no longer relevant with an event thread.
2026-04-16 10:14:46 -04:00
Ryan C. Gordon
5bda0ccfb0 AGENTS.md: Change "may not" to "must not".
(Hat tip to Sean Barrett on the stronger wording here.)
2026-04-15 17:26:54 -04:00
Michael Fitzmayer
30522e8598 [N-Gage] Optimize renderer even further
- Replace FixDiv with inverse scale factors in ApplyScale
- Improve incremental DDA in ApplyRotation
- Optimize ApplyColorMod bit manipulation and LUT addressing
- Batch color changes in DrawPoints and FillRects to reduce API overhead
- Add early-exit optimizations to Copy/CopyEx for common cases
- Streamline Flip function by removing unnecessary API calls
- Fix vertex indexing bug in FillRects
2026-04-15 21:46:56 +02:00
Ryan C. Gordon
954e2f3354 policy: Clarify that "AI" means specific things. 2026-04-15 15:38:20 -04:00
Ryan C. Gordon
4711119605 policy: Updated AI-related text based on excellent feedback. 2026-04-15 15:38:20 -04:00
Ryan C. Gordon
08285d828e policy: Added to the PR template, and an AGENTS.md, refusing AI contributions.
Fixes #15350.
2026-04-15 15:38:20 -04:00
Michael Fitzmayer
5bd1a65e6f [N-Gage] Add LUT color mod, cardinal rotation cache and loop unrolling
- Implement lookup tables for faster color modulation
- Cache 0°/90°/180°/270° rotations for speedup on common angles
- Add dirty rectangle tracking infrastructure
- Process 4 pixels at a time in all transform operations
2026-04-15 20:36:42 +02:00
Michael Fitzmayer
e5c8523b36 [N-Gage] Preserve source textures and optimize rotation with DDA
- Add temporary render bitmap to avoid destroying source texture data
- Implement incremental DDA algorithm for rotation
- Replaces per-pixel FixMul operations with simple additions and preserves
  textures for reuse.
2026-04-15 20:36:41 +02:00
Michael Fitzmayer
4870f81d9c [N-Gage] Optimize rendering back-end
- Remove SDL_Surface member from NGAGE_TextureData structure and update all functions that currently use
  surface->pixels to instead access bitmap->DataAddress() directly. This eliminates the intermediate copy
  step (Mem::Copy from surface to bitmap) in rendering operations.

- Eliminate per-frame allocations in Copy/CopyEx methods. These buffers are now allocated once and resized
  only when needed.
2026-04-15 20:36:41 +02:00
Ryan C. Gordon
a49a5e87a9 wikiheaders: Don't escape . chars in manpage's brief section.
Otherwise, the `apropos` command gets upset.

Fixes #15387.
2026-04-15 13:28:52 -04:00
Cameron Gutman
59267ed800 atomic: Use __atomic_load_n on Android 2026-04-14 17:38:08 -05:00
Cameron Gutman
dba9aa147c atomic: Switch to SDL_HAS_BUILTIN to detect __atomic_load_n 2026-04-14 17:38:08 -05:00
rewine
59ee54d136 wayland: bind cursor-shape-v1 at protocol version 2
cursor-shape-v1 version 2 adds dnd_ask and all_resize, but SDL_SystemCursor does not expose matching cursor types yet. Bind the protocol at version 2 now so SDL negotiates the updated interface correctly while keeping the current cursor mapping unchanged.
2026-04-14 10:22:48 -04:00
Anonymous Maarten
c00e9c991e test: use SDL_test for event handling 2026-04-14 02:46:42 +02:00
Anonymous Maarten
745f9905c1 test: render name of current active cursor 2026-04-14 02:46:42 +02:00
David Vanderson
5e0f721fd4 xinput2: correct horizontal touchpad scrolling direction
This fixes testmouse so when fingers move left the green line moves
left.
2026-04-13 19:43:59 -04:00
eafton
e4f75bac45 Remove SDL_gtk 2026-04-12 13:36:31 -07:00
Frank Praznik
dd6d49afbd wayland: Enable text input even when the text input protocol is not available.
Even without the text input protocol, basic text can still be obtained from individual keys and the composition system.
2026-04-12 13:02:50 -04:00
MAJigsaw77
7f12b975bb Use singleTop launchMode for SDLActivity on Android 2026-04-11 20:04:46 +02:00
Frank Praznik
f40955cd00 test: Render a blank window in testtray
Some platforms require drawing something to the window for it to be mapped, so create a renderer and redraw on exposure events.

Additionally, add the license to the testtray.c file and clang-format the source.
2026-04-11 10:11:43 -04:00
David Gow
cf4edb73e7 tray:dbus: Re-instate the _parent fields in SDL_dbustray structs
The various SDL_Tray*DBus structs are supposed to be backend-specific
subclasses of the corresponding SDL_Tray* structs. This is done by making
the first member be a 'parent' of that type, so that, e.g., SDL_TrayDriverDBus
can be cast into an SDL_TrayDriver. However, these '_parent' members were
mistakenly removed in commit ce90105cf8 ("Clean up the tray D-Bus code"), as
they're never directly referenced.

Reinstate these variables, and instead of casting SDL_Tray*DBus to SDL_Tray* on
creation, reference the _parent member directly, so that any tooling will know
the variable is indeed used. In addition, rename _parent to class_parent, to
make its purpose more obvious.

Fixes: ce90105cf8 ("Clean up the tray D-Bus code")
2026-04-11 05:11:03 -07:00
Anonymous Maarten
4ab8ecf02d ci: run tests on Linux under gdb (if available) 2026-04-11 04:12:15 +02:00
Anonymous Maarten
396eeff350 cmake: add SDLTEST_GDB option to run tests under gdb debugger printing stacktraces 2026-04-11 04:12:15 +02:00
Anonymous Maarten
9d97e663d9 ci: add option to set ctest arguments 2026-04-11 04:12:15 +02:00
Frank Praznik
db1506123e Fix spacing in the D-Bus source 2026-04-10 20:47:17 -04:00
Frank Praznik
ce90105cf8 Clean up the tray D-Bus code
Run clang-format to clean up whitespace issues, and remove some unused struct members.
2026-04-10 20:38:56 -04:00
eafton
8c024f4f3a SNI/DBus tray support (#15189) 2026-04-10 14:11:38 -07:00
Nintorch
4aa0a6e2bf Fix Oklick W-2 support
This PR maps buttons 7 and 8 to paddles 2 (left) and 1 (right) respectively, and it also duplicates the mapping but for crc 0x2004, since the CRC of this controller changes if it was hotplugged.
2026-04-10 10:56:16 -07:00
Mathieu Eyraud
dc16a35140 Don't call function pointer when it is NULL 2026-04-10 10:53:58 -07:00
Cameron Gutman
463b6be133 kmsdrm: Fix order of GBM and EGL teardown
All locked front buffers must be released prior to destroying
the EGL surface to avoid causing a UAF in libnvidia-egl-gbm.so.
2026-04-10 10:38:30 -07:00
Frank Praznik
0fc9db9b82 x11: Ignore slave button presses on non-focused windows
When a window has the pointer grabbed, the X server will grab all master device events, and XInput2 will continue to deliver slave events to the window immediately under the pointer, regardless of grab status. Only send slave pointer events to the focused window, and fall back to the core X events to catch button presses missed when the pointer is over another window.
2026-04-10 12:49:30 -04:00
Sylvain
ccf688c921 Android: fix lint warning "unneed cast to Activity" 2026-04-10 07:08:07 -07:00
Cameron Gutman
c2d0b59f29 kmsdrm: Fix double-free of GBM surface buffer in atomic mode 2026-04-10 00:05:31 -05:00
Sam Lantinga
57f3d2ea0a Don't send any commands to the GPU while hidden
Previously we weren't doing drawing, but we were enqueuing viewport commands and so forth, which were causing GPU permission errors on iOS. We really don't want to be sending any work to the GPU when we're in the background.
2026-04-08 10:08:11 -07:00
Sam Lantinga
5c430f8715 Fixed SDL_GlobDirectory() on asset paths on Android
Make sure we pass the original path back to the directory enumeration callback.
2026-04-08 09:09:29 -07:00
Sam Lantinga
51aeebd889 testcolorspace: fixed color check when output is linear colorspace with 8-bit precision 2026-04-07 14:05:51 -07:00
Sam Lantinga
cf71571c96 testcolorspace: use the SDL main callbacks 2026-04-07 14:05:51 -07:00
Sam Lantinga
7f23f09ee8 Fixed crash if SDL_SYS_CreateThread() fails (thanks @capehill!)
Fixes https://github.com/libsdl-org/SDL/issues/15340
2026-04-07 12:23:07 -07:00
Ozkan Sezer
f61a22e10f SDL_hidapi_zuiki.c: silence bogus -Warray-bounds warnings from gcc-4.9 2026-04-07 06:45:10 +03:00
Frank Praznik
b8e8caf7c5 dbus: Better handle local URI paths
Decode file URIs before trying to open them, and properly handle non-URI local paths.
2026-04-06 19:43:45 -04:00
Anonymous Maarten
928cfef4b7 ci: bump workflows 2026-04-07 01:27:33 +02:00