From c152624634b8b4482352c885cc0d1e061a824b7b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 2 Feb 2021 09:00:28 +0530 Subject: [PATCH] Rename state variable to be closer to its actual purpose --- kitty/child-monitor.c | 8 ++++---- kitty/glfw.c | 4 ++-- kitty/graphics.c | 4 ++-- kitty/state.c | 2 +- kitty/state.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 6b75efd3c..4550040ea 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -594,7 +594,7 @@ prepare_to_render_os_window(OSWindow *os_window, monotonic_t now, unsigned int * monotonic_t min_gap; if (scan_active_animations(WD.screen->grman, now, &min_gap, true)) needs_render = true; if (min_gap < MONOTONIC_T_MAX) { - global_state.has_active_animated_images = true; + global_state.check_for_active_animated_images = true; set_maximum_wait(min_gap); } } @@ -670,7 +670,7 @@ no_render_frame_received_recently(OSWindow *w, monotonic_t now, monotonic_t max_ static inline void render(monotonic_t now, bool input_read) { - EVDBG("input_read: %d, has_active_animated_images: %d", input_read, global_state.has_active_animated_images); + EVDBG("input_read: %d, check_for_active_animated_images: %d", input_read, global_state.check_for_active_animated_images); static monotonic_t last_render_at = MONOTONIC_T_MIN; monotonic_t time_since_last_render = last_render_at == MONOTONIC_T_MIN ? OPT(repaint_delay) : now - last_render_at; if (!input_read && time_since_last_render < OPT(repaint_delay)) { @@ -678,8 +678,8 @@ render(monotonic_t now, bool input_read) { return; } - const bool scan_for_animated_images = global_state.has_active_animated_images; - global_state.has_active_animated_images = false; + const bool scan_for_animated_images = global_state.check_for_active_animated_images; + global_state.check_for_active_animated_images = false; for (size_t i = 0; i < global_state.num_os_windows; i++) { OSWindow *w = global_state.os_windows + i; diff --git a/kitty/glfw.c b/kitty/glfw.c index 79e49ba92..70fc4ab37 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -162,7 +162,7 @@ window_close_callback(GLFWwindow* window) { static void window_occlusion_callback(GLFWwindow *window, bool occluded) { if (!set_callback_window(window)) return; - if (!occluded) global_state.has_active_animated_images = true; + if (!occluded) global_state.check_for_active_animated_images = true; request_tick_callback(); global_state.callback_os_window = NULL; } @@ -170,7 +170,7 @@ window_occlusion_callback(GLFWwindow *window, bool occluded) { static void window_iconify_callback(GLFWwindow *window, int iconified) { if (!set_callback_window(window)) return; - if (!iconified) global_state.has_active_animated_images = true; + if (!iconified) global_state.check_for_active_animated_images = true; request_tick_callback(); global_state.callback_os_window = NULL; } diff --git a/kitty/graphics.c b/kitty/graphics.c index 9d12659b3..a1695f95e 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -768,7 +768,7 @@ grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float scree } if (img->is_drawn && !was_drawn && img->animation_enabled && img->extra_framecnt && img->animation_duration) { self->has_images_needing_animation = true; - global_state.has_active_animated_images = true; + global_state.check_for_active_animated_images = true; } } if (!self->count) return false; @@ -1016,7 +1016,7 @@ handle_animation_control_command(GraphicsManager *self, bool *is_dirty, const Gr if (img->animation_enabled) { self->has_images_needing_animation = true; if (!was_enabled) img->current_frame_shown_at = monotonic(); - global_state.has_active_animated_images = true; + global_state.check_for_active_animated_images = true; } } } diff --git a/kitty/state.c b/kitty/state.c index 2b515eb80..9b56c9822 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -955,7 +955,7 @@ PYWRAP1(update_window_visibility) { WITH_WINDOW(os_window_id, tab_id, window_id); bool was_visible = window->visible & 1; window->visible = visible & 1; - if (!was_visible && window->visible) global_state.has_active_animated_images = true; + if (!was_visible && window->visible) global_state.check_for_active_animated_images = true; END_WITH_WINDOW; Py_RETURN_NONE; } diff --git a/kitty/state.h b/kitty/state.h index dabbb1453..534d83135 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -205,7 +205,7 @@ typedef struct { bool has_pending_resizes, has_pending_closes; bool in_sequence_mode; bool tab_bar_hidden; - bool has_active_animated_images; + bool check_for_active_animated_images; double font_sz_in_pts; struct { double x, y; } default_dpi; id_type active_drag_in_window;