From fd7ddc2905a25b98f2d4bd3e60c3a7d92ffcf8b4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Mar 2019 09:06:29 +0530 Subject: [PATCH] Handle OS not reporting live resizing end --- kitty/child-monitor.c | 2 +- kitty/glfw.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 18f19187b..058ce28c8 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -663,7 +663,7 @@ render(double now) { for (size_t i = 0; i < global_state.num_os_windows; i++) { OSWindow *w = global_state.os_windows + i; if (!w->num_tabs) continue; - if (w->live_resize.in_progress || !should_os_window_be_rendered(w)) { + if ((w->live_resize.in_progress && (now - w->live_resize.last_resize_event_at) < 1) || !should_os_window_be_rendered(w)) { update_os_window_title(w); continue; } diff --git a/kitty/glfw.c b/kitty/glfw.c index 35974d992..643338c38 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -59,9 +59,8 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) { } static void -draw_resizing_window(OSWindow *w, unsigned int width, unsigned int height) { +draw_resizing_text(OSWindow *w, unsigned int width, unsigned int height) { char text[32] = {0}; - blank_os_window(w); snprintf(text, sizeof(text), "%u x %u cells", width / w->fonts_data->cell_width, height / w->fonts_data->cell_height); StringCanvas rendered = render_simple_text(w->fonts_data, text); if (rendered.canvas) { @@ -164,7 +163,8 @@ framebuffer_size_callback(GLFWwindow *w, int width, int height) { // you get partially rendered windows. make_os_window_context_current(window); update_surface_size(width, height, window->offscreen_texture_id); - draw_resizing_window(window, MAX(0, width), MAX(0, height)); + blank_os_window(window); + draw_resizing_text(window, MAX(0, width), MAX(0, height)); swap_window_buffers(window); request_tick_callback(); } else log_error("Ignoring resize request for tiny size: %dx%d", width, height);