mirror of
https://github.com/irssi/irssi.git
synced 2026-08-23 10:32:31 +02:00
irssi core: add window console set active support
We can't go to the console window easily right now, we'll want this in case irssi needs to prompt the user for something sensitive such as a password. Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
This commit is contained in:
parent
e880d18bb3
commit
ea7476addf
3 changed files with 28 additions and 0 deletions
|
|
@ -70,6 +70,8 @@ WINDOW_REC *window_create(WI_ITEM_REC *item, int automatic)
|
||||||
|
|
||||||
rec = g_new0(WINDOW_REC, 1);
|
rec = g_new0(WINDOW_REC, 1);
|
||||||
rec->refnum = window_get_new_refnum();
|
rec->refnum = window_get_new_refnum();
|
||||||
|
if (rec->refnum == 1)
|
||||||
|
rec->console = 1;
|
||||||
rec->level = settings_get_level("window_default_level");
|
rec->level = settings_get_level("window_default_level");
|
||||||
|
|
||||||
windows = g_slist_prepend(windows, rec);
|
windows = g_slist_prepend(windows, rec);
|
||||||
|
|
@ -353,6 +355,20 @@ WINDOW_REC *window_find_refnum(int refnum)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WINDOW_REC *window_find_console(void)
|
||||||
|
{
|
||||||
|
GSList *tmp;
|
||||||
|
|
||||||
|
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||||
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
|
if (rec->console)
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
WINDOW_REC *window_find_name(const char *name)
|
WINDOW_REC *window_find_name(const char *name)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ struct _WINDOW_REC {
|
||||||
unsigned int immortal:1;
|
unsigned int immortal:1;
|
||||||
unsigned int sticky_refnum:1;
|
unsigned int sticky_refnum:1;
|
||||||
unsigned int destroying:1;
|
unsigned int destroying:1;
|
||||||
|
unsigned int console:1;
|
||||||
|
|
||||||
/* window-specific command line history */
|
/* window-specific command line history */
|
||||||
HISTORY_REC *history;
|
HISTORY_REC *history;
|
||||||
|
|
@ -75,6 +76,7 @@ const char *window_get_active_name(WINDOW_REC *window);
|
||||||
WINDOW_REC *window_find_level(void *server, int level);
|
WINDOW_REC *window_find_level(void *server, int level);
|
||||||
WINDOW_REC *window_find_closest(void *server, const char *name, int level);
|
WINDOW_REC *window_find_closest(void *server, const char *name, int level);
|
||||||
WINDOW_REC *window_find_refnum(int refnum);
|
WINDOW_REC *window_find_refnum(int refnum);
|
||||||
|
WINDOW_REC *window_find_console(void);
|
||||||
WINDOW_REC *window_find_name(const char *name);
|
WINDOW_REC *window_find_name(const char *name);
|
||||||
WINDOW_REC *window_find_item(SERVER_REC *server, const char *name);
|
WINDOW_REC *window_find_item(SERVER_REC *server, const char *name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -842,6 +842,16 @@ static void cmd_foreach_window(const char *data)
|
||||||
active_win = old;
|
active_win = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void window_console(void)
|
||||||
|
{
|
||||||
|
WINDOW_REC *window;
|
||||||
|
|
||||||
|
window = window_find_console();
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
window_set_active(window);
|
||||||
|
}
|
||||||
|
|
||||||
void window_commands_init(void)
|
void window_commands_init(void)
|
||||||
{
|
{
|
||||||
settings_add_bool("lookandfeel", "active_window_ignore_refnum", TRUE);
|
settings_add_bool("lookandfeel", "active_window_ignore_refnum", TRUE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue