- Removed gtk-xft-dpi read from GetGlobalContentScale. Xrm either returns either the same value as gtk-xft-dpi or the integer
scale value in cases where gtk-xft-dpi is 1.
- Refactor SDL_x11settings handlers to defer to GetGlobalContentScale
- GetGlobalContentScale is now exported and the XSettings and Gtk signal handlers now use it for consistency. This involves
a bit of extra work reading from Xrm rather than the setting notification but ensures consistent handling based on signal
origin and hints enabled.
- Hook both gtk-xft-dpi in SDL_x11settings. This should generally result in only one being called based on which is updated.
Since both signal handlers defer to X11_GetGlobalContentScale this will cause the same content scale to be applied multiple
times. The gtk-xft-dpi signal is now only used to trigger content scale updates when the XSettings notification does not occur.
This reverts commit 47d8bdd1c3.
There are runtime reasons why creating a tray can fail, so the correct approach is not to assume that just because a platform supports a tray that trays are available. Instead, you should create a tray at application startup, for the lifetime of the application, and handle failures at that point.
Closes https://github.com/libsdl-org/SDL/pull/13632
ABXY Face Style Application
- The abxy face style extraction now applies to any SInput device.
- The use-case here is that gamepads that allow for changing styles can dynamically adjust the button labels firmware-side to have the physical location better represent the actual button being pressed.
SInput Sub-Type Clarification
- The code has been updated to better reflect the intention behind the sub-type field of the GUID byte 15.
- Any SInput device may utilize the Sub-Type field to indicate variants of the same device (Same device that has rear paddles or additional physical features but is otherwise identical, etc.).
"Firebird" Company Name Clarification
- "Bonjiri" was a wrong translation. Got clarification from the company and official PID registration for the official English spelling (See 0c5234cd92).
- Fixed this spelling for all references (official mapping strings still pending and this will return NULL until this is provided).
Code Notes
- Various notes have been updated to have more clear indications.
- I have moved the face-type and sub-type debug messages to be paired with the extraction for easier location.
- I've removed an incorrect note left-over from a previous commit regarding command response information.
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.