Revert "Linux: Fix slow startup on some systems caused by GLFW searching for joysticks. Since kitty does not use joysticks, disable joystick support."

This reverts commit ab960ea12d3e1e3489898b663f8d678ece8b2409.
This commit is contained in:
Luflosi 2020-07-23 13:32:52 +02:00
parent 1bb6242020
commit 78efefcea1
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0
8 changed files with 7 additions and 21 deletions

1
glfw/glfw3.h vendored
View File

@ -1202,7 +1202,6 @@ typedef enum {
*/
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
#define GLFW_DEBUG_KEYBOARD 0x00050003
#define GLFW_ENABLE_JOYSTICKS 0x00050004
/*! @brief macOS specific init hint.
*
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).

4
glfw/init.c vendored
View File

@ -55,7 +55,6 @@ static _GLFWinitconfig _glfwInitHints =
true, // hat buttons
GLFW_ANGLE_PLATFORM_TYPE_NONE, // ANGLE backend
false, // debug keyboard
true, // enable joystick
{
true, // macOS menu bar
true // macOS bundle chdir
@ -276,9 +275,6 @@ GLFWAPI void glfwInitHint(int hint, int value)
{
switch (hint)
{
case GLFW_ENABLE_JOYSTICKS:
_glfwInitHints.enableJoysticks = value;
return;
case GLFW_JOYSTICK_HAT_BUTTONS:
_glfwInitHints.hatButtons = value;
return;

1
glfw/internal.h vendored
View File

@ -276,7 +276,6 @@ struct _GLFWinitconfig
bool hatButtons;
int angleType;
bool debugKeyboard;
bool enableJoysticks;
struct {
bool menubar;
bool chdir;

6
glfw/wl_init.c vendored
View File

@ -772,10 +772,8 @@ int _glfwPlatformInit(void)
wl_display_roundtrip(_glfw.wl.display);
#ifdef __linux__
if (_glfw.hints.init.enableJoysticks) {
if (!_glfwInitJoysticksLinux())
return false;
}
if (!_glfwInitJoysticksLinux())
return false;
#endif
if (!_glfw.wl.wmBase)

10
glfw/x11_init.c vendored
View File

@ -654,12 +654,10 @@ int _glfwPlatformInit(void)
_glfw.x11.hiddenCursorHandle = createHiddenCursor();
#if defined(__linux__)
if (_glfw.hints.init.enableJoysticks) {
if (!_glfwInitJoysticksLinux())
return false;
if (_glfw.linjs.inotify > 0)
addWatch(&_glfw.x11.eventLoopData, "joystick", _glfw.linjs.inotify, POLLIN, 1, NULL, NULL);
}
if (!_glfwInitJoysticksLinux())
return false;
if (_glfw.linjs.inotify > 0)
addWatch(&_glfw.x11.eventLoopData, "joystick", _glfw.linjs.inotify, POLLIN, 1, NULL, NULL);
#endif
_glfwPollMonitorsX11();

2
glfw/x11_window.c vendored
View File

@ -2653,7 +2653,7 @@ _glfwDispatchX11Events(void) {
unsigned dispatched = 0;
#if defined(__linux__)
if (_glfw.hints.init.enableJoysticks) _glfwDetectJoystickConnectionLinux();
_glfwDetectJoystickConnectionLinux();
#endif
dispatched += dispatch_x11_queued_events(XEventsQueued(_glfw.x11.display, QueuedAfterFlush));

1
kitty/glfw-wrapper.h generated
View File

@ -940,7 +940,6 @@ typedef enum {
*/
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
#define GLFW_DEBUG_KEYBOARD 0x00050003
#define GLFW_ENABLE_JOYSTICKS 0x00050004
/*! @brief macOS specific init hint.
*
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).

View File

@ -814,9 +814,6 @@ glfw_init(PyObject UNUSED *self, PyObject *args) {
if (err) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; }
glfwSetErrorCallback(error_callback);
glfwInitHint(GLFW_DEBUG_KEYBOARD, debug_keyboard);
// Joysticks cause slow startup on some linux systems, see
// https://github.com/kovidgoyal/kitty/issues/830
glfwInitHint(GLFW_ENABLE_JOYSTICKS, 0);
OPT(debug_keyboard) = debug_keyboard != 0;
#ifdef __APPLE__
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);