1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

"window changed" signal now gives the old window as it's second argument.

query_auto_close now resets the "last check" time when changing to some
other window FROM it.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@335 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-14 17:41:45 +00:00 committed by cras
parent 4f9df44cb6
commit c892353bf4
2 changed files with 21 additions and 10 deletions

View File

@ -129,14 +129,17 @@ void window_destroy(WINDOW_REC *window)
void window_set_active(WINDOW_REC *window)
{
WINDOW_REC *old_window;
if (window == active_win)
return;
old_window = active_win;
active_win = window;
windows = g_slist_remove(windows, active_win);
windows = g_slist_prepend(windows, active_win);
signal_emit("window changed", 1, active_win);
signal_emit("window changed", 2, active_win, old_window);
}
void window_change_server(WINDOW_REC *window, void *server)

View File

@ -126,22 +126,30 @@ static void cmd_wquery(const char *data, void *server, WI_ITEM_REC *item)
signal_remove("query created", (SIGNAL_FUNC) signal_query_created_curwin);
}
static void sig_window_changed(WINDOW_REC *window)
static int window_has_query(WINDOW_REC *window)
{
GSList *tmp;
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
if (irc_item_query(tmp->data))
return TRUE;
}
return FALSE;
}
static void sig_window_changed(WINDOW_REC *window, WINDOW_REC *old_window)
{
if (query_auto_close <= 0)
return;
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
if (irc_item_query(tmp->data))
break;
}
if (tmp == NULL) return; /* no queries in window */
/* reset the window's last_line timestamp so that query doesn't get
closed immediately after switched to the window. */
closed immediately after switched to the window, or after changed
to some other window from it */
if (window_has_query(window))
window->last_line = time(NULL);
if (window_has_query(old_window))
old_window->last_line = time(NULL);
}
static int sig_query_autoclose(void)