Linux: Fix build with `use_sowrap=no` and various warnings/errors

(cherry picked from commit dcd16a5750)
This commit is contained in:
Rémi Verschelde 2023-07-06 14:05:28 +02:00 committed by Yuri Sizov
parent e3cfc023b4
commit 6ec2d6d7d0
2 changed files with 16 additions and 10 deletions

View File

@ -98,19 +98,20 @@ static bool detect_sandbox() {
JoypadLinux::JoypadLinux(Input *in) { JoypadLinux::JoypadLinux(Input *in) {
#ifdef UDEV_ENABLED #ifdef UDEV_ENABLED
#ifdef SOWRAP_ENABLED
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
int dylibloader_verbose = 0;
#endif
if (detect_sandbox()) { if (detect_sandbox()) {
// Linux binaries in sandboxes / containers need special handling because // Linux binaries in sandboxes / containers need special handling because
// libudev doesn't work there. So we need to fallback to manual parsing // libudev doesn't work there. So we need to fallback to manual parsing
// of /dev/input in such case. // of /dev/input in such case.
use_udev = false; use_udev = false;
print_verbose("JoypadLinux: udev enabled, but detected incompatible sandboxed mode. Falling back to /dev/input to detect joypads."); print_verbose("JoypadLinux: udev enabled, but detected incompatible sandboxed mode. Falling back to /dev/input to detect joypads.");
} else { }
#ifdef SOWRAP_ENABLED
else {
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
int dylibloader_verbose = 0;
#endif
use_udev = initialize_libudev(dylibloader_verbose) == 0; use_udev = initialize_libudev(dylibloader_verbose) == 0;
if (use_udev) { if (use_udev) {
if (!udev_new || !udev_unref || !udev_enumerate_new || !udev_enumerate_add_match_subsystem || !udev_enumerate_scan_devices || !udev_enumerate_get_list_entry || !udev_list_entry_get_next || !udev_list_entry_get_name || !udev_device_new_from_syspath || !udev_device_get_devnode || !udev_device_get_action || !udev_device_unref || !udev_enumerate_unref || !udev_monitor_new_from_netlink || !udev_monitor_filter_add_match_subsystem_devtype || !udev_monitor_enable_receiving || !udev_monitor_get_fd || !udev_monitor_receive_device || !udev_monitor_unref) { if (!udev_new || !udev_unref || !udev_enumerate_new || !udev_enumerate_add_match_subsystem || !udev_enumerate_scan_devices || !udev_enumerate_get_list_entry || !udev_list_entry_get_next || !udev_list_entry_get_name || !udev_device_new_from_syspath || !udev_device_get_devnode || !udev_device_get_action || !udev_device_unref || !udev_enumerate_unref || !udev_monitor_new_from_netlink || !udev_monitor_filter_add_match_subsystem_devtype || !udev_monitor_enable_receiving || !udev_monitor_get_fd || !udev_monitor_receive_device || !udev_monitor_unref) {
@ -124,10 +125,11 @@ JoypadLinux::JoypadLinux(Input *in) {
print_verbose("JoypadLinux: udev enabled, but couldn't be loaded. Falling back to /dev/input to detect joypads."); print_verbose("JoypadLinux: udev enabled, but couldn't be loaded. Falling back to /dev/input to detect joypads.");
} }
} }
#endif #endif // SOWRAP_ENABLED
#else #else
print_verbose("JoypadLinux: udev disabled, parsing /dev/input to detect joypads."); print_verbose("JoypadLinux: udev disabled, parsing /dev/input to detect joypads.");
#endif #endif // UDEV_ENABLED
input = in; input = in;
monitor_joypads_thread.start(monitor_joypads_thread_func, this); monitor_joypads_thread.start(monitor_joypads_thread_func, this);
joypad_events_thread.start(joypad_events_thread_func, this); joypad_events_thread.start(joypad_events_thread_func, this);

View File

@ -5449,7 +5449,9 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
} }
#else #else
#ifdef XKB_ENABLED #ifdef XKB_ENABLED
xkb_loaded = true; bool xkb_loaded = true;
xkb_loaded_v05p = true;
xkb_loaded_v08p = true;
#endif #endif
#endif #endif
@ -5476,6 +5478,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
r_error = OK; r_error = OK;
#ifdef SOWRAP_ENABLED
{ {
if (!XcursorImageCreate || !XcursorImageLoadCursor || !XcursorImageDestroy || !XcursorGetDefaultSize || !XcursorGetTheme || !XcursorLibraryLoadImage) { if (!XcursorImageCreate || !XcursorImageLoadCursor || !XcursorImageDestroy || !XcursorGetDefaultSize || !XcursorGetTheme || !XcursorLibraryLoadImage) {
// There's no API to check version, check if functions are available instead. // There's no API to check version, check if functions are available instead.
@ -5484,6 +5487,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
return; return;
} }
} }
#endif
for (int i = 0; i < CURSOR_MAX; i++) { for (int i = 0; i < CURSOR_MAX; i++) {
cursors[i] = None; cursors[i] = None;