diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index cb9c2a09e..abccfe7f9 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -21,6 +21,12 @@ #include extern PyTypeObject Screen_Type; +#ifdef DEBUG_EVENT_LOOP +#define EVDBG(...) log_event(__VA_ARGS__) +#else +#define EVDBG(...) +#endif + #define EXTRA_FDS 2 #ifndef MSG_NOSIGNAL // Apple does not implement MSG_NOSIGNAL @@ -884,6 +890,7 @@ static void process_global_state(void *data); static void do_state_check(id_type timer_id UNUSED, void *data UNUSED) { + EVDBG("State check timer fired"); #ifdef __APPLE__ process_global_state(data); #endif @@ -896,6 +903,7 @@ static id_type state_check_timer = 0; static void process_global_state(void *data) { + EVDBG("Processing global state"); ChildMonitor *self = data; maximum_wait = -1; bool state_check_timer_enabled = false; diff --git a/kitty/data-types.h b/kitty/data-types.h index 0e5027c22..150a0b47b 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -313,3 +313,4 @@ SPRITE_MAP_HANDLE alloc_sprite_map(unsigned int, unsigned int); SPRITE_MAP_HANDLE free_sprite_map(SPRITE_MAP_HANDLE); static inline void safe_close(int fd) { while(close(fd) != 0 && errno == EINTR); } +void log_event(const char *format, ...) __attribute__((format(printf, 1, 2))); diff --git a/kitty/glfw.c b/kitty/glfw.c index 997ce3a3f..5cac45655 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -66,6 +66,22 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) { } } +void +log_event(const char *format, ...) { + if (format) + { + va_list vl; + + fprintf(stderr, "[%.4f] ", glfwGetTime()); + va_start(vl, format); + vfprintf(stderr, format, vl); + va_end(vl); + fprintf(stderr, "\n"); + } + +} + + // callbacks {{{ void