When skipping presentation due to the window being hidden, presentDataCount is not incremented on the command buffer, and subsequently the submitted command buffers will not be cleaned up as long as the window is hidden. This results in a lag spike when showing the window due to all previously submitted command buffers suddenly being cleaned up at once, and lag at shutdown due to an equivalent number of fences needing to be destroyed.
Instead of relying on presentDataCount to determine whether a command buffer should be cleaned up, use a flag, which is set under the appropriate circumstances.
- gtk_init_check claims it will not terminate the program on failure, however this is does
not apply to the internal check it performs to see whether another GTK library is already
loaded, the detection of which triggers a g_error which glib treats as fatal.
- gtk_progress_get_type and gtk_misc_get_type are checked to match the checks done
by _gtk_module_has_mixed_deps.
- Clean up gtk/gdk loading. There are no library fallbacks so the one option available can
be loaded rather than iterating through a list of one item.
There is a bug where SInput checks for player led capability before
setting RGB. This means that if a controller does not have a player led,
RGB commands are not sent.
There may have been a reason for not attaching a null buffer when destroying a popup at some point in the past, but that is unnecessary now, as is the comment about ShowWindow crashing, as ShowWindow assures that a null buffer is attached before (re)creating the window.
The previous calculation could result in a window whose original position was positioned exactly corner-to-corner with the parent not being adjusted to be adjoining, and thus subject to spurious closure.
- Android defines SDL_PLATFORM_UNIX but does not compile core/unix sources
so add checks for SDL_PLATFORM_ANDROID where SDL_gtk is used.
- Fix missing void parameter list in SDL_Gtk_EnterContext.
- Remove unneeded SDL_gtk.h include in SDL_events.c
- This is to support dynamic updates of content scale when running in XWayland. The GTK signal is
preferred over the XSettings watcher and Xrm database if supported as it will trigger and update
for both native X11 and XWayland on changes to Xft.dpi.
- SDL creates and requires usage of a specific glib context. This context is set as the global
glib context with SDL_Gtk_EnterContext and the previous context is restored with
SDL_Gtk_ExitContext.
- To avoid changing the behavior of SDL_tray, which is the only consumer of SDL_gtk currently,
the SDL_UpdateTray function now unconditionally runs a single glib frame iteration and is
responsible for dispatching glib events for all consumers in SDL_PumpEvents.
- Cleaned up some error handling in SDL_tray.
The current implementation uses the returned address of the `dlsym` function
directly to load the `environ` symbol. But this function doesn't return the
address to the symbol itself, instead it returns the address to the location
where the actual address is stored, i.e. it's an additional indirection.
Consequently, the implementation fails to load and process the environment
variables successfully.
One example where this error shows up is in the `Dialog API`: in an `X11`
environment, the `zenity` driver requires access to the user's `DISPLAY` and
`XAUTHORITY` environment variables. Because these variables aren't transfered
to the `zenity` process, no dialogs are shown. This can be exercised in the
`test/testdialog.c` testprogram.
The fix changes the indirection level of the `dlsym` call from `char **` to
`char ***`, does a `NULL`-check in case the call failed, and returns the
dereferenced actual adress to the `environ` symbol.
xpad has a series of questionable design choices when it comes to button
mapping. Notably, BTN_TRIGGER_HAPPY1-4 are used for the D-pad on dance mats
instead of the typical BTN_DPAD_*, and maps the paddles to
BTN_TRIGGER_HAPPY5-8. This commit plumbs through driver detection for a udev
device and adds special exceptions for xpad's quirks.
Newer kernels (6.17+) add the BTN_GRIP* mappings for paddles on controllers. We
should prefer that if available, as its meaning and mapping is unambiguous.
However, since it's only in new kernels, we need to maintain the older mappings
where we know they exist.
It also exposes KEY_RECORD as the share button regardless of vendor, which had
previously been gated behind being a Microsoft controller. All Xbox Series
controllers can include this button, and many third party ones do.
- Implements 'handheld' flag to indicate whether the SInput device is a gamepad or handheld (ROG Ally etc)
- Implements generic mapping fallback along with face style setting ability