Reuse the windows when restoring a saved layout

This allows us to use the 'layout restore' signal even when there are
some windows open.
This commit is contained in:
LemonBoy 2017-05-18 12:08:18 +02:00
commit 32c81ec87d

View file

@ -183,11 +183,15 @@ static void sig_layout_restore(void)
CONFIG_NODE *node = tmp->data; CONFIG_NODE *node = tmp->data;
if (node->key == NULL) continue; if (node->key == NULL) continue;
/* let's reuse the existing windows when possible */
window = window_find_refnum(atoi(node->key));
if (window == NULL) {
/* create a new window + mainwindow */ /* create a new window + mainwindow */
signal_emit("gui window create override", 1, signal_emit("gui window create override", 1,
GINT_TO_POINTER(0)); GINT_TO_POINTER(0));
window = window_create(NULL, TRUE); window = window_create(NULL, TRUE);
}
window_set_refnum(window, atoi(node->key)); window_set_refnum(window, atoi(node->key));
if (lower_size > 0) if (lower_size > 0)