* [tray/dbus] set tray session name to app subname in flatpak env
* [tray/dbus] have dbus service name come from the app id. app id falls
back to flatpak if in a flatpak environment
* [tray/dbus] change dbus menu path to work with apparmor
Returning true with an unavailable interface in no-op cases can prevent fallback to other inhibition methods. If the inhibitor interface was previously tried and marked as unavailable, just return false.
Currently, the SDL_Tray* structs in the unix backend are subclassed for each
implementation (only dbus so far). This means that the DBus-specific members
are in their own structs (SDL_Tray*DBus), which all are required to have the
corresponding 'parent' struct as their first member, so that they can be cast
easily and used in the more generic code.
However, other SDL systems which have pluggable backends work the other way
around: the 'generic' struct has an 'internal' member, which individual
drivers can use to store a pointer to any internal state. This is a bit
simpler to wrap one's head around -- particularly because it's consistent --
but does typically involve more memory allocations.
Change the unix/DBus tray implementations to use an 'internal' pointer to
match other subsystems.
When the pointer isn't being scaled, make sure the cursor scale factor is set to that of the window to avoid blurry cursors on high-DPI desktops, and use the inverse of the pointer scale value when selecting buffers for size-adjusted cursors. Fixes a regression from adjusting custom cursor sizes when using scale to display mode, and ensures that the best buffer size for the scaled cursor is always selected.
__sync_lock_test_and_set() is designed for creating locks, not as
a general atomic exchange function. As a result, it only provides
an acquire memory barrier and isn't guaranteed to actually store
the provided value (though it does on architectures we care about).
__atomic_exchange_n() is supported on GCC/Clang for the last ~10
years, so let's use that instead if available. We will keep the
__sync_lock_test_and_set() fallback around for ancient platforms,
but add a full memory barrier to match the documented behavior.
[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.
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.
- 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
- 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
- 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
- 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.
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.
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.
- 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
- 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
- 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.
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.
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.
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")