This commit is contained in:
LemonBoy 2017-06-04 14:59:55 +00:00 committed by GitHub
commit dd0985cfd7
4 changed files with 17 additions and 3 deletions

View file

@ -7,6 +7,7 @@
SAVE: Saves your layout to the configuration. SAVE: Saves your layout to the configuration.
RESET: Removes the saved layout from the configuration. RESET: Removes the saved layout from the configuration.
RESTORE: Restores the saved layout from the configuration.
%9Description:%9 %9Description:%9
@ -23,6 +24,7 @@
/LAYOUT SAVE /LAYOUT SAVE
/LAYOUT RESET /LAYOUT RESET
/LAYOUT RESTORE
%9See also:%9 SAVE, WINDOW %9See also:%9 SAVE, WINDOW

View file

@ -306,6 +306,11 @@ windows.c:
"window history changed", WINDOW_REC, char *oldname "window history changed", WINDOW_REC, char *oldname
"window level changed", WINDOW_REC "window level changed", WINDOW_REC
windows-layout.c
"layout reset"
"layout restore"
"layout save"
FE IRC FE IRC
------ ------

View file

@ -902,6 +902,8 @@ void window_commands_init(void)
command_bind("layout save", NULL, (SIGNAL_FUNC) windows_layout_save); command_bind("layout save", NULL, (SIGNAL_FUNC) windows_layout_save);
/* SYNTAX: LAYOUT RESET */ /* SYNTAX: LAYOUT RESET */
command_bind("layout reset", NULL, (SIGNAL_FUNC) windows_layout_reset); command_bind("layout reset", NULL, (SIGNAL_FUNC) windows_layout_reset);
/* SYNTAX: LAYOUT RESTORE */
command_bind("layout restore", NULL, (SIGNAL_FUNC) windows_layout_restore);
command_bind("foreach window", NULL, (SIGNAL_FUNC) cmd_foreach_window); command_bind("foreach window", NULL, (SIGNAL_FUNC) cmd_foreach_window);
command_set_options("window number", "sticky"); command_set_options("window number", "sticky");
@ -942,5 +944,6 @@ void window_commands_deinit(void)
command_unbind("layout", (SIGNAL_FUNC) cmd_layout); command_unbind("layout", (SIGNAL_FUNC) cmd_layout);
command_unbind("layout save", (SIGNAL_FUNC) windows_layout_save); command_unbind("layout save", (SIGNAL_FUNC) windows_layout_save);
command_unbind("layout reset", (SIGNAL_FUNC) windows_layout_reset); command_unbind("layout reset", (SIGNAL_FUNC) windows_layout_reset);
command_unbind("layout restore", (SIGNAL_FUNC) windows_layout_restore);
command_unbind("foreach window", (SIGNAL_FUNC) cmd_foreach_window); command_unbind("foreach window", (SIGNAL_FUNC) cmd_foreach_window);
} }

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;
/* create a new window + mainwindow */ /* let's reuse the existing windows when possible */
signal_emit("gui window create override", 1, 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)); 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)