(DRM/KMS) If we have the X11 input driver selected, default to udev and/or

linuxraw driver instead
This commit is contained in:
twinaphex 2017-06-06 21:15:32 +02:00
parent 96bfb35e0b
commit 3443153ccc

View File

@ -35,7 +35,9 @@
#include <lists/dir_list.h>
#include <streams/file_stream.h>
#include <string/stdstring.h>
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../frontend/frontend_driver.h"
#include "../common/drm_common.h"
@ -732,9 +734,42 @@ static void gfx_ctx_drm_destroy(void *data)
}
static void gfx_ctx_drm_input_driver(void *data,
const char *name,
const char *joypad_name,
const input_driver_t **input, void **input_data)
{
#ifdef HAVE_X11
settings_t *settings = config_get_ptr();
/* We cannot use the X11 input driver for DRM/KMS */
if (string_is_equal(settings->arrays.input_driver, "x"))
{
#ifdef HAVE_UDEV
{
/* Try to set it to udev instead */
void *udev = input_udev.init(joypad_name);
if (udev)
{
*input = &input_udev;
*input_data = udev;
return;
}
}
#endif
#if defined(__linux__) && !defined(ANDROID)
{
/* Try to set it to linuxraw instead */
void *linuxraw = input_linuxraw.init(joypad_name);
if (linuxraw)
{
*input = &input_linuxraw;
*input_data = linuxraw;
return;
}
}
#endif
}
#endif
*input = NULL;
*input_data = NULL;
}