diff --git a/glfw/main_loop.h b/glfw/main_loop.h index 74bdae368..7f8bbc21e 100644 --- a/glfw/main_loop.h +++ b/glfw/main_loop.h @@ -12,10 +12,9 @@ #define GLFW_LOOP_BACKEND x11 #endif -static GLFWbool keep_going = GLFW_FALSE, tick_callback_requested = GLFW_FALSE; +static GLFWbool keep_going = GLFW_FALSE; void _glfwPlatformRequestTickCallback() { - tick_callback_requested = GLFW_TRUE; } void _glfwPlatformStopMainLoop(void) { @@ -25,16 +24,12 @@ void _glfwPlatformStopMainLoop(void) { } } -void _glfwPlatformRunMainLoop(GLFWtickcallback callback, void* data) { +void _glfwPlatformRunMainLoop(GLFWtickcallback tick_callback, void* data) { keep_going = GLFW_TRUE; - tick_callback_requested = GLFW_FALSE; while(keep_going) { - EVDBG("tick_callback_requested: %d", tick_callback_requested); - while (tick_callback_requested) { - tick_callback_requested = GLFW_FALSE; - callback(data); - } _glfwPlatformWaitEvents(); + EVDBG("loop tick"); + tick_callback(data); } } diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 00109396c..e2046d6a6 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -940,8 +940,7 @@ process_global_state(void *data) { if (global_state.has_pending_closes) has_open_windows = process_pending_closes(self); if (has_open_windows) { if (maximum_wait >= 0) { - if (maximum_wait == 0) request_tick_callback(); - else state_check_timer_enabled = true; + state_check_timer_enabled = true; } } else { stop_main_loop(); diff --git a/kitty/glfw.c b/kitty/glfw.c index 1f2dbfa9a..f2c9b643f 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -27,6 +27,14 @@ static GLFWcursor *standard_cursor = NULL, *click_cursor = NULL, *arrow_cursor = static void set_os_window_dpi(OSWindow *w); + +static void +request_tick_callback(void) { +#ifdef __APPLE__ + glfwRequestTickCallback(); +#endif +} + void update_os_window_viewport(OSWindow *window, bool notify_boss) { int w, h, fw, fh; @@ -1128,11 +1136,6 @@ run_main_loop(tick_callback_fun cb, void* cb_data) { glfwRunMainLoop(cb, cb_data); } -void -request_tick_callback(void) { - glfwRequestTickCallback(); -} - void stop_main_loop(void) { glfwStopMainLoop(); diff --git a/kitty/state.h b/kitty/state.h index 84bcb75c2..fbdac3383 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -238,5 +238,4 @@ id_type add_main_loop_timer(double interval, bool repeats, timer_callback_fun ca void remove_main_loop_timer(id_type timer_id); void update_main_loop_timer(id_type timer_id, double interval, bool enabled); void run_main_loop(tick_callback_fun, void*); -void request_tick_callback(void); void stop_main_loop(void);