From 32c81ec87dc50143e86f518b35ccf3d239bad60b Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 18 May 2017 12:08:18 +0200 Subject: [PATCH] Reuse the windows when restoring a saved layout This allows us to use the 'layout restore' signal even when there are some windows open. --- src/fe-text/mainwindows-layout.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c index fae02539..721d9bd8 100644 --- a/src/fe-text/mainwindows-layout.c +++ b/src/fe-text/mainwindows-layout.c @@ -183,11 +183,15 @@ static void sig_layout_restore(void) CONFIG_NODE *node = tmp->data; if (node->key == NULL) continue; - /* create a new window + mainwindow */ - signal_emit("gui window create override", 1, + /* let's reuse the existing windows when possible */ + window = window_find_refnum(atoi(node->key)); + if (window == NULL) { + /* create a new window + mainwindow */ + signal_emit("gui window create override", 1, GINT_TO_POINTER(0)); - window = window_create(NULL, TRUE); + window = window_create(NULL, TRUE); + } window_set_refnum(window, atoi(node->key)); if (lower_size > 0)