mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
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
This commit is contained in:
parent
13712d83b2
commit
a2a6c7e293
@ -59,15 +59,21 @@ static void signal_channel_destroyed(CHANNEL_REC *channel)
|
|||||||
g_return_if_fail(channel != NULL);
|
g_return_if_fail(channel != NULL);
|
||||||
|
|
||||||
window = window_item_window((WI_ITEM_REC *) channel);
|
window = window_item_window((WI_ITEM_REC *) channel);
|
||||||
if (window != NULL) {
|
if (window == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
window_item_destroy((WI_ITEM_REC *) channel);
|
window_item_destroy((WI_ITEM_REC *) channel);
|
||||||
|
|
||||||
if (window->items == NULL && windows->next != NULL &&
|
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) &&
|
(!channel->joined || channel->left) &&
|
||||||
settings_get_bool("autoclose_windows")) {
|
window->items == NULL && windows->next != NULL) {
|
||||||
window_destroy(window);
|
window_destroy(window);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signal_window_item_destroy(WINDOW_REC *window, WI_ITEM_REC *item)
|
static void signal_window_item_destroy(WINDOW_REC *window, WI_ITEM_REC *item)
|
||||||
|
@ -224,6 +224,20 @@ WI_ITEM_REC *window_item_find(void *server, const char *name)
|
|||||||
return NULL;
|
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)
|
void window_item_create(WI_ITEM_REC *item, int automatic)
|
||||||
{
|
{
|
||||||
WINDOW_REC *window;
|
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) {
|
for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
|
||||||
WINDOW_REC *rec = tmp->data;
|
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? */
|
/* is item bound to this window? */
|
||||||
if (item->server != NULL &&
|
if (item->server != NULL &&
|
||||||
window_bind_find(rec, item->server->tag, item->name)) {
|
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;
|
clear_waiting = FALSE;
|
||||||
break;
|
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);
|
g_slist_free(sorted);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user