Handle OS not reporting live resizing end

This commit is contained in:
Kovid Goyal 2019-03-04 09:06:29 +05:30
parent c181919a57
commit fd7ddc2905
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);