From 1ba76508de7db187be85613a13bd6a6eb572be45 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 26 May 2018 12:26:17 +0530 Subject: [PATCH] More detailed error message when cursor creation fails --- kitty/glfw.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kitty/glfw.c b/kitty/glfw.c index 41a96fae5..890f62695 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -403,12 +403,11 @@ create_os_window(PyObject UNUSED *self, PyObject *args) { // This needs to be done only after the first window has been created, because glfw only sets the activation policy once upon initialization. if (OPT(macos_hide_from_tasks)) cocoa_set_hide_from_tasks(); #endif - standard_cursor = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR); - click_cursor = glfwCreateStandardCursor(GLFW_HAND_CURSOR); - arrow_cursor = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); - if (standard_cursor == NULL || click_cursor == NULL || arrow_cursor == NULL) { - log_error("Failed to create standard mouse cursors, using default cursor only."); - } +#define CC(dest, shape) {\ + dest##_cursor = glfwCreateStandardCursor(GLFW_##shape##_CURSOR); \ + if (dest##_cursor == NULL) { log_error("Failed to create the %s mouse cursor, using default cursor.", #shape); }} + CC(standard, IBEAM); CC(click, HAND); CC(arrow, ARROW); +#undef CC is_first_window = false; } OSWindow *w = add_os_window();