summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-14 17:41:45 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-14 17:41:45 +0000
commitc892353bf4ad425e2b9a1120c537165757f3e81b (patch)
treee46e88da5ce91faddc41c2cd2540b51bc0da3067
parent4f9df44cb671f0f5d9bb8ef98bfa77717f13634b (diff)
downloadirssi-c892353bf4ad425e2b9a1120c537165757f3e81b.zip
"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
-rw-r--r--src/fe-common/core/windows.c5
-rw-r--r--src/fe-common/irc/fe-query.c24
2 files changed, 20 insertions, 9 deletions
diff --git a/src/fe-common/core/windows.c b/src/fe-common/core/windows.c
index 8040078d..b3c1b995 100644
--- a/src/fe-common/core/windows.c
+++ b/src/fe-common/core/windows.c
@@ -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)
diff --git a/src/fe-common/irc/fe-query.c b/src/fe-common/irc/fe-query.c
index 189a0a35..df011777 100644
--- a/src/fe-common/irc/fe-query.c
+++ b/src/fe-common/irc/fe-query.c
@@ -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;
- if (query_auto_close <= 0)
- return;
-
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
if (irc_item_query(tmp->data))
- break;
+ return TRUE;
}
- if (tmp == NULL) return; /* no queries in window */
+
+ return FALSE;
+}
+
+static void sig_window_changed(WINDOW_REC *window, WINDOW_REC *old_window)
+{
+ if (query_auto_close <= 0)
+ return;
/* reset the window's last_line timestamp so that query doesn't get
- closed immediately after switched to the window. */
- window->last_line = time(NULL);
+ 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)