From 76b934d18e81ffbfa1e7480396d47fcced9394e8 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 26 Sep 2018 15:19:44 +0200 Subject: [PATCH] Fix broken display after resizing many windows very small --- src/fe-text/mainwindows.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index 83a3e0cc..d9b26a97 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -520,7 +520,7 @@ static void gui_windows_remove_parent(MAIN_WINDOW_REC *window) } } -void mainwindow_destroy(MAIN_WINDOW_REC *window) +static void mainwindow_destroy_full(MAIN_WINDOW_REC *window, int respace) { g_return_if_fail(window != NULL); @@ -531,7 +531,7 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window) if (mainwindows != NULL) { gui_windows_remove_parent(window); - if (!quitting) { + if (respace) { mainwindows_add_space(window); mainwindows_redraw(); } @@ -542,12 +542,14 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window) if (active_mainwin == window) active_mainwin = NULL; } +void mainwindow_destroy(MAIN_WINDOW_REC *window) +{ + mainwindow_destroy_full(window, !quitting); +} + void mainwindow_destroy_half(MAIN_WINDOW_REC *window) { - int really_quitting = quitting; - quitting = TRUE; - mainwindow_destroy(window); - quitting = really_quitting; + mainwindow_destroy_full(window, FALSE); } void mainwindows_redraw(void) @@ -821,6 +823,12 @@ void mainwindows_resize(int width, int height) mainwindows_resize_smaller(ydiff); } + /* if we lost our active mainwin, get a new one */ + if (active_mainwin == NULL && !quitting) { + active_mainwin = WINDOW_MAIN(active_win); + window_set_active(active_mainwin->active); + } + signal_emit("terminal resized", 0); irssi_redraw();