Add utility function to detect if SDL is inside a sandbox
Refactor the previous sandbox check in a standalone function that also includes Snap support. Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
This commit is contained in:
parent
a3ce700ded
commit
e8cb4da71f
8 changed files with 100 additions and 16 deletions
|
@ -36,6 +36,9 @@
|
|||
#include "../windows/SDL_rawinputjoystick_c.h"
|
||||
#endif
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
#include "../../core/linux/SDL_sandbox.h"
|
||||
#endif
|
||||
|
||||
struct joystick_hwdata
|
||||
{
|
||||
|
@ -398,11 +401,7 @@ HIDAPI_JoystickInit(void)
|
|||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
|
||||
"udev disabled by SDL_HIDAPI_JOYSTICK_DISABLE_UDEV");
|
||||
linux_enumeration_method = ENUMERATION_FALLBACK;
|
||||
} else if (access("/.flatpak-info", F_OK) == 0
|
||||
|| access("/run/host/container-manager", F_OK) == 0) {
|
||||
/* Explicitly check `/.flatpak-info` because, for old versions of
|
||||
* Flatpak, this was the only available way to tell if we were in
|
||||
* a Flatpak container. */
|
||||
} else if (SDL_DetectSandbox() != SDL_SANDBOX_NONE) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
|
||||
"Container detected, disabling HIDAPI udev integration");
|
||||
linux_enumeration_method = ENUMERATION_FALLBACK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue