Merge pull request #8897 from orbea/khr

Try using the udev or linuxraw input drivers for khr_display.
This commit is contained in:
Twinaphex 2019-06-02 09:07:35 +02:00 committed by GitHub
commit cc22680480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@
*/
#include <compat/strl.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -154,9 +155,42 @@ error:
}
static void gfx_ctx_khr_display_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;
}