summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-22 05:49:30 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-22 05:49:30 +0000
commita2a6c7e29376adff275baacc69b3834751ab0043 (patch)
tree365e5667b2f57d39ae451512ddb29c0eb3e34bc3 /src
parent13712d83b2df78685e8f83caf66db192db6eb7b8 (diff)
downloadirssi-a2a6c7e29376adff275baacc69b3834751ab0043.zip
Make a temporary window bind if you get kicked from channel. Never
allow any window items to go to windows with sticky binds. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1280 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/core/fe-channels.c20
-rw-r--r--src/fe-common/core/window-items.c40
2 files changed, 44 insertions, 16 deletions
diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c
index e3941b2c..9bc18e34 100644
--- a/src/fe-common/core/fe-channels.c
+++ b/src/fe-common/core/fe-channels.c
@@ -59,14 +59,20 @@ static void signal_channel_destroyed(CHANNEL_REC *channel)
g_return_if_fail(channel != NULL);
window = window_item_window((WI_ITEM_REC *) channel);
- if (window != NULL) {
- window_item_destroy((WI_ITEM_REC *) channel);
+ if (window == NULL)
+ return;
- if (window->items == NULL && windows->next != NULL &&
- (!channel->joined || channel->left) &&
- settings_get_bool("autoclose_windows")) {
- window_destroy(window);
- }
+ window_item_destroy((WI_ITEM_REC *) channel);
+
+ if (channel->joined && !channel->left &&
+ channel->server != NULL) {
+ /* kicked out from channel */
+ window_bind_add(window, channel->server->tag,
+ channel->name);
+ } else if (settings_get_bool("autoclose_windows") &&
+ (!channel->joined || channel->left) &&
+ window->items == NULL && windows->next != NULL) {
+ window_destroy(window);
}
}
diff --git a/src/fe-common/core/window-items.c b/src/fe-common/core/window-items.c
index 5c75295e..1246f2d8 100644
--- a/src/fe-common/core/window-items.c
+++ b/src/fe-common/core/window-items.c
@@ -224,6 +224,20 @@ WI_ITEM_REC *window_item_find(void *server, const char *name)
return NULL;
}
+static int window_bind_has_sticky(WINDOW_REC *window)
+{
+ GSList *tmp;
+
+ for (tmp = window->bound_items; tmp != NULL; tmp = tmp->next) {
+ WINDOW_BIND_REC *rec = tmp->data;
+
+ if (rec->sticky)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void window_item_create(WI_ITEM_REC *item, int automatic)
{
WINDOW_REC *window;
@@ -242,15 +256,6 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *rec = tmp->data;
- if (reuse_unused_windows &&
- rec->items == NULL && rec->level == 0 &&
- (window == NULL || rec == active_win ||
- window->bound_items != NULL)) {
- /* no items in this window,
- we should probably use it.. */
- window = rec;
- }
-
/* is item bound to this window? */
if (item->server != NULL &&
window_bind_find(rec, item->server->tag, item->name)) {
@@ -258,6 +263,23 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
clear_waiting = FALSE;
break;
}
+
+ /* use this window IF:
+ - reuse_unused_windows is ON
+ - window has no existing items
+ - window has no level
+ - window has no sticky binds (/LAYOUT SAVEd)
+ - we already haven't found "good enough" window,
+ except if
+ - this is the active window
+ - old window had some temporary bounds and this
+ one doesn't
+ */
+ if (reuse_unused_windows && rec->items == NULL &&
+ rec->level == 0 && !window_bind_has_sticky(rec) &&
+ (window == NULL || rec == active_win ||
+ window->bound_items != NULL))
+ window = rec;
}
g_slist_free(sorted);