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:
parent
4f9df44cb6
commit
c892353bf4
@ -129,14 +129,17 @@ void window_destroy(WINDOW_REC *window)
|
|||||||
|
|
||||||
void window_set_active(WINDOW_REC *window)
|
void window_set_active(WINDOW_REC *window)
|
||||||
{
|
{
|
||||||
|
WINDOW_REC *old_window;
|
||||||
|
|
||||||
if (window == active_win)
|
if (window == active_win)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
old_window = active_win;
|
||||||
active_win = window;
|
active_win = window;
|
||||||
windows = g_slist_remove(windows, active_win);
|
windows = g_slist_remove(windows, active_win);
|
||||||
windows = g_slist_prepend(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)
|
void window_change_server(WINDOW_REC *window, void *server)
|
||||||
|
@ -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);
|
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;
|
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)
|
if (query_auto_close <= 0)
|
||||||
return;
|
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
|
/* 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
|
||||||
window->last_line = time(NULL);
|
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)
|
static int sig_query_autoclose(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user