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_ANGLE_PLATFORM_TYPE 0x00050002
#define GLFW_DEBUG_KEYBOARD 0x00050003 #define GLFW_DEBUG_KEYBOARD 0x00050003
#define GLFW_ENABLE_JOYSTICKS 0x00050004
/*! @brief macOS specific init hint. /*! @brief macOS specific init hint.
* *
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_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 true, // hat buttons
GLFW_ANGLE_PLATFORM_TYPE_NONE, // ANGLE backend GLFW_ANGLE_PLATFORM_TYPE_NONE, // ANGLE backend
false, // debug keyboard false, // debug keyboard
true, // enable joystick
{ {
true, // macOS menu bar true, // macOS menu bar
true // macOS bundle chdir true // macOS bundle chdir
@ -276,9 +275,6 @@ GLFWAPI void glfwInitHint(int hint, int value)
{ {
switch (hint) switch (hint)
{ {
case GLFW_ENABLE_JOYSTICKS:
_glfwInitHints.enableJoysticks = value;
return;
case GLFW_JOYSTICK_HAT_BUTTONS: case GLFW_JOYSTICK_HAT_BUTTONS:
_glfwInitHints.hatButtons = value; _glfwInitHints.hatButtons = value;
return; return;

1
glfw/internal.h vendored
View File

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

6
glfw/wl_init.c vendored
View File

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

10
glfw/x11_init.c vendored
View File

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

2
glfw/x11_window.c vendored
View File

@ -2653,7 +2653,7 @@ _glfwDispatchX11Events(void) {
unsigned dispatched = 0; unsigned dispatched = 0;
#if defined(__linux__) #if defined(__linux__)
if (_glfw.hints.init.enableJoysticks) _glfwDetectJoystickConnectionLinux(); _glfwDetectJoystickConnectionLinux();
#endif #endif
dispatched += dispatch_x11_queued_events(XEventsQueued(_glfw.x11.display, QueuedAfterFlush)); 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_ANGLE_PLATFORM_TYPE 0x00050002
#define GLFW_DEBUG_KEYBOARD 0x00050003 #define GLFW_DEBUG_KEYBOARD 0x00050003
#define GLFW_ENABLE_JOYSTICKS 0x00050004
/*! @brief macOS specific init hint. /*! @brief macOS specific init hint.
* *
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_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; } if (err) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; }
glfwSetErrorCallback(error_callback); glfwSetErrorCallback(error_callback);
glfwInitHint(GLFW_DEBUG_KEYBOARD, debug_keyboard); 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; OPT(debug_keyboard) = debug_keyboard != 0;
#ifdef __APPLE__ #ifdef __APPLE__
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0); glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);