From 4a5a9b28884af64ad1fc9d3cf13c8e87580500c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Feb 2019 20:13:41 +0530 Subject: [PATCH] Render windows as bank during a resize --- kitty/child-monitor.c | 2 +- kitty/glfw.c | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 32efbbcdd..18f19187b 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 (!should_os_window_be_rendered(w)) { + if (w->live_resize.in_progress || !should_os_window_be_rendered(w)) { update_os_window_title(w); continue; } diff --git a/kitty/glfw.c b/kitty/glfw.c index 6e7a1cdff..759b00229 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -148,17 +148,13 @@ framebuffer_size_callback(GLFWwindow *w, int width, int height) { global_state.has_pending_resizes = true; window->live_resize.in_progress = true; window->live_resize.last_resize_event_at = monotonic(); -#ifdef __APPLE__ - // On cocoa request_tick_callback() does not work while the window - // is being resized, because that happens in a sub-loop. With semi-transparent - // windows that is a problem as the scaled background gets blended into - // the final background, so we explicitly blank the window here. - if (window->is_semi_transparent) { - make_os_window_context_current(window); - blank_os_window(window); - swap_window_buffers(window); - } -#endif + // render OS window as blank. On cocoa this is needed for semi-transparent windows, + // otherwise you get burn in of the previous frame. On Linux this is needed as otherwise + // you get partially rendered windows. + make_os_window_context_current(window); + update_surface_size(width, height, window->offscreen_texture_id); + blank_os_window(window); + swap_window_buffers(window); request_tick_callback(); } else log_error("Ignoring resize request for tiny size: %dx%d", width, height); global_state.callback_os_window = NULL;