From 78efefcea1e3e3b8f900c9d80a10f7fafbc56cf1 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 23 Jul 2020 13:32:52 +0200 Subject: [PATCH] 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. --- glfw/glfw3.h | 1 - glfw/init.c | 4 ---- glfw/internal.h | 1 - glfw/wl_init.c | 6 ++---- glfw/x11_init.c | 10 ++++------ glfw/x11_window.c | 2 +- kitty/glfw-wrapper.h | 1 - kitty/glfw.c | 3 --- 8 files changed, 7 insertions(+), 21 deletions(-) diff --git a/glfw/glfw3.h b/glfw/glfw3.h index 4215dcf32..601dbeef8 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -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). diff --git a/glfw/init.c b/glfw/init.c index ca3af4d0c..80d1d9387 100644 --- a/glfw/init.c +++ b/glfw/init.c @@ -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; diff --git a/glfw/internal.h b/glfw/internal.h index f6f849d16..feb150d0c 100644 --- a/glfw/internal.h +++ b/glfw/internal.h @@ -276,7 +276,6 @@ struct _GLFWinitconfig bool hatButtons; int angleType; bool debugKeyboard; - bool enableJoysticks; struct { bool menubar; bool chdir; diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 1db1b8b79..ae78fcbac 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -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) diff --git a/glfw/x11_init.c b/glfw/x11_init.c index 4252f4490..c9dfa252d 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -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(); diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 15d2f1c6f..f8dce617f 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -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)); diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index 61762bf13..8ee395f63 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -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). diff --git a/kitty/glfw.c b/kitty/glfw.c index 72208ae71..9587bdcb9 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -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);