mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 01:52:19 +02:00
Apply clang-format to sidepanel related files
Formatted all sidepanel-related files according to irssi's .clang-format rules: - src/fe-text/sidepanels.c (772 lines reformatted) - src/fe-text/mainwindows.c (462 lines reformatted) - src/fe-text/gui-readline.c (228 lines reformatted) - src/fe-text/mainwindows-layout.c (83 lines reformatted) - src/fe-text/irssi.c (37 lines reformatted) - src/fe-text/mainwindows.h (29 lines reformatted) - src/fe-text/module-formats.h (27 lines reformatted) Key formatting changes applied: - Indentation: spaces → tabs (IndentWidth: 8, UseTab: ForIndentation) - Line breaking: ColumnLimit: 100, BreakBeforeBraces: Linux - Alignment: AlignAfterOpenBracket: Align, AlignTrailingComments: true - Spacing: proper spacing around operators and parentheses - Pointer alignment: PointerAlignment: Right Total: 905 insertions, 733 deletions across 7 files Code functionality unchanged - purely cosmetic formatting to match irssi project standards. Timestamp: 2025-01-25 02:43
This commit is contained in:
parent
781d27e245
commit
25f2b16544
7 changed files with 905 additions and 733 deletions
|
|
@ -44,8 +44,9 @@
|
|||
/* After LINE_SPLIT_LIMIT characters, the message will be split into multiple lines */
|
||||
#define LINE_SPLIT_LIMIT 400
|
||||
|
||||
typedef void (*ENTRY_REDIRECT_KEY_FUNC) (int key, void *data, SERVER_REC *server, WI_ITEM_REC *item);
|
||||
typedef void (*ENTRY_REDIRECT_ENTRY_FUNC) (const char *line, void *data, SERVER_REC *server, WI_ITEM_REC *item);
|
||||
typedef void (*ENTRY_REDIRECT_KEY_FUNC)(int key, void *data, SERVER_REC *server, WI_ITEM_REC *item);
|
||||
typedef void (*ENTRY_REDIRECT_ENTRY_FUNC)(const char *line, void *data, SERVER_REC *server,
|
||||
WI_ITEM_REC *item);
|
||||
|
||||
typedef struct {
|
||||
SIGNAL_FUNC func;
|
||||
|
|
@ -146,8 +147,7 @@ static void handle_entry_redirect(const char *line)
|
|||
gui_entry_set_prompt(active_entry, "");
|
||||
|
||||
if (func != NULL) {
|
||||
func(line, data, active_win->active_server,
|
||||
active_win->active);
|
||||
func(line, data, active_win->active_server, active_win->active);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,14 +161,14 @@ static int get_scroll_count(void)
|
|||
if (count == 0)
|
||||
count = 1;
|
||||
else if (count < 0)
|
||||
count = active_mainwin->height-active_mainwin->statusbar_lines+count;
|
||||
count = active_mainwin->height - active_mainwin->statusbar_lines + count;
|
||||
else if (count < 1)
|
||||
count = 1.0/count;
|
||||
count = 1.0 / count;
|
||||
|
||||
if (*str == '/' || *str == '.') {
|
||||
count = (active_mainwin->height-active_mainwin->statusbar_lines)/count;
|
||||
count = (active_mainwin->height - active_mainwin->statusbar_lines) / count;
|
||||
}
|
||||
return (int)count;
|
||||
return (int) count;
|
||||
}
|
||||
|
||||
static void window_prev_page(void)
|
||||
|
|
@ -213,7 +213,7 @@ static void paste_buffer_join_lines(GArray *buf)
|
|||
if (buf->len == 0)
|
||||
return;
|
||||
|
||||
arr = (unichar *)buf->data;
|
||||
arr = (unichar *) buf->data;
|
||||
|
||||
/* first line */
|
||||
if (isblank(arr[0]))
|
||||
|
|
@ -221,7 +221,7 @@ static void paste_buffer_join_lines(GArray *buf)
|
|||
|
||||
/* find the first beginning of indented line */
|
||||
for (i = 1; i < buf->len; i++) {
|
||||
if (isnewline(arr[i-1]) && isblank(arr[i]))
|
||||
if (isnewline(arr[i - 1]) && isblank(arr[i]))
|
||||
break;
|
||||
}
|
||||
if (i == buf->len)
|
||||
|
|
@ -236,7 +236,8 @@ static void paste_buffer_join_lines(GArray *buf)
|
|||
return;
|
||||
|
||||
/* now, enforce these to all subsequent lines */
|
||||
count = indent; last_lf = TRUE;
|
||||
count = indent;
|
||||
last_lf = TRUE;
|
||||
for (; i < buf->len; i++) {
|
||||
if (last_lf) {
|
||||
if (isblank(arr[i]))
|
||||
|
|
@ -254,15 +255,17 @@ static void paste_buffer_join_lines(GArray *buf)
|
|||
|
||||
/* all looks fine - now remove the whitespace, but don't let lines
|
||||
get longer than LINE_SPLIT_LIMIT chars */
|
||||
dest = arr; last_lf = TRUE; last_lf_pos = NULL; line_len = 0;
|
||||
dest = arr;
|
||||
last_lf = TRUE;
|
||||
last_lf_pos = NULL;
|
||||
line_len = 0;
|
||||
for (i = 0; i < buf->len; i++) {
|
||||
if (last_lf && isblank(arr[i])) {
|
||||
/* whitespace, ignore */
|
||||
} else if (isnewline(arr[i])) {
|
||||
if (!last_lf && i+1 != buf->len &&
|
||||
isblank(arr[i+1])) {
|
||||
if (!last_lf && i + 1 != buf->len && isblank(arr[i + 1])) {
|
||||
last_lf_pos = dest;
|
||||
if (i != 0 && !isblank(arr[i-1]))
|
||||
if (i != 0 && !isblank(arr[i - 1]))
|
||||
*dest++ = ' ';
|
||||
} else {
|
||||
*dest++ = '\n'; /* double-LF */
|
||||
|
|
@ -273,9 +276,10 @@ static void paste_buffer_join_lines(GArray *buf)
|
|||
} else {
|
||||
last_lf = FALSE;
|
||||
if (++line_len >= LINE_SPLIT_LIMIT && last_lf_pos != NULL) {
|
||||
memmove(last_lf_pos+1, last_lf_pos,
|
||||
memmove(last_lf_pos + 1, last_lf_pos,
|
||||
(dest - last_lf_pos) * sizeof(unichar));
|
||||
*last_lf_pos = '\n'; last_lf_pos = NULL;
|
||||
*last_lf_pos = '\n';
|
||||
last_lf_pos = NULL;
|
||||
line_len = 0;
|
||||
dest++;
|
||||
}
|
||||
|
|
@ -370,9 +374,9 @@ static void paste_flush(void (*send)(void))
|
|||
g_array_set_size(paste_buffer_rest, 0);
|
||||
}
|
||||
|
||||
gui_entry_set_prompt(active_entry,
|
||||
paste_old_prompt == NULL ? "" : paste_old_prompt);
|
||||
g_free(paste_old_prompt); paste_old_prompt = NULL;
|
||||
gui_entry_set_prompt(active_entry, paste_old_prompt == NULL ? "" : paste_old_prompt);
|
||||
g_free(paste_old_prompt);
|
||||
paste_old_prompt = NULL;
|
||||
paste_prompt = FALSE;
|
||||
|
||||
paste_line_count = 0;
|
||||
|
|
@ -514,21 +518,17 @@ static void insert_paste_prompt(void)
|
|||
number of lines obtained from this. The number isn't entirely accurate;
|
||||
we just choose the greater of the two since the exact value isn't
|
||||
important */
|
||||
if (split_lines > paste_verify_line_count &&
|
||||
split_lines > paste_line_count) {
|
||||
if (split_lines > paste_verify_line_count && split_lines > paste_line_count) {
|
||||
actual_line_count = split_lines;
|
||||
}
|
||||
|
||||
paste_prompt = TRUE;
|
||||
paste_old_prompt = g_strdup(active_entry->prompt);
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_PASTE_WARNING,
|
||||
actual_line_count,
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, TXT_PASTE_WARNING, actual_line_count,
|
||||
active_win->active == NULL ? "window" :
|
||||
active_win->active->visible_name);
|
||||
|
||||
str = format_get_text(MODULE_NAME, active_win, NULL, NULL,
|
||||
TXT_PASTE_PROMPT, 0, 0);
|
||||
str = format_get_text(MODULE_NAME, active_win, NULL, NULL, TXT_PASTE_PROMPT, 0, 0);
|
||||
gui_entry_set_prompt(active_entry, str);
|
||||
paste_entry = gui_entry_get_text(active_entry);
|
||||
paste_entry_pos = gui_entry_get_pos(active_entry);
|
||||
|
|
@ -560,7 +560,7 @@ static void sig_gui_key_pressed(gpointer keyp)
|
|||
if (key < 32) {
|
||||
/* control key */
|
||||
str[0] = '^';
|
||||
str[1] = (char)key+'@';
|
||||
str[1] = (char) key + '@';
|
||||
str[2] = '\0';
|
||||
} else if (key == 127) {
|
||||
str[0] = '^';
|
||||
|
|
@ -568,7 +568,7 @@ static void sig_gui_key_pressed(gpointer keyp)
|
|||
str[2] = '\0';
|
||||
} else if (!active_entry->utf8) {
|
||||
if (key <= 0xff) {
|
||||
str[0] = (char)key;
|
||||
str[0] = (char) key;
|
||||
str[1] = '\0';
|
||||
} else {
|
||||
str[0] = (char) (key >> 8);
|
||||
|
|
@ -640,9 +640,7 @@ static void key_send_line(void)
|
|||
}
|
||||
|
||||
if (redir == NULL) {
|
||||
signal_emit("send command", 3, str,
|
||||
active_win->active_server,
|
||||
active_win->active);
|
||||
signal_emit("send command", 3, str, active_win->active_server, active_win->active);
|
||||
} else {
|
||||
handle_entry_redirect(str);
|
||||
}
|
||||
|
|
@ -654,9 +652,7 @@ static void key_send_line(void)
|
|||
g_free(str);
|
||||
}
|
||||
|
||||
static void key_combo(void)
|
||||
{
|
||||
}
|
||||
static void key_combo(void) {}
|
||||
|
||||
static void key_backward_history(void)
|
||||
{
|
||||
|
|
@ -801,7 +797,8 @@ static void key_yank_next_cutbuffer(void)
|
|||
return;
|
||||
|
||||
rec = active_entry->kill_ring->data;
|
||||
if (rec != NULL) length = rec->cutbuffer_len;
|
||||
if (rec != NULL)
|
||||
length = rec->cutbuffer_len;
|
||||
|
||||
cutbuffer = gui_entry_get_next_cutbuffer(active_entry);
|
||||
if (cutbuffer != NULL) {
|
||||
|
|
@ -957,12 +954,10 @@ static void paste_bracketed_middle(void)
|
|||
|
||||
for (i = 0; i <= len; i++, ptr++) {
|
||||
if (ptr[0] == bp_end[0] && memcmp(ptr, bp_end, sizeof(bp_end)) == 0) {
|
||||
|
||||
/* if there are at least 6 bytes after the end,
|
||||
* check for another start marker right afterwards */
|
||||
if (i <= (len - marklen) &&
|
||||
memcmp(ptr + marklen, bp_start, sizeof(bp_start)) == 0) {
|
||||
|
||||
/* remove both markers*/
|
||||
g_array_remove_range(paste_buffer, i, marklen * 2);
|
||||
len -= marklen * 2;
|
||||
|
|
@ -1005,7 +1000,8 @@ static void sig_input(void)
|
|||
if (paste_bracketed_mode) {
|
||||
paste_bracketed_middle();
|
||||
|
||||
} else if (!paste_use_bracketed_mode && paste_detect_time > 0 && paste_buffer->len >= 3) {
|
||||
} else if (!paste_use_bracketed_mode && paste_detect_time > 0 &&
|
||||
paste_buffer->len >= 3) {
|
||||
if (paste_timeout_id != -1)
|
||||
g_source_remove(paste_timeout_id);
|
||||
paste_timeout_id = g_timeout_add(paste_detect_time, paste_timeout, NULL);
|
||||
|
|
@ -1017,7 +1013,8 @@ static void sig_input(void)
|
|||
signal_emit("gui key pressed", 1, GINT_TO_POINTER(key));
|
||||
|
||||
if (paste_bracketed_mode) {
|
||||
/* just enabled by the signal, remove what was processed so far */
|
||||
/* just enabled by the signal, remove what was processed so
|
||||
* far */
|
||||
g_array_remove_range(paste_buffer, 0, i + 1);
|
||||
|
||||
/* handle single-line / small pastes here */
|
||||
|
|
@ -1093,12 +1090,14 @@ static void key_scroll_forward(void)
|
|||
|
||||
static void key_scroll_start(void)
|
||||
{
|
||||
signal_emit("command scrollback home", 3, NULL, active_win->active_server, active_win->active);
|
||||
signal_emit("command scrollback home", 3, NULL, active_win->active_server,
|
||||
active_win->active);
|
||||
}
|
||||
|
||||
static void key_scroll_end(void)
|
||||
{
|
||||
signal_emit("command scrollback end", 3, NULL, active_win->active_server, active_win->active);
|
||||
signal_emit("command scrollback end", 3, NULL, active_win->active_server,
|
||||
active_win->active);
|
||||
}
|
||||
|
||||
static void key_change_window(const char *data)
|
||||
|
|
@ -1153,7 +1152,8 @@ static void key_check_replaces(void)
|
|||
|
||||
static void key_previous_window(void)
|
||||
{
|
||||
signal_emit("command window previous", 3, "", active_win->active_server, active_win->active);
|
||||
signal_emit("command window previous", 3, "", active_win->active_server,
|
||||
active_win->active);
|
||||
}
|
||||
|
||||
static void key_next_window(void)
|
||||
|
|
@ -1183,7 +1183,8 @@ static void key_lower_window(void)
|
|||
|
||||
static void key_active_window(void)
|
||||
{
|
||||
signal_emit("command window goto", 3, "active", active_win->active_server, active_win->active);
|
||||
signal_emit("command window goto", 3, "active", active_win->active_server,
|
||||
active_win->active);
|
||||
}
|
||||
|
||||
static SERVER_REC *get_prev_server(SERVER_REC *current)
|
||||
|
|
@ -1192,8 +1193,8 @@ static SERVER_REC *get_prev_server(SERVER_REC *current)
|
|||
|
||||
if (current == NULL) {
|
||||
return servers != NULL ? g_slist_last(servers)->data :
|
||||
lookup_servers != NULL ?
|
||||
g_slist_last(lookup_servers)->data : NULL;
|
||||
lookup_servers != NULL ? g_slist_last(lookup_servers)->data :
|
||||
NULL;
|
||||
}
|
||||
|
||||
/* connect2 -> connect1 -> server2 -> server1 -> connect2 -> .. */
|
||||
|
|
@ -1201,7 +1202,7 @@ static SERVER_REC *get_prev_server(SERVER_REC *current)
|
|||
pos = g_slist_index(servers, current);
|
||||
if (pos != -1) {
|
||||
if (pos > 0)
|
||||
return g_slist_nth(servers, pos-1)->data;
|
||||
return g_slist_nth(servers, pos - 1)->data;
|
||||
if (lookup_servers != NULL)
|
||||
return g_slist_last(lookup_servers)->data;
|
||||
return g_slist_last(servers)->data;
|
||||
|
|
@ -1211,7 +1212,7 @@ static SERVER_REC *get_prev_server(SERVER_REC *current)
|
|||
g_assert(pos >= 0);
|
||||
|
||||
if (pos > 0)
|
||||
return g_slist_nth(lookup_servers, pos-1)->data;
|
||||
return g_slist_nth(lookup_servers, pos - 1)->data;
|
||||
if (servers != NULL)
|
||||
return g_slist_last(servers)->data;
|
||||
return g_slist_last(lookup_servers)->data;
|
||||
|
|
@ -1223,7 +1224,8 @@ static SERVER_REC *get_next_server(SERVER_REC *current)
|
|||
|
||||
if (current == NULL) {
|
||||
return servers != NULL ? servers->data :
|
||||
lookup_servers != NULL ? lookup_servers->data : NULL;
|
||||
lookup_servers != NULL ? lookup_servers->data :
|
||||
NULL;
|
||||
}
|
||||
|
||||
/* server1 -> server2 -> connect1 -> connect2 -> server1 -> .. */
|
||||
|
|
@ -1252,16 +1254,16 @@ static void key_previous_window_item(void)
|
|||
SERVER_REC *server;
|
||||
|
||||
if (active_win->items != NULL) {
|
||||
signal_emit("command window item prev", 3, "",
|
||||
active_win->active_server, active_win->active);
|
||||
signal_emit("command window item prev", 3, "", active_win->active_server,
|
||||
active_win->active);
|
||||
} else if (servers != NULL || lookup_servers != NULL) {
|
||||
/* change server */
|
||||
server = active_win->active_server;
|
||||
if (server == NULL)
|
||||
server = active_win->connect_server;
|
||||
server = get_prev_server(server);
|
||||
signal_emit("command window server", 3, server->tag,
|
||||
active_win->active_server, active_win->active);
|
||||
signal_emit("command window server", 3, server->tag, active_win->active_server,
|
||||
active_win->active);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1270,16 +1272,16 @@ static void key_next_window_item(void)
|
|||
SERVER_REC *server;
|
||||
|
||||
if (active_win->items != NULL) {
|
||||
signal_emit("command window item next", 3, "",
|
||||
active_win->active_server, active_win->active);
|
||||
signal_emit("command window item next", 3, "", active_win->active_server,
|
||||
active_win->active);
|
||||
} else if (servers != NULL || lookup_servers != NULL) {
|
||||
/* change server */
|
||||
server = active_win->active_server;
|
||||
if (server == NULL)
|
||||
server = active_win->connect_server;
|
||||
server = get_next_server(server);
|
||||
signal_emit("command window server", 3, server->tag,
|
||||
active_win->active_server, active_win->active);
|
||||
signal_emit("command window server", 3, server->tag, active_win->active_server,
|
||||
active_win->active);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1292,8 +1294,8 @@ static void key_insert_text(const char *data)
|
|||
{
|
||||
char *str;
|
||||
|
||||
str = parse_special_string(data, active_win->active_server,
|
||||
active_win->active, "", NULL, 0);
|
||||
str =
|
||||
parse_special_string(data, active_win->active_server, active_win->active, "", NULL, 0);
|
||||
gui_entry_insert_text(active_entry, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
|
@ -1316,8 +1318,7 @@ static void sig_window_auto_changed(void)
|
|||
g_free(text);
|
||||
}
|
||||
|
||||
static void sig_gui_entry_redirect(SIGNAL_FUNC func, const char *entry,
|
||||
void *flags, void *data)
|
||||
static void sig_gui_entry_redirect(SIGNAL_FUNC func, const char *entry, void *flags, void *data)
|
||||
{
|
||||
redir = g_new0(ENTRY_REDIRECT_REC, 1);
|
||||
redir->func = func;
|
||||
|
|
@ -1530,8 +1531,9 @@ void gui_readline_init(void)
|
|||
/* moving between windows */
|
||||
for (n = 0; changekeys[n] != '\0'; n++) {
|
||||
key = g_strdup_printf("meta-%c", changekeys[n]);
|
||||
ltoa(data, n+1);
|
||||
key_bind("change_window", "Change window", key, data, (SIGNAL_FUNC) key_change_window);
|
||||
ltoa(data, n + 1);
|
||||
key_bind("change_window", "Change window", key, data,
|
||||
(SIGNAL_FUNC) key_change_window);
|
||||
g_free(key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ int quitting;
|
|||
static int display_firsttimer = FALSE;
|
||||
static unsigned int user_settings_changed = 0;
|
||||
|
||||
|
||||
static void sig_exit(void)
|
||||
{
|
||||
quitting = TRUE;
|
||||
|
|
@ -212,11 +211,11 @@ static void textui_finish_init(void)
|
|||
statusbar_redraw(NULL, TRUE);
|
||||
|
||||
if (servers == NULL && lookup_servers == NULL) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_IRSSI_BANNER);
|
||||
printformat(NULL, NULL, MSGLEVEL_CRAP | MSGLEVEL_NO_ACT, TXT_IRSSI_BANNER);
|
||||
}
|
||||
|
||||
if (display_firsttimer) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_WELCOME_FIRSTTIME);
|
||||
printformat(NULL, NULL, MSGLEVEL_CRAP | MSGLEVEL_NO_ACT, TXT_WELCOME_FIRSTTIME);
|
||||
}
|
||||
|
||||
/* see irc-servers-setup.c:init_userinfo */
|
||||
|
|
@ -285,10 +284,9 @@ static void check_files(void)
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
static int version = 0;
|
||||
static GOptionEntry options[] = {
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display Irssi version", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
static GOptionEntry options[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version,
|
||||
"Display Irssi version", NULL },
|
||||
{ NULL } };
|
||||
int loglev;
|
||||
|
||||
core_register_options();
|
||||
|
|
@ -297,8 +295,8 @@ int main(int argc, char **argv)
|
|||
args_execute(argc, argv);
|
||||
|
||||
if (version) {
|
||||
printf(PACKAGE_TARNAME" " PACKAGE_VERSION" (%d %04d)\n",
|
||||
IRSSI_VERSION_DATE, IRSSI_VERSION_TIME);
|
||||
printf(PACKAGE_TARNAME " " PACKAGE_VERSION " (%d %04d)\n", IRSSI_VERSION_DATE,
|
||||
IRSSI_VERSION_TIME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -347,8 +345,7 @@ int main(int argc, char **argv)
|
|||
|
||||
if (settings_get_bool("quit_on_hup")) {
|
||||
signal_emit("gui exit", 0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
signal_emit("command reload", 1, "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ static void sig_layout_window_restore(WINDOW_REC *window, CONFIG_NODE *node)
|
|||
if (config_node_get_bool(node, "sticky", FALSE))
|
||||
gui_window_set_sticky(window);
|
||||
|
||||
textbuffer_view_set_hidden_level(gui->view, level2bits(config_node_get_str(node, "hidelevel", default_hidelevel), NULL));
|
||||
textbuffer_view_set_hidden_level(
|
||||
gui->view, level2bits(config_node_get_str(node, "hidelevel", default_hidelevel), NULL));
|
||||
|
||||
if (config_node_get_str(node, "scroll", NULL) != NULL) {
|
||||
gui->use_scroll = TRUE;
|
||||
|
|
@ -104,15 +105,13 @@ static void sig_layout_save(void)
|
|||
static int window_node_cmp(CONFIG_NODE *n1, CONFIG_NODE *n2)
|
||||
{
|
||||
return (config_node_get_int(n1, "first_line", 0) ==
|
||||
config_node_get_int(n2, "first_line", 0)
|
||||
&&
|
||||
config_node_get_int(n2, "first_line", 0) &&
|
||||
config_node_get_int(n1, "first_column", 0) >
|
||||
config_node_get_int(n2, "first_column", 0)
|
||||
) ||
|
||||
config_node_get_int(n2, "first_column", 0)) ||
|
||||
config_node_get_int(n1, "first_line", 0) >
|
||||
config_node_get_int(n2, "first_line", 0)
|
||||
? -1
|
||||
: 1;
|
||||
config_node_get_int(n2, "first_line", 0) ?
|
||||
-1 :
|
||||
1;
|
||||
}
|
||||
|
||||
/* Returns list of mainwindow nodes sorted by first_line
|
||||
|
|
@ -124,8 +123,7 @@ static GSList *get_sorted_windows_config(CONFIG_NODE *node)
|
|||
output = NULL;
|
||||
tmp = config_node_first(node->value);
|
||||
for (; tmp != NULL; tmp = config_node_next(tmp)) {
|
||||
output = g_slist_insert_sorted(output, tmp->data,
|
||||
(GCompareFunc) window_node_cmp);
|
||||
output = g_slist_insert_sorted(output, tmp->data, (GCompareFunc) window_node_cmp);
|
||||
}
|
||||
|
||||
return output;
|
||||
|
|
@ -172,17 +170,18 @@ static void sig_layout_restore(void)
|
|||
int i, lower_size, lines_count, columns_count, diff;
|
||||
|
||||
node = iconfig_node_traverse("mainwindows", FALSE);
|
||||
if (node == NULL) return;
|
||||
if (node == NULL)
|
||||
return;
|
||||
|
||||
sorted_config = get_sorted_windows_config(node);
|
||||
if (sorted_config == NULL) return;
|
||||
if (sorted_config == NULL)
|
||||
return;
|
||||
|
||||
lines_config = get_windows_config_filter_line(sorted_config);
|
||||
lines_count = g_slist_length(lines_config);
|
||||
|
||||
/* calculate the saved terminal height */
|
||||
avail_height = term_height -
|
||||
screen_reserved_top - screen_reserved_bottom;
|
||||
avail_height = term_height - screen_reserved_top - screen_reserved_bottom;
|
||||
height = 0;
|
||||
heights = g_new0(int, lines_count);
|
||||
for (i = 0, tmp = lines_config; tmp != NULL; tmp = tmp->next, i++) {
|
||||
|
|
@ -196,7 +195,7 @@ static void sig_layout_restore(void)
|
|||
if (max_wins_line < 1)
|
||||
max_wins_line = 1;
|
||||
|
||||
if (avail_height <= (WINDOW_MIN_SIZE*2)+1) {
|
||||
if (avail_height <= (WINDOW_MIN_SIZE * 2) + 1) {
|
||||
/* we can fit only one window to screen -
|
||||
give it all the height we can */
|
||||
lines_count = 1;
|
||||
|
|
@ -205,7 +204,7 @@ static void sig_layout_restore(void)
|
|||
/* Terminal's height is different from the saved one.
|
||||
Resize the windows so they fit to screen. */
|
||||
while (height > avail_height &&
|
||||
lines_count*(WINDOW_MIN_SIZE+1) > avail_height) {
|
||||
lines_count * (WINDOW_MIN_SIZE + 1) > avail_height) {
|
||||
/* all windows can't fit into screen,
|
||||
remove the lowest ones */
|
||||
lines_count--;
|
||||
|
|
@ -213,9 +212,9 @@ static void sig_layout_restore(void)
|
|||
|
||||
/* try to keep the windows' size about the same in percents */
|
||||
for (i = 0; i < lines_count; i++) {
|
||||
int size = avail_height*heights[i]/height;
|
||||
if (size < WINDOW_MIN_SIZE+1)
|
||||
size = WINDOW_MIN_SIZE+1;
|
||||
int size = avail_height * heights[i] / height;
|
||||
if (size < WINDOW_MIN_SIZE + 1)
|
||||
size = WINDOW_MIN_SIZE + 1;
|
||||
heights[i] = size;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +228,7 @@ static void sig_layout_restore(void)
|
|||
if (i == lines_count)
|
||||
i = 0;
|
||||
|
||||
if (heights[i] > WINDOW_MIN_SIZE+1) {
|
||||
if (heights[i] > WINDOW_MIN_SIZE + 1) {
|
||||
height += diff;
|
||||
heights[i] += diff;
|
||||
}
|
||||
|
|
@ -237,28 +236,35 @@ static void sig_layout_restore(void)
|
|||
}
|
||||
|
||||
/* create all the visible windows with correct size */
|
||||
lower_window = NULL; lower_size = 0; first = NULL;
|
||||
lower_window = NULL;
|
||||
lower_size = 0;
|
||||
first = NULL;
|
||||
for (i = 0, tmp = lines_config; i < lines_count; tmp = tmp->next, i++) {
|
||||
GSList *tmp2, *columns_config, *line;
|
||||
int j, l1, l2;
|
||||
CONFIG_NODE *node = tmp->data;
|
||||
if (node->key == NULL) continue;
|
||||
if (node->key == NULL)
|
||||
continue;
|
||||
|
||||
l1 = config_node_get_int(node, "first_line", -1);
|
||||
l2 = l1 + config_node_get_int(node, "lines", 0) - 1;
|
||||
columns_config = get_windows_config_filter_column(sorted_config, l1, l2);
|
||||
|
||||
window = NULL; columns_count = 0;
|
||||
window = NULL;
|
||||
columns_count = 0;
|
||||
widths = g_new0(int, max_wins_line);
|
||||
for (j = 0, tmp2 = columns_config; j < max_wins_line && tmp2 != NULL; tmp2 = tmp2->next, j++) {
|
||||
for (j = 0, tmp2 = columns_config; j < max_wins_line && tmp2 != NULL;
|
||||
tmp2 = tmp2->next, j++) {
|
||||
int width;
|
||||
WINDOW_REC *new_win;
|
||||
CONFIG_NODE *node2 = tmp2->data;
|
||||
if (node2->key == NULL) continue;
|
||||
if (node2->key == NULL)
|
||||
continue;
|
||||
|
||||
/* create a new window + mainwindow */
|
||||
signal_emit("gui window create override", 1,
|
||||
GINT_TO_POINTER(window == NULL ? MAIN_WINDOW_TYPE_SPLIT : MAIN_WINDOW_TYPE_RSPLIT));
|
||||
GINT_TO_POINTER(window == NULL ? MAIN_WINDOW_TYPE_SPLIT :
|
||||
MAIN_WINDOW_TYPE_RSPLIT));
|
||||
|
||||
new_win = window_create(NULL, TRUE);
|
||||
|
||||
|
|
@ -279,7 +285,8 @@ static void sig_layout_restore(void)
|
|||
continue;
|
||||
line = g_slist_reverse(mainwindows_get_line(WINDOW_MAIN(window)));
|
||||
for (j = g_slist_length(line), tmp2 = line; tmp2 != NULL; tmp2 = tmp2->next, j--) {
|
||||
int width = MAX(NEW_WINDOW_WIDTH, widths[j-1] * term_width / columns_count);
|
||||
int width =
|
||||
MAX(NEW_WINDOW_WIDTH, widths[j - 1] * term_width / columns_count);
|
||||
MAIN_WINDOW_REC *rec = tmp2->data;
|
||||
mainwindow_set_rsize(rec, width);
|
||||
}
|
||||
|
|
@ -291,8 +298,8 @@ static void sig_layout_restore(void)
|
|||
|
||||
lower_window = WINDOW_MAIN(window);
|
||||
lower_size = heights[i];
|
||||
if (lower_size < WINDOW_MIN_SIZE+1)
|
||||
lower_size = WINDOW_MIN_SIZE+1;
|
||||
if (lower_size < WINDOW_MIN_SIZE + 1)
|
||||
lower_size = WINDOW_MIN_SIZE + 1;
|
||||
}
|
||||
g_slist_free(sorted_config);
|
||||
g_free(heights);
|
||||
|
|
|
|||
|
|
@ -54,19 +54,19 @@ static int screen_collapsed = 0; /* see mainwindows_resize */
|
|||
(window)->width - (window)->statusbar_columns, \
|
||||
(window)->height - (window)->statusbar_lines);
|
||||
|
||||
|
||||
static MAIN_WINDOW_REC *find_window_with_room()
|
||||
{
|
||||
MAIN_WINDOW_REC *biggest_rec;
|
||||
GSList *tmp;
|
||||
int space, biggest;
|
||||
|
||||
biggest = 0; biggest_rec = NULL;
|
||||
biggest = 0;
|
||||
biggest_rec = NULL;
|
||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
|
||||
space = MAIN_WINDOW_TEXT_HEIGHT(rec);
|
||||
if (space >= WINDOW_MIN_SIZE+NEW_WINDOW_SIZE && space > biggest) {
|
||||
if (space >= WINDOW_MIN_SIZE + NEW_WINDOW_SIZE && space > biggest) {
|
||||
biggest = space;
|
||||
biggest_rec = rec;
|
||||
}
|
||||
|
|
@ -81,7 +81,8 @@ static MAIN_WINDOW_REC *find_window_with_room_right(void)
|
|||
GSList *tmp;
|
||||
int space, biggest;
|
||||
|
||||
biggest = 0; biggest_rec = NULL;
|
||||
biggest = 0;
|
||||
biggest_rec = NULL;
|
||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
|
||||
|
|
@ -110,8 +111,10 @@ static void mainwindow_resize_windows(MAIN_WINDOW_REC *window)
|
|||
int sy = window->first_line + window->statusbar_lines_top;
|
||||
int sw = window->width - window->statusbar_columns;
|
||||
int sh = window->height - window->statusbar_lines;
|
||||
if (sw < 1) sw = 1;
|
||||
if (sh < 1) sh = 1;
|
||||
if (sw < 1)
|
||||
sw = 1;
|
||||
if (sh < 1)
|
||||
sh = 1;
|
||||
term_window_move(window->screen_win, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
|
|
@ -119,14 +122,15 @@ static void mainwindow_resize_windows(MAIN_WINDOW_REC *window)
|
|||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||
WINDOW_REC *rec = tmp->data;
|
||||
|
||||
if (rec->gui_data != NULL &&
|
||||
WINDOW_GUI(rec)->parent == window &&
|
||||
if (rec->gui_data != NULL && WINDOW_GUI(rec)->parent == window &&
|
||||
!window_size_equals(rec, window)) {
|
||||
{
|
||||
int tw = MAIN_WINDOW_TEXT_WIDTH(window);
|
||||
int th = MAIN_WINDOW_TEXT_HEIGHT(window);
|
||||
if (tw < 1) tw = 1;
|
||||
if (th < 1) th = 1;
|
||||
if (tw < 1)
|
||||
tw = 1;
|
||||
if (th < 1)
|
||||
th = 1;
|
||||
resized = TRUE;
|
||||
gui_window_resize(rec, tw, th);
|
||||
}
|
||||
|
|
@ -145,11 +149,11 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int xdiff, int ydiff)
|
|||
|
||||
height = window->height + ydiff;
|
||||
width = window->width + xdiff;
|
||||
window->width = window->last_column-window->first_column+1;
|
||||
window->height = window->last_line-window->first_line+1;
|
||||
window->width = window->last_column - window->first_column + 1;
|
||||
window->height = window->last_line - window->first_line + 1;
|
||||
if (height != window->height || width != window->width) {
|
||||
g_warning("Resizing window %p W:%d expected:%d H:%d expected:%d",
|
||||
window, window->width, width, window->height, height);
|
||||
g_warning("Resizing window %p W:%d expected:%d H:%d expected:%d", window,
|
||||
window->width, width, window->height, height);
|
||||
}
|
||||
window->size_dirty = TRUE;
|
||||
}
|
||||
|
|
@ -163,16 +167,14 @@ static GSList *get_sticky_windows_sorted(MAIN_WINDOW_REC *mainwin)
|
|||
WINDOW_REC *rec = tmp->data;
|
||||
|
||||
if (WINDOW_GUI(rec)->sticky && WINDOW_MAIN(rec) == mainwin) {
|
||||
list = g_slist_insert_sorted(list, rec, (GCompareFunc)
|
||||
window_refnum_cmp);
|
||||
list = g_slist_insert_sorted(list, rec, (GCompareFunc) window_refnum_cmp);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin,
|
||||
WINDOW_REC *skip_window)
|
||||
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin, WINDOW_REC *skip_window)
|
||||
{
|
||||
WINDOW_REC *window, *other;
|
||||
GSList *tmp;
|
||||
|
|
@ -183,8 +185,7 @@ void mainwindow_change_active(MAIN_WINDOW_REC *mainwin,
|
|||
tmp = get_sticky_windows_sorted(mainwin);
|
||||
window = tmp->data;
|
||||
if (window == skip_window) {
|
||||
window = tmp->next == NULL ? NULL :
|
||||
tmp->next->data;
|
||||
window = tmp->next == NULL ? NULL : tmp->next->data;
|
||||
}
|
||||
g_slist_free(tmp);
|
||||
|
||||
|
|
@ -218,8 +219,7 @@ void mainwindows_recreate(void)
|
|||
|
||||
rec->screen_win = mainwindow_create_screen(rec);
|
||||
rec->dirty = TRUE;
|
||||
textbuffer_view_set_window(WINDOW_GUI(rec->active)->view,
|
||||
rec->screen_win);
|
||||
textbuffer_view_set_window(WINDOW_GUI(rec->active)->view, rec->screen_win);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,18 +235,17 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
|
|||
active_mainwin = rec;
|
||||
|
||||
rec->first_line = screen_reserved_top;
|
||||
rec->last_line = term_height-1 - screen_reserved_bottom;
|
||||
rec->height = rec->last_line-rec->first_line+1;
|
||||
rec->last_line = term_height - 1 - screen_reserved_bottom;
|
||||
rec->height = rec->last_line - rec->first_line + 1;
|
||||
rec->first_column = screen_reserved_left;
|
||||
rec->last_column = screen_width-1 - screen_reserved_right;
|
||||
rec->width = rec->last_column-rec->first_column+1;
|
||||
rec->last_column = screen_width - 1 - screen_reserved_right;
|
||||
rec->width = rec->last_column - rec->first_column + 1;
|
||||
} else {
|
||||
parent = WINDOW_MAIN(active_win);
|
||||
|
||||
if (!right) {
|
||||
GSList *tmp, *line;
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(parent) <
|
||||
WINDOW_MIN_SIZE+NEW_WINDOW_SIZE)
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(parent) < WINDOW_MIN_SIZE + NEW_WINDOW_SIZE)
|
||||
parent = find_window_with_room();
|
||||
if (parent == NULL) {
|
||||
g_free(rec);
|
||||
|
|
@ -256,16 +255,16 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
|
|||
space = parent->height / 2;
|
||||
rec->first_line = parent->first_line;
|
||||
rec->last_line = rec->first_line + space;
|
||||
rec->height = rec->last_line-rec->first_line+1;
|
||||
rec->height = rec->last_line - rec->first_line + 1;
|
||||
rec->first_column = screen_reserved_left;
|
||||
rec->last_column = screen_width-1 - screen_reserved_right;
|
||||
rec->width = rec->last_column-rec->first_column+1;
|
||||
rec->last_column = screen_width - 1 - screen_reserved_right;
|
||||
rec->width = rec->last_column - rec->first_column + 1;
|
||||
|
||||
line = mainwindows_get_line(parent);
|
||||
for (tmp = line; tmp != NULL; tmp = tmp->next) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
rec->first_line += space+1;
|
||||
mainwindow_resize(rec, 0, -space-1);
|
||||
rec->first_line += space + 1;
|
||||
mainwindow_resize(rec, 0, -space - 1);
|
||||
}
|
||||
g_slist_free(line);
|
||||
} else {
|
||||
|
|
@ -283,10 +282,10 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
|
|||
rec->height = parent->height;
|
||||
rec->first_column = parent->last_column - space + 1;
|
||||
rec->last_column = parent->last_column;
|
||||
rec->width = rec->last_column-rec->first_column+1;
|
||||
rec->width = rec->last_column - rec->first_column + 1;
|
||||
|
||||
parent->last_column -= space+1;
|
||||
mainwindow_resize(parent, -space-1, 0);
|
||||
parent->last_column -= space + 1;
|
||||
mainwindow_resize(parent, -space - 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -347,8 +346,7 @@ static MAIN_WINDOW_REC *mainwindows_find_right(MAIN_WINDOW_REC *window, int find
|
|||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
|
||||
if (rec->first_line >= first_line &&
|
||||
rec->last_line <= last_line &&
|
||||
if (rec->first_line >= first_line && rec->last_line <= last_line &&
|
||||
rec->first_column > last_column &&
|
||||
(best == NULL || rec->first_column < best->first_column))
|
||||
best = rec;
|
||||
|
|
@ -413,8 +411,7 @@ static MAIN_WINDOW_REC *mainwindows_find_left(MAIN_WINDOW_REC *window, int find_
|
|||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
|
||||
if (rec->first_line >= first_line &&
|
||||
rec->last_line <= last_line &&
|
||||
if (rec->first_line >= first_line && rec->last_line <= last_line &&
|
||||
rec->last_column < first_column &&
|
||||
(best == NULL || rec->last_column > best->last_column))
|
||||
best = rec;
|
||||
|
|
@ -452,8 +449,7 @@ GSList *mainwindows_get_line(MAIN_WINDOW_REC *rec)
|
|||
|
||||
list = NULL;
|
||||
|
||||
for (win = mainwindows_find_left(rec, FALSE);
|
||||
win != NULL;
|
||||
for (win = mainwindows_find_left(rec, FALSE); win != NULL;
|
||||
win = mainwindows_find_left(win, FALSE)) {
|
||||
list = g_slist_append(list, win);
|
||||
}
|
||||
|
|
@ -461,8 +457,7 @@ GSList *mainwindows_get_line(MAIN_WINDOW_REC *rec)
|
|||
if (rec != NULL)
|
||||
list = g_slist_append(list, rec);
|
||||
|
||||
for (win = mainwindows_find_right(rec, FALSE);
|
||||
win != NULL;
|
||||
for (win = mainwindows_find_right(rec, FALSE); win != NULL;
|
||||
win = mainwindows_find_right(win, FALSE)) {
|
||||
list = g_slist_append(list, win);
|
||||
}
|
||||
|
|
@ -482,22 +477,22 @@ static void mainwindows_add_space(MAIN_WINDOW_REC *destroy_win)
|
|||
if (destroy_win->last_column < destroy_win->first_column)
|
||||
return;
|
||||
|
||||
rsize = destroy_win->last_column-destroy_win->first_column+1;
|
||||
rsize = destroy_win->last_column - destroy_win->first_column + 1;
|
||||
rec = mainwindows_find_left(destroy_win, FALSE);
|
||||
if (rec != NULL) {
|
||||
rec->last_column = destroy_win->last_column;
|
||||
mainwindow_resize(rec, rsize+1, 0);
|
||||
mainwindow_resize(rec, rsize + 1, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
rec = mainwindows_find_right(destroy_win, FALSE);
|
||||
if (rec != NULL) {
|
||||
rec->first_column = destroy_win->first_column;
|
||||
mainwindow_resize(rec, rsize+1, 0);
|
||||
mainwindow_resize(rec, rsize + 1, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
size = destroy_win->last_line-destroy_win->first_line+1;
|
||||
size = destroy_win->last_line - destroy_win->first_line + 1;
|
||||
|
||||
rec = mainwindows_find_lower(destroy_win);
|
||||
if (rec != NULL) {
|
||||
|
|
@ -563,7 +558,8 @@ static void mainwindow_destroy_full(MAIN_WINDOW_REC *window, int respace)
|
|||
|
||||
g_free(window);
|
||||
|
||||
if (active_mainwin == window) active_mainwin = NULL;
|
||||
if (active_mainwin == window)
|
||||
active_mainwin = NULL;
|
||||
}
|
||||
|
||||
void mainwindow_destroy(MAIN_WINDOW_REC *window)
|
||||
|
|
@ -590,20 +586,20 @@ void mainwindows_redraw(void)
|
|||
|
||||
static int mainwindows_compare(MAIN_WINDOW_REC *w1, MAIN_WINDOW_REC *w2)
|
||||
{
|
||||
return w1->first_line < w2->first_line ? -1
|
||||
: w1->first_line > w2->first_line ? 1
|
||||
: w1->first_column < w2->first_column ? -1
|
||||
: w1->first_column > w2->first_column ? 1
|
||||
: 0;
|
||||
return w1->first_line < w2->first_line ? -1 :
|
||||
w1->first_line > w2->first_line ? 1 :
|
||||
w1->first_column < w2->first_column ? -1 :
|
||||
w1->first_column > w2->first_column ? 1 :
|
||||
0;
|
||||
}
|
||||
|
||||
static int mainwindows_compare_reverse(MAIN_WINDOW_REC *w1, MAIN_WINDOW_REC *w2)
|
||||
{
|
||||
return w1->first_line < w2->first_line ? 1
|
||||
: w1->first_line > w2->first_line ? -1
|
||||
: w1->first_column < w2->first_column ? 1
|
||||
: w1->first_column > w2->first_column ? -1
|
||||
: 0;
|
||||
return w1->first_line < w2->first_line ? 1 :
|
||||
w1->first_line > w2->first_line ? -1 :
|
||||
w1->first_column < w2->first_column ? 1 :
|
||||
w1->first_column > w2->first_column ? -1 :
|
||||
0;
|
||||
}
|
||||
|
||||
GSList *mainwindows_get_sorted(int reverse)
|
||||
|
|
@ -612,8 +608,9 @@ GSList *mainwindows_get_sorted(int reverse)
|
|||
|
||||
list = NULL;
|
||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||
list = g_slist_insert_sorted(list, tmp->data, (GCompareFunc)
|
||||
(reverse ? mainwindows_compare_reverse : mainwindows_compare));
|
||||
list = g_slist_insert_sorted(
|
||||
list, tmp->data,
|
||||
(GCompareFunc) (reverse ? mainwindows_compare_reverse : mainwindows_compare));
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
@ -626,9 +623,7 @@ static void mainwindows_resize_smaller(int ydiff)
|
|||
int space;
|
||||
|
||||
sorted = NULL;
|
||||
for (rec = mainwindows_find_lower(NULL);
|
||||
rec != NULL;
|
||||
rec = mainwindows_find_lower(rec)) {
|
||||
for (rec = mainwindows_find_lower(NULL); rec != NULL; rec = mainwindows_find_lower(rec)) {
|
||||
sorted = g_slist_prepend(sorted, rec);
|
||||
}
|
||||
if (sorted == NULL)
|
||||
|
|
@ -650,7 +645,7 @@ static void mainwindows_resize_smaller(int ydiff)
|
|||
if (win == active_mainwin && tmp == sorted)
|
||||
skip_active = TRUE;
|
||||
|
||||
lmin = MAIN_WINDOW_TEXT_HEIGHT(win)-WINDOW_MIN_SIZE;
|
||||
lmin = MAIN_WINDOW_TEXT_HEIGHT(win) - WINDOW_MIN_SIZE;
|
||||
if (lmin < min)
|
||||
min = lmin;
|
||||
}
|
||||
|
|
@ -701,7 +696,7 @@ static void mainwindows_resize_smaller(int ydiff)
|
|||
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
||||
int lmin;
|
||||
MAIN_WINDOW_REC *win = ltmp->data;
|
||||
lmin = MAIN_WINDOW_TEXT_HEIGHT(win)-WINDOW_MIN_SIZE;
|
||||
lmin = MAIN_WINDOW_TEXT_HEIGHT(win) - WINDOW_MIN_SIZE;
|
||||
if (lmin < min)
|
||||
min = lmin;
|
||||
}
|
||||
|
|
@ -718,7 +713,8 @@ static void mainwindows_resize_smaller(int ydiff)
|
|||
signal_emit("mainwindow moved", 1, win);
|
||||
}
|
||||
} else {
|
||||
if (space > -ydiff) space = -ydiff;
|
||||
if (space > -ydiff)
|
||||
space = -ydiff;
|
||||
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
||||
MAIN_WINDOW_REC *win = ltmp->data;
|
||||
win->last_line += ydiff;
|
||||
|
|
@ -747,18 +743,21 @@ static void mainwindows_rresize_line(int xdiff, MAIN_WINDOW_REC *win)
|
|||
|
||||
/* Available text width on this line should respect globally reserved columns */
|
||||
new_avail = screen_width - screen_reserved_left - screen_reserved_right - windows + 1;
|
||||
old_avail = (screen_width - xdiff) - screen_reserved_left - screen_reserved_right - windows + 1;
|
||||
old_avail =
|
||||
(screen_width - xdiff) - screen_reserved_left - screen_reserved_right - windows + 1;
|
||||
extra_width = new_avail;
|
||||
for (tmp = line, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
/* Scale each window proportionally based on available text widths (excluding reserved columns) */
|
||||
widths[i] = old_avail > 0 ? (MAIN_WINDOW_TEXT_WIDTH(rec) * new_avail) / old_avail : MAIN_WINDOW_TEXT_WIDTH(rec);
|
||||
/* Scale each window proportionally based on available text widths (excluding
|
||||
* reserved columns) */
|
||||
widths[i] = old_avail > 0 ? (MAIN_WINDOW_TEXT_WIDTH(rec) * new_avail) / old_avail :
|
||||
MAIN_WINDOW_TEXT_WIDTH(rec);
|
||||
extra_width -= widths[i] + rec->statusbar_columns;
|
||||
}
|
||||
shrunk = FALSE;
|
||||
for (i = windows; extra_width < 0; i = i > 1 ? i - 1 : windows) {
|
||||
if (widths[i-1] > NEW_WINDOW_WIDTH || (i == 1 && !shrunk)) {
|
||||
widths[i-1]--;
|
||||
if (widths[i - 1] > NEW_WINDOW_WIDTH || (i == 1 && !shrunk)) {
|
||||
widths[i - 1]--;
|
||||
extra_width++;
|
||||
shrunk = i == 1;
|
||||
}
|
||||
|
|
@ -769,8 +768,11 @@ static void mainwindows_rresize_line(int xdiff, MAIN_WINDOW_REC *win)
|
|||
|
||||
/* Distribute any leftover width across windows; base modulo on available width */
|
||||
width_mod = new_avail % windows;
|
||||
#define extra ( (i >= width_mod && i < extra_width + width_mod) \
|
||||
|| i + windows < extra_width + width_mod ? 1 : 0 )
|
||||
#define extra \
|
||||
((i >= width_mod && i < extra_width + width_mod) || \
|
||||
i + windows < extra_width + width_mod ? \
|
||||
1 : \
|
||||
0)
|
||||
|
||||
for (tmp = line, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
|
|
@ -779,13 +781,16 @@ static void mainwindows_rresize_line(int xdiff, MAIN_WINDOW_REC *win)
|
|||
if (is_last) {
|
||||
/* Anchor rightmost window to reserved-right boundary to avoid gap/lag */
|
||||
rec->last_column = screen_width - 1 - screen_reserved_right;
|
||||
mainwindow_resize(rec, (rec->last_column - rec->first_column + 1) - rec->width, 0);
|
||||
mainwindow_resize(
|
||||
rec, (rec->last_column - rec->first_column + 1) - rec->width, 0);
|
||||
} else {
|
||||
rec->last_column = rec->first_column + widths[i] + rec->statusbar_columns + extra - 1;
|
||||
rec->last_column =
|
||||
rec->first_column + widths[i] + rec->statusbar_columns + extra - 1;
|
||||
/* Ensure we never write past the globally reserved right columns */
|
||||
if (rec->last_column > screen_width - 1 - screen_reserved_right)
|
||||
rec->last_column = screen_width - 1 - screen_reserved_right;
|
||||
mainwindow_resize(rec, widths[i] + rec->statusbar_columns + extra - rec->width, 0);
|
||||
mainwindow_resize(
|
||||
rec, widths[i] + rec->statusbar_columns + extra - rec->width, 0);
|
||||
}
|
||||
rec->size_dirty = TRUE;
|
||||
next_column = rec->last_column + 2;
|
||||
|
|
@ -800,8 +805,8 @@ void mainwindows_resize(int width, int height)
|
|||
{
|
||||
int xdiff, ydiff;
|
||||
|
||||
xdiff = width-screen_width;
|
||||
ydiff = height-screen_height;
|
||||
xdiff = width - screen_width;
|
||||
ydiff = height - screen_height;
|
||||
screen_width = width;
|
||||
screen_height = height;
|
||||
|
||||
|
|
@ -811,7 +816,8 @@ void mainwindows_resize(int width, int height)
|
|||
int avail_h = screen_height - screen_reserved_top - screen_reserved_bottom;
|
||||
if (avail_w <= 1 || avail_h <= 1) {
|
||||
GSList *tmp;
|
||||
if (!screen_collapsed) screen_collapsed = 1;
|
||||
if (!screen_collapsed)
|
||||
screen_collapsed = 1;
|
||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||
MAIN_WINDOW_REC *rec = tmp->data;
|
||||
rec->first_column = screen_reserved_left;
|
||||
|
|
@ -830,7 +836,8 @@ void mainwindows_resize(int width, int height)
|
|||
/* Recover from collapsed state: reflow horizontally. */
|
||||
MAIN_WINDOW_REC *win;
|
||||
screen_collapsed = 0;
|
||||
for (win = mainwindows_find_lower(NULL); win != NULL; win = mainwindows_find_lower(win)) {
|
||||
for (win = mainwindows_find_lower(NULL); win != NULL;
|
||||
win = mainwindows_find_lower(win)) {
|
||||
mainwindows_rresize_line(0, win);
|
||||
}
|
||||
irssi_set_dirty();
|
||||
|
|
@ -854,8 +861,7 @@ void mainwindows_resize(int width, int height)
|
|||
/* algorithm: distribute new space on each line */
|
||||
MAIN_WINDOW_REC *win;
|
||||
|
||||
for (win = mainwindows_find_lower(NULL);
|
||||
win != NULL;
|
||||
for (win = mainwindows_find_lower(NULL); win != NULL;
|
||||
win = mainwindows_find_lower(win)) {
|
||||
mainwindows_rresize_line(xdiff, win);
|
||||
}
|
||||
|
|
@ -866,15 +872,16 @@ void mainwindows_resize(int width, int height)
|
|||
destroy windows on the right if no room */
|
||||
MAIN_WINDOW_REC *win;
|
||||
|
||||
for (win = mainwindows_find_lower(NULL);
|
||||
win != NULL;
|
||||
for (win = mainwindows_find_lower(NULL); win != NULL;
|
||||
win = mainwindows_find_lower(win)) {
|
||||
int max_windows, i, last_column;
|
||||
GSList *line, *tmp;
|
||||
|
||||
line = mainwindows_get_line(win);
|
||||
/* Respect globally reserved columns when computing capacity */
|
||||
max_windows = (screen_width - screen_reserved_left - screen_reserved_right + 1) / (NEW_WINDOW_WIDTH + 1);
|
||||
max_windows =
|
||||
(screen_width - screen_reserved_left - screen_reserved_right + 1) /
|
||||
(NEW_WINDOW_WIDTH + 1);
|
||||
if (max_windows < 1)
|
||||
max_windows = 1;
|
||||
last_column = screen_width - 1 - screen_reserved_right;
|
||||
|
|
@ -888,7 +895,8 @@ void mainwindows_resize(int width, int height)
|
|||
win = line->data;
|
||||
g_slist_free(line);
|
||||
|
||||
mainwindows_rresize_line(screen_width - screen_reserved_right - last_column + 1, win);
|
||||
mainwindows_rresize_line(
|
||||
screen_width - screen_reserved_right - last_column + 1, win);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -950,8 +958,7 @@ int mainwindows_reserve_lines(int top, int bottom)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window,
|
||||
int top, int bottom)
|
||||
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window, int top, int bottom)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -968,14 +975,13 @@ int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window,
|
|||
window->statusbar_lines += bottom;
|
||||
}
|
||||
|
||||
if (top+bottom != 0)
|
||||
if (top + bottom != 0)
|
||||
window->size_dirty = TRUE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void mainwindows_resize_two(GSList *grow_list,
|
||||
GSList *shrink_list, int count)
|
||||
static void mainwindows_resize_two(GSList *grow_list, GSList *shrink_list, int count)
|
||||
{
|
||||
GSList *tmp;
|
||||
MAIN_WINDOW_REC *win;
|
||||
|
|
@ -1011,7 +1017,7 @@ static int try_shrink_lower(MAIN_WINDOW_REC *window, int count)
|
|||
|
||||
for (tmp = shrink_list; tmp != NULL; tmp = tmp->next) {
|
||||
win = tmp->data;
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(win)-count < WINDOW_MIN_SIZE) {
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(win) - count < WINDOW_MIN_SIZE) {
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1057,7 +1063,7 @@ static int try_shrink_upper(MAIN_WINDOW_REC *window, int count)
|
|||
|
||||
for (tmp = shrink_list; tmp != NULL; tmp = tmp->next) {
|
||||
win = tmp->data;
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(win)-count < WINDOW_MIN_SIZE) {
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(win) - count < WINDOW_MIN_SIZE) {
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1083,8 +1089,7 @@ static int try_shrink_upper(MAIN_WINDOW_REC *window, int count)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static int mainwindow_grow(MAIN_WINDOW_REC *window, int count,
|
||||
int resize_lower)
|
||||
static int mainwindow_grow(MAIN_WINDOW_REC *window, int count, int resize_lower)
|
||||
{
|
||||
if (!resize_lower || !try_shrink_lower(window, count)) {
|
||||
if (!try_shrink_upper(window, count)) {
|
||||
|
|
@ -1152,7 +1157,7 @@ static int mainwindow_shrink(MAIN_WINDOW_REC *window, int count, int resize_lowe
|
|||
{
|
||||
g_return_val_if_fail(count >= 0, FALSE);
|
||||
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(window)-count < WINDOW_MIN_SIZE)
|
||||
if (MAIN_WINDOW_TEXT_HEIGHT(window) - count < WINDOW_MIN_SIZE)
|
||||
return FALSE;
|
||||
|
||||
if (!resize_lower || !try_grow_lower(window, count)) {
|
||||
|
|
@ -1165,8 +1170,8 @@ static int mainwindow_shrink(MAIN_WINDOW_REC *window, int count, int resize_lowe
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void mainwindows_rresize_two(MAIN_WINDOW_REC *grow_win,
|
||||
MAIN_WINDOW_REC *shrink_win, int count)
|
||||
static void mainwindows_rresize_two(MAIN_WINDOW_REC *grow_win, MAIN_WINDOW_REC *shrink_win,
|
||||
int count)
|
||||
{
|
||||
irssi_set_dirty();
|
||||
|
||||
|
|
@ -1184,7 +1189,7 @@ static int try_shrink_right(MAIN_WINDOW_REC *window, int count)
|
|||
|
||||
shrink_win = mainwindows_find_right(window, FALSE);
|
||||
if (shrink_win != NULL) {
|
||||
if (MAIN_WINDOW_TEXT_WIDTH(shrink_win)-count < NEW_WINDOW_WIDTH) {
|
||||
if (MAIN_WINDOW_TEXT_WIDTH(shrink_win) - count < NEW_WINDOW_WIDTH) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1206,7 +1211,7 @@ static int try_shrink_left(MAIN_WINDOW_REC *window, int count)
|
|||
|
||||
shrink_win = mainwindows_find_left(window, FALSE);
|
||||
if (shrink_win != NULL) {
|
||||
if (MAIN_WINDOW_TEXT_WIDTH(shrink_win)-count < NEW_WINDOW_WIDTH) {
|
||||
if (MAIN_WINDOW_TEXT_WIDTH(shrink_win) - count < NEW_WINDOW_WIDTH) {
|
||||
return FALSE;
|
||||
}
|
||||
window->first_column -= count;
|
||||
|
|
@ -1263,7 +1268,7 @@ static int mainwindow_shrink_right(MAIN_WINDOW_REC *window, int count)
|
|||
{
|
||||
g_return_val_if_fail(count >= 0, FALSE);
|
||||
|
||||
if (MAIN_WINDOW_TEXT_WIDTH(window)-count < NEW_WINDOW_WIDTH)
|
||||
if (MAIN_WINDOW_TEXT_WIDTH(window) - count < NEW_WINDOW_WIDTH)
|
||||
return FALSE;
|
||||
|
||||
if (!try_grow_right(window, count)) {
|
||||
|
|
@ -1338,20 +1343,19 @@ static void window_balance_vertical(void)
|
|||
MAIN_WINDOW_REC *win;
|
||||
|
||||
windows = g_slist_length(mainwindows);
|
||||
if (windows == 1) return;
|
||||
if (windows == 1)
|
||||
return;
|
||||
|
||||
sorted = NULL;
|
||||
windows = 0;
|
||||
for (win = mainwindows_find_lower(NULL);
|
||||
win != NULL;
|
||||
win = mainwindows_find_lower(win)) {
|
||||
for (win = mainwindows_find_lower(NULL); win != NULL; win = mainwindows_find_lower(win)) {
|
||||
windows++;
|
||||
sorted = g_slist_append(sorted, win);
|
||||
}
|
||||
|
||||
avail_size = term_height - screen_reserved_top-screen_reserved_bottom;
|
||||
unit_size = avail_size/windows;
|
||||
bigger_units = avail_size%windows;
|
||||
avail_size = term_height - screen_reserved_top - screen_reserved_bottom;
|
||||
unit_size = avail_size / windows;
|
||||
bigger_units = avail_size % windows;
|
||||
|
||||
last_line = screen_reserved_top;
|
||||
for (stmp = sorted; stmp != NULL; stmp = stmp->next) {
|
||||
|
|
@ -1362,7 +1366,7 @@ static void window_balance_vertical(void)
|
|||
MAIN_WINDOW_REC *rec = ltmp->data;
|
||||
old_size = rec->height;
|
||||
rec->first_line = last_line;
|
||||
rec->last_line = rec->first_line + unit_size-1;
|
||||
rec->last_line = rec->first_line + unit_size - 1;
|
||||
|
||||
if (bigger_units > 0) {
|
||||
rec->last_line++;
|
||||
|
|
@ -1373,7 +1377,7 @@ static void window_balance_vertical(void)
|
|||
if (line != NULL && bigger_units > 0) {
|
||||
bigger_units--;
|
||||
}
|
||||
last_line = win->last_line+1;
|
||||
last_line = win->last_line + 1;
|
||||
|
||||
g_slist_free(line);
|
||||
}
|
||||
|
|
@ -1388,8 +1392,7 @@ static void cmd_window_hide(const char *data)
|
|||
WINDOW_REC *window;
|
||||
|
||||
if (mainwindows->next == NULL) {
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_CANT_HIDE_LAST);
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, TXT_CANT_HIDE_LAST);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1398,8 +1401,8 @@ static void cmd_window_hide(const char *data)
|
|||
else if (is_numeric(data, 0)) {
|
||||
window = window_find_refnum(atoi(data));
|
||||
if (window == NULL) {
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
|
||||
TXT_REFNUM_NOT_FOUND, data);
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_REFNUM_NOT_FOUND,
|
||||
data);
|
||||
}
|
||||
} else {
|
||||
window = window_find_item(active_win->active_server, data);
|
||||
|
|
@ -1448,8 +1451,8 @@ static void cmd_window_show(const char *data)
|
|||
if (is_numeric(args, '\0')) {
|
||||
window = window_find_refnum(atoi(args));
|
||||
if (window == NULL) {
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
|
||||
TXT_REFNUM_NOT_FOUND, args);
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_REFNUM_NOT_FOUND,
|
||||
args);
|
||||
}
|
||||
} else {
|
||||
window = window_find_item(active_win->active_server, args);
|
||||
|
|
@ -1499,7 +1502,6 @@ static void mainwindow_grow_right_int(int count)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* SYNTAX: WINDOW GROW [-right] [<lines>|<columns>] */
|
||||
static void cmd_window_grow(const char *data)
|
||||
{
|
||||
|
|
@ -1536,7 +1538,8 @@ static void cmd_window_shrink(const char *data)
|
|||
return;
|
||||
|
||||
count = *data == '\0' ? 1 : atoi(args);
|
||||
if (count < -INT_MAX) count = -INT_MAX;
|
||||
if (count < -INT_MAX)
|
||||
count = -INT_MAX;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "right") != NULL) {
|
||||
mainwindow_grow_right_int(-count);
|
||||
|
|
@ -1570,9 +1573,9 @@ static void cmd_window_size(const char *data)
|
|||
|
||||
mainwindow_grow_right_int(size);
|
||||
} else {
|
||||
size -= WINDOW_MAIN(active_win)->height -
|
||||
WINDOW_MAIN(active_win)->statusbar_lines;
|
||||
if (size < -INT_MAX) size = -INT_MAX;
|
||||
size -= WINDOW_MAIN(active_win)->height - WINDOW_MAIN(active_win)->statusbar_lines;
|
||||
if (size < -INT_MAX)
|
||||
size = -INT_MAX;
|
||||
|
||||
mainwindow_grow_int(size);
|
||||
}
|
||||
|
|
@ -1594,16 +1597,16 @@ static void window_balance_horizontal(void)
|
|||
return;
|
||||
}
|
||||
|
||||
avail_width = term_width - screen_reserved_left-screen_reserved_right - windows + 1;
|
||||
unit_width = avail_width/windows;
|
||||
bigger_units = avail_width%windows;
|
||||
avail_width = term_width - screen_reserved_left - screen_reserved_right - windows + 1;
|
||||
unit_width = avail_width / windows;
|
||||
bigger_units = avail_width % windows;
|
||||
|
||||
last_column = screen_reserved_left;
|
||||
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
||||
win = ltmp->data;
|
||||
old_width = win->width;
|
||||
win->first_column = last_column;
|
||||
win->last_column = win->first_column + unit_width-1;
|
||||
win->last_column = win->first_column + unit_width - 1;
|
||||
|
||||
if (bigger_units > 0) {
|
||||
win->last_column++;
|
||||
|
|
@ -1611,7 +1614,7 @@ static void window_balance_horizontal(void)
|
|||
}
|
||||
|
||||
mainwindow_resize(win, win->last_column - win->first_column + 1 - old_width, 0);
|
||||
last_column = win->last_column+2;
|
||||
last_column = win->last_column + 2;
|
||||
}
|
||||
g_slist_free(line);
|
||||
|
||||
|
|
@ -1644,8 +1647,8 @@ static void cmd_window_up(const char *data)
|
|||
GHashTable *optlist;
|
||||
void *free_arg;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
||||
"window up", &optlist))
|
||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS, "window up",
|
||||
&optlist))
|
||||
return;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
||||
|
|
@ -1670,8 +1673,8 @@ static void cmd_window_down(const char *data)
|
|||
GHashTable *optlist;
|
||||
void *free_arg;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
||||
"window down", &optlist))
|
||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS, "window down",
|
||||
&optlist))
|
||||
return;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
||||
|
|
@ -1692,8 +1695,7 @@ static void cmd_window_down(const char *data)
|
|||
|
||||
#define WINDOW_STICKY_MATCH(window, sticky_parent) \
|
||||
((!WINDOW_GUI(window)->sticky && (sticky_parent) == NULL) || \
|
||||
(WINDOW_GUI(window)->sticky && \
|
||||
WINDOW_MAIN(window) == (sticky_parent)))
|
||||
(WINDOW_GUI(window)->sticky && WINDOW_MAIN(window) == (sticky_parent)))
|
||||
|
||||
static int window_refnum_left(int refnum, int wrap)
|
||||
{
|
||||
|
|
@ -1704,8 +1706,7 @@ static int window_refnum_left(int refnum, int wrap)
|
|||
window = window_find_refnum(refnum);
|
||||
g_return_val_if_fail(window != NULL, -1);
|
||||
|
||||
find_sticky = WINDOW_MAIN(window)->sticky_windows ?
|
||||
WINDOW_MAIN(window) : NULL;
|
||||
find_sticky = WINDOW_MAIN(window)->sticky_windows ? WINDOW_MAIN(window) : NULL;
|
||||
|
||||
do {
|
||||
refnum = window_refnum_prev(refnum, wrap);
|
||||
|
|
@ -1727,8 +1728,7 @@ static int window_refnum_right(int refnum, int wrap)
|
|||
window = window_find_refnum(refnum);
|
||||
g_return_val_if_fail(window != NULL, -1);
|
||||
|
||||
find_sticky = WINDOW_MAIN(window)->sticky_windows ?
|
||||
WINDOW_MAIN(window) : NULL;
|
||||
find_sticky = WINDOW_MAIN(window)->sticky_windows ? WINDOW_MAIN(window) : NULL;
|
||||
|
||||
do {
|
||||
refnum = window_refnum_next(refnum, wrap);
|
||||
|
|
@ -1747,8 +1747,8 @@ static void cmd_window_left(const char *data, SERVER_REC *server, void *item)
|
|||
GHashTable *optlist;
|
||||
void *free_arg;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
||||
"window left", &optlist))
|
||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS, "window left",
|
||||
&optlist))
|
||||
return;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
||||
|
|
@ -1834,32 +1834,31 @@ static void cmd_window_stick(const char *data)
|
|||
/* ref# specified */
|
||||
win = window_find_refnum(atoi(data));
|
||||
if (win == NULL) {
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
|
||||
TXT_REFNUM_NOT_FOUND, data);
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_REFNUM_NOT_FOUND,
|
||||
data);
|
||||
return;
|
||||
}
|
||||
|
||||
while (*data != ' ' && *data != '\0') data++;
|
||||
while (*data == ' ') data++;
|
||||
while (*data != ' ' && *data != '\0')
|
||||
data++;
|
||||
while (*data == ' ')
|
||||
data++;
|
||||
}
|
||||
|
||||
if (g_ascii_strncasecmp(data, "OF", 2) == 0 || i_toupper(*data) == 'N') {
|
||||
/* unset sticky */
|
||||
if (!WINDOW_GUI(win)->sticky) {
|
||||
printformat_window(win, MSGLEVEL_CLIENTERROR,
|
||||
TXT_WINDOW_NOT_STICKY);
|
||||
printformat_window(win, MSGLEVEL_CLIENTERROR, TXT_WINDOW_NOT_STICKY);
|
||||
} else {
|
||||
gui_window_set_unsticky(win);
|
||||
printformat_window(win, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_WINDOW_UNSET_STICKY);
|
||||
printformat_window(win, MSGLEVEL_CLIENTNOTICE, TXT_WINDOW_UNSET_STICKY);
|
||||
}
|
||||
} else {
|
||||
/* set sticky */
|
||||
window_reparent(win, mainwin);
|
||||
gui_window_set_sticky(win);
|
||||
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_WINDOW_SET_STICKY);
|
||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, TXT_WINDOW_SET_STICKY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1983,11 +1982,10 @@ static void windows_print_sticky(WINDOW_REC *win)
|
|||
|
||||
g_string_append_printf(str, "#%d, ", rec->refnum);
|
||||
}
|
||||
g_string_truncate(str, str->len-2);
|
||||
g_string_truncate(str, str->len - 2);
|
||||
g_slist_free(list);
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_STICKY, str->str);
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_STICKY, str->str);
|
||||
g_string_free(str, TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -1997,8 +1995,7 @@ static void sig_window_print_info(WINDOW_REC *win)
|
|||
|
||||
gui = WINDOW_GUI(win);
|
||||
if (gui->use_scroll) {
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_SCROLL,
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_SCROLL,
|
||||
gui->scroll ? "yes" : "no");
|
||||
}
|
||||
|
||||
|
|
@ -2106,8 +2103,7 @@ int mainwindows_reserve_columns(int left, int right)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window,
|
||||
int left, int right)
|
||||
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window, int left, int right)
|
||||
{
|
||||
int ret = -1;
|
||||
if (left != 0) {
|
||||
|
|
@ -2120,7 +2116,7 @@ int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window,
|
|||
window->statusbar_columns_right += right;
|
||||
window->statusbar_columns += right;
|
||||
}
|
||||
if (left+right != 0)
|
||||
if (left + right != 0)
|
||||
window->size_dirty = TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@
|
|||
#define WINDOW_MIN_SIZE 2
|
||||
#define NEW_WINDOW_WIDTH 20 /* must be >= MIN_SCREEN_WIDTH defined in term.c */
|
||||
|
||||
#define MAIN_WINDOW_TEXT_HEIGHT(window) \
|
||||
((window)->height-(window)->statusbar_lines)
|
||||
#define MAIN_WINDOW_TEXT_HEIGHT(window) ((window)->height - (window)->statusbar_lines)
|
||||
|
||||
#define MAIN_WINDOW_TEXT_WIDTH(window) \
|
||||
((window)->width-(window)->statusbar_columns)
|
||||
#define MAIN_WINDOW_TEXT_WIDTH(window) ((window)->width - (window)->statusbar_columns)
|
||||
|
||||
typedef struct {
|
||||
WINDOW_REC *active;
|
||||
|
|
@ -19,8 +17,10 @@ typedef struct {
|
|||
TERM_WINDOW *screen_win;
|
||||
int sticky_windows; /* number of sticky windows */
|
||||
|
||||
int first_line, last_line; /* first/last line used by this window (0..x) (includes statusbars) */
|
||||
int first_column, last_column; /* first/last column used by this window (0..x) (includes statusbars) */
|
||||
int first_line,
|
||||
last_line; /* first/last line used by this window (0..x) (includes statusbars) */
|
||||
int first_column,
|
||||
last_column; /* first/last column used by this window (0..x) (includes statusbars) */
|
||||
int width, height; /* width/height of the window (includes statusbars) */
|
||||
|
||||
GSList *statusbars;
|
||||
|
|
@ -29,8 +29,9 @@ typedef struct {
|
|||
int statusbar_columns_left, statusbar_columns_right;
|
||||
int statusbar_columns; /* left+right */
|
||||
|
||||
unsigned int dirty:1; /* This window needs a redraw */
|
||||
unsigned int size_dirty:1; /* We'll need to resize the window, but haven't got around doing it just yet. */
|
||||
unsigned int dirty : 1; /* This window needs a redraw */
|
||||
unsigned int size_dirty : 1; /* We'll need to resize the window, but haven't got around
|
||||
doing it just yet. */
|
||||
} MAIN_WINDOW_REC;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -55,23 +56,19 @@ void mainwindows_recreate(void);
|
|||
/* Change the window height - the height includes the lines needed for
|
||||
statusbars. If resize_lower is TRUE, the lower window is first tried
|
||||
to be resized instead of upper window. */
|
||||
void mainwindow_set_size(MAIN_WINDOW_REC *window, int height,
|
||||
int resize_lower);
|
||||
void mainwindow_set_size(MAIN_WINDOW_REC *window, int height, int resize_lower);
|
||||
void mainwindow_set_rsize(MAIN_WINDOW_REC *window, int width);
|
||||
void mainwindows_resize(int width, int height);
|
||||
|
||||
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin,
|
||||
WINDOW_REC *skip_window);
|
||||
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin, WINDOW_REC *skip_window);
|
||||
|
||||
int mainwindows_reserve_lines(int top, int bottom);
|
||||
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window,
|
||||
int top, int bottom);
|
||||
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window, int top, int bottom);
|
||||
void mainwindows_redraw_dirty(void);
|
||||
|
||||
/* Reserve columns at left/right of a main window (for side panels). */
|
||||
int mainwindows_reserve_columns(int left, int right);
|
||||
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window,
|
||||
int left, int right);
|
||||
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window, int left, int right);
|
||||
|
||||
GSList *mainwindows_get_sorted(int reverse);
|
||||
GSList *mainwindows_get_line(MAIN_WINDOW_REC *rec);
|
||||
|
|
|
|||
|
|
@ -83,8 +83,9 @@ enum {
|
|||
#define TXT_SIDEPANEL_NICK_NORMAL format_find_tag(MODULE_NAME, "sidepanel_nick_normal")
|
||||
#define TXT_SIDEPANEL_NICK_OP_STATUS format_find_tag(MODULE_NAME, "sidepanel_nick_op_status")
|
||||
#define TXT_SIDEPANEL_NICK_VOICE_STATUS format_find_tag(MODULE_NAME, "sidepanel_nick_voice_status")
|
||||
#define TXT_SIDEPANEL_NICK_NORMAL_STATUS format_find_tag(MODULE_NAME, "sidepanel_nick_normal_status")
|
||||
#define TXT_SIDEPANEL_NICK_NORMAL_STATUS \
|
||||
format_find_tag(MODULE_NAME, "sidepanel_nick_normal_status")
|
||||
|
||||
extern FORMAT_REC gui_text_formats[TXT_COUNT+1];
|
||||
extern FORMAT_REC gui_text_formats[TXT_COUNT + 1];
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue