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 */
|
/* After LINE_SPLIT_LIMIT characters, the message will be split into multiple lines */
|
||||||
#define LINE_SPLIT_LIMIT 400
|
#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_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_ENTRY_FUNC)(const char *line, void *data, SERVER_REC *server,
|
||||||
|
WI_ITEM_REC *item);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SIGNAL_FUNC func;
|
SIGNAL_FUNC func;
|
||||||
|
|
@ -146,8 +147,7 @@ static void handle_entry_redirect(const char *line)
|
||||||
gui_entry_set_prompt(active_entry, "");
|
gui_entry_set_prompt(active_entry, "");
|
||||||
|
|
||||||
if (func != NULL) {
|
if (func != NULL) {
|
||||||
func(line, data, active_win->active_server,
|
func(line, data, active_win->active_server, active_win->active);
|
||||||
active_win->active);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,14 +161,14 @@ static int get_scroll_count(void)
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
count = 1;
|
count = 1;
|
||||||
else if (count < 0)
|
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)
|
else if (count < 1)
|
||||||
count = 1.0/count;
|
count = 1.0 / count;
|
||||||
|
|
||||||
if (*str == '/' || *str == '.') {
|
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)
|
static void window_prev_page(void)
|
||||||
|
|
@ -213,7 +213,7 @@ static void paste_buffer_join_lines(GArray *buf)
|
||||||
if (buf->len == 0)
|
if (buf->len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
arr = (unichar *)buf->data;
|
arr = (unichar *) buf->data;
|
||||||
|
|
||||||
/* first line */
|
/* first line */
|
||||||
if (isblank(arr[0]))
|
if (isblank(arr[0]))
|
||||||
|
|
@ -221,7 +221,7 @@ static void paste_buffer_join_lines(GArray *buf)
|
||||||
|
|
||||||
/* find the first beginning of indented line */
|
/* find the first beginning of indented line */
|
||||||
for (i = 1; i < buf->len; i++) {
|
for (i = 1; i < buf->len; i++) {
|
||||||
if (isnewline(arr[i-1]) && isblank(arr[i]))
|
if (isnewline(arr[i - 1]) && isblank(arr[i]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == buf->len)
|
if (i == buf->len)
|
||||||
|
|
@ -236,7 +236,8 @@ static void paste_buffer_join_lines(GArray *buf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* now, enforce these to all subsequent lines */
|
/* now, enforce these to all subsequent lines */
|
||||||
count = indent; last_lf = TRUE;
|
count = indent;
|
||||||
|
last_lf = TRUE;
|
||||||
for (; i < buf->len; i++) {
|
for (; i < buf->len; i++) {
|
||||||
if (last_lf) {
|
if (last_lf) {
|
||||||
if (isblank(arr[i]))
|
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
|
/* all looks fine - now remove the whitespace, but don't let lines
|
||||||
get longer than LINE_SPLIT_LIMIT chars */
|
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++) {
|
for (i = 0; i < buf->len; i++) {
|
||||||
if (last_lf && isblank(arr[i])) {
|
if (last_lf && isblank(arr[i])) {
|
||||||
/* whitespace, ignore */
|
/* whitespace, ignore */
|
||||||
} else if (isnewline(arr[i])) {
|
} else if (isnewline(arr[i])) {
|
||||||
if (!last_lf && i+1 != buf->len &&
|
if (!last_lf && i + 1 != buf->len && isblank(arr[i + 1])) {
|
||||||
isblank(arr[i+1])) {
|
|
||||||
last_lf_pos = dest;
|
last_lf_pos = dest;
|
||||||
if (i != 0 && !isblank(arr[i-1]))
|
if (i != 0 && !isblank(arr[i - 1]))
|
||||||
*dest++ = ' ';
|
*dest++ = ' ';
|
||||||
} else {
|
} else {
|
||||||
*dest++ = '\n'; /* double-LF */
|
*dest++ = '\n'; /* double-LF */
|
||||||
|
|
@ -273,9 +276,10 @@ static void paste_buffer_join_lines(GArray *buf)
|
||||||
} else {
|
} else {
|
||||||
last_lf = FALSE;
|
last_lf = FALSE;
|
||||||
if (++line_len >= LINE_SPLIT_LIMIT && last_lf_pos != NULL) {
|
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));
|
(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;
|
line_len = 0;
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
|
|
@ -370,9 +374,9 @@ static void paste_flush(void (*send)(void))
|
||||||
g_array_set_size(paste_buffer_rest, 0);
|
g_array_set_size(paste_buffer_rest, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gui_entry_set_prompt(active_entry,
|
gui_entry_set_prompt(active_entry, paste_old_prompt == NULL ? "" : paste_old_prompt);
|
||||||
paste_old_prompt == NULL ? "" : paste_old_prompt);
|
g_free(paste_old_prompt);
|
||||||
g_free(paste_old_prompt); paste_old_prompt = NULL;
|
paste_old_prompt = NULL;
|
||||||
paste_prompt = FALSE;
|
paste_prompt = FALSE;
|
||||||
|
|
||||||
paste_line_count = 0;
|
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;
|
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
|
we just choose the greater of the two since the exact value isn't
|
||||||
important */
|
important */
|
||||||
if (split_lines > paste_verify_line_count &&
|
if (split_lines > paste_verify_line_count && split_lines > paste_line_count) {
|
||||||
split_lines > paste_line_count) {
|
|
||||||
actual_line_count = split_lines;
|
actual_line_count = split_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
paste_prompt = TRUE;
|
paste_prompt = TRUE;
|
||||||
paste_old_prompt = g_strdup(active_entry->prompt);
|
paste_old_prompt = g_strdup(active_entry->prompt);
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, TXT_PASTE_WARNING, actual_line_count,
|
||||||
TXT_PASTE_WARNING,
|
|
||||||
actual_line_count,
|
|
||||||
active_win->active == NULL ? "window" :
|
active_win->active == NULL ? "window" :
|
||||||
active_win->active->visible_name);
|
active_win->active->visible_name);
|
||||||
|
|
||||||
str = format_get_text(MODULE_NAME, active_win, NULL, NULL,
|
str = format_get_text(MODULE_NAME, active_win, NULL, NULL, TXT_PASTE_PROMPT, 0, 0);
|
||||||
TXT_PASTE_PROMPT, 0, 0);
|
|
||||||
gui_entry_set_prompt(active_entry, str);
|
gui_entry_set_prompt(active_entry, str);
|
||||||
paste_entry = gui_entry_get_text(active_entry);
|
paste_entry = gui_entry_get_text(active_entry);
|
||||||
paste_entry_pos = gui_entry_get_pos(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) {
|
if (key < 32) {
|
||||||
/* control key */
|
/* control key */
|
||||||
str[0] = '^';
|
str[0] = '^';
|
||||||
str[1] = (char)key+'@';
|
str[1] = (char) key + '@';
|
||||||
str[2] = '\0';
|
str[2] = '\0';
|
||||||
} else if (key == 127) {
|
} else if (key == 127) {
|
||||||
str[0] = '^';
|
str[0] = '^';
|
||||||
|
|
@ -568,7 +568,7 @@ static void sig_gui_key_pressed(gpointer keyp)
|
||||||
str[2] = '\0';
|
str[2] = '\0';
|
||||||
} else if (!active_entry->utf8) {
|
} else if (!active_entry->utf8) {
|
||||||
if (key <= 0xff) {
|
if (key <= 0xff) {
|
||||||
str[0] = (char)key;
|
str[0] = (char) key;
|
||||||
str[1] = '\0';
|
str[1] = '\0';
|
||||||
} else {
|
} else {
|
||||||
str[0] = (char) (key >> 8);
|
str[0] = (char) (key >> 8);
|
||||||
|
|
@ -640,9 +640,7 @@ static void key_send_line(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redir == NULL) {
|
if (redir == NULL) {
|
||||||
signal_emit("send command", 3, str,
|
signal_emit("send command", 3, str, active_win->active_server, active_win->active);
|
||||||
active_win->active_server,
|
|
||||||
active_win->active);
|
|
||||||
} else {
|
} else {
|
||||||
handle_entry_redirect(str);
|
handle_entry_redirect(str);
|
||||||
}
|
}
|
||||||
|
|
@ -654,9 +652,7 @@ static void key_send_line(void)
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_combo(void)
|
static void key_combo(void) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void key_backward_history(void)
|
static void key_backward_history(void)
|
||||||
{
|
{
|
||||||
|
|
@ -801,7 +797,8 @@ static void key_yank_next_cutbuffer(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rec = active_entry->kill_ring->data;
|
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);
|
cutbuffer = gui_entry_get_next_cutbuffer(active_entry);
|
||||||
if (cutbuffer != NULL) {
|
if (cutbuffer != NULL) {
|
||||||
|
|
@ -957,12 +954,10 @@ static void paste_bracketed_middle(void)
|
||||||
|
|
||||||
for (i = 0; i <= len; i++, ptr++) {
|
for (i = 0; i <= len; i++, ptr++) {
|
||||||
if (ptr[0] == bp_end[0] && memcmp(ptr, bp_end, sizeof(bp_end)) == 0) {
|
if (ptr[0] == bp_end[0] && memcmp(ptr, bp_end, sizeof(bp_end)) == 0) {
|
||||||
|
|
||||||
/* if there are at least 6 bytes after the end,
|
/* if there are at least 6 bytes after the end,
|
||||||
* check for another start marker right afterwards */
|
* check for another start marker right afterwards */
|
||||||
if (i <= (len - marklen) &&
|
if (i <= (len - marklen) &&
|
||||||
memcmp(ptr + marklen, bp_start, sizeof(bp_start)) == 0) {
|
memcmp(ptr + marklen, bp_start, sizeof(bp_start)) == 0) {
|
||||||
|
|
||||||
/* remove both markers*/
|
/* remove both markers*/
|
||||||
g_array_remove_range(paste_buffer, i, marklen * 2);
|
g_array_remove_range(paste_buffer, i, marklen * 2);
|
||||||
len -= marklen * 2;
|
len -= marklen * 2;
|
||||||
|
|
@ -1005,7 +1000,8 @@ static void sig_input(void)
|
||||||
if (paste_bracketed_mode) {
|
if (paste_bracketed_mode) {
|
||||||
paste_bracketed_middle();
|
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)
|
if (paste_timeout_id != -1)
|
||||||
g_source_remove(paste_timeout_id);
|
g_source_remove(paste_timeout_id);
|
||||||
paste_timeout_id = g_timeout_add(paste_detect_time, paste_timeout, NULL);
|
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));
|
signal_emit("gui key pressed", 1, GINT_TO_POINTER(key));
|
||||||
|
|
||||||
if (paste_bracketed_mode) {
|
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);
|
g_array_remove_range(paste_buffer, 0, i + 1);
|
||||||
|
|
||||||
/* handle single-line / small pastes here */
|
/* handle single-line / small pastes here */
|
||||||
|
|
@ -1093,12 +1090,14 @@ static void key_scroll_forward(void)
|
||||||
|
|
||||||
static void key_scroll_start(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)
|
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)
|
static void key_change_window(const char *data)
|
||||||
|
|
@ -1153,7 +1152,8 @@ static void key_check_replaces(void)
|
||||||
|
|
||||||
static void key_previous_window(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)
|
static void key_next_window(void)
|
||||||
|
|
@ -1183,7 +1183,8 @@ static void key_lower_window(void)
|
||||||
|
|
||||||
static void key_active_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)
|
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) {
|
if (current == NULL) {
|
||||||
return servers != NULL ? g_slist_last(servers)->data :
|
return servers != NULL ? g_slist_last(servers)->data :
|
||||||
lookup_servers != NULL ?
|
lookup_servers != NULL ? g_slist_last(lookup_servers)->data :
|
||||||
g_slist_last(lookup_servers)->data : NULL;
|
NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* connect2 -> connect1 -> server2 -> server1 -> connect2 -> .. */
|
/* connect2 -> connect1 -> server2 -> server1 -> connect2 -> .. */
|
||||||
|
|
@ -1201,7 +1202,7 @@ static SERVER_REC *get_prev_server(SERVER_REC *current)
|
||||||
pos = g_slist_index(servers, current);
|
pos = g_slist_index(servers, current);
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
return g_slist_nth(servers, pos-1)->data;
|
return g_slist_nth(servers, pos - 1)->data;
|
||||||
if (lookup_servers != NULL)
|
if (lookup_servers != NULL)
|
||||||
return g_slist_last(lookup_servers)->data;
|
return g_slist_last(lookup_servers)->data;
|
||||||
return g_slist_last(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);
|
g_assert(pos >= 0);
|
||||||
|
|
||||||
if (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)
|
if (servers != NULL)
|
||||||
return g_slist_last(servers)->data;
|
return g_slist_last(servers)->data;
|
||||||
return g_slist_last(lookup_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) {
|
if (current == NULL) {
|
||||||
return servers != NULL ? servers->data :
|
return servers != NULL ? servers->data :
|
||||||
lookup_servers != NULL ? lookup_servers->data : NULL;
|
lookup_servers != NULL ? lookup_servers->data :
|
||||||
|
NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* server1 -> server2 -> connect1 -> connect2 -> server1 -> .. */
|
/* server1 -> server2 -> connect1 -> connect2 -> server1 -> .. */
|
||||||
|
|
@ -1252,16 +1254,16 @@ static void key_previous_window_item(void)
|
||||||
SERVER_REC *server;
|
SERVER_REC *server;
|
||||||
|
|
||||||
if (active_win->items != NULL) {
|
if (active_win->items != NULL) {
|
||||||
signal_emit("command window item prev", 3, "",
|
signal_emit("command window item prev", 3, "", active_win->active_server,
|
||||||
active_win->active_server, active_win->active);
|
active_win->active);
|
||||||
} else if (servers != NULL || lookup_servers != NULL) {
|
} else if (servers != NULL || lookup_servers != NULL) {
|
||||||
/* change server */
|
/* change server */
|
||||||
server = active_win->active_server;
|
server = active_win->active_server;
|
||||||
if (server == NULL)
|
if (server == NULL)
|
||||||
server = active_win->connect_server;
|
server = active_win->connect_server;
|
||||||
server = get_prev_server(server);
|
server = get_prev_server(server);
|
||||||
signal_emit("command window server", 3, server->tag,
|
signal_emit("command window server", 3, server->tag, active_win->active_server,
|
||||||
active_win->active_server, active_win->active);
|
active_win->active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1270,16 +1272,16 @@ static void key_next_window_item(void)
|
||||||
SERVER_REC *server;
|
SERVER_REC *server;
|
||||||
|
|
||||||
if (active_win->items != NULL) {
|
if (active_win->items != NULL) {
|
||||||
signal_emit("command window item next", 3, "",
|
signal_emit("command window item next", 3, "", active_win->active_server,
|
||||||
active_win->active_server, active_win->active);
|
active_win->active);
|
||||||
} else if (servers != NULL || lookup_servers != NULL) {
|
} else if (servers != NULL || lookup_servers != NULL) {
|
||||||
/* change server */
|
/* change server */
|
||||||
server = active_win->active_server;
|
server = active_win->active_server;
|
||||||
if (server == NULL)
|
if (server == NULL)
|
||||||
server = active_win->connect_server;
|
server = active_win->connect_server;
|
||||||
server = get_next_server(server);
|
server = get_next_server(server);
|
||||||
signal_emit("command window server", 3, server->tag,
|
signal_emit("command window server", 3, server->tag, active_win->active_server,
|
||||||
active_win->active_server, active_win->active);
|
active_win->active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1292,8 +1294,8 @@ static void key_insert_text(const char *data)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
str = parse_special_string(data, active_win->active_server,
|
str =
|
||||||
active_win->active, "", NULL, 0);
|
parse_special_string(data, active_win->active_server, active_win->active, "", NULL, 0);
|
||||||
gui_entry_insert_text(active_entry, str);
|
gui_entry_insert_text(active_entry, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
@ -1316,8 +1318,7 @@ static void sig_window_auto_changed(void)
|
||||||
g_free(text);
|
g_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_gui_entry_redirect(SIGNAL_FUNC func, const char *entry,
|
static void sig_gui_entry_redirect(SIGNAL_FUNC func, const char *entry, void *flags, void *data)
|
||||||
void *flags, void *data)
|
|
||||||
{
|
{
|
||||||
redir = g_new0(ENTRY_REDIRECT_REC, 1);
|
redir = g_new0(ENTRY_REDIRECT_REC, 1);
|
||||||
redir->func = func;
|
redir->func = func;
|
||||||
|
|
@ -1530,8 +1531,9 @@ void gui_readline_init(void)
|
||||||
/* moving between windows */
|
/* moving between windows */
|
||||||
for (n = 0; changekeys[n] != '\0'; n++) {
|
for (n = 0; changekeys[n] != '\0'; n++) {
|
||||||
key = g_strdup_printf("meta-%c", changekeys[n]);
|
key = g_strdup_printf("meta-%c", changekeys[n]);
|
||||||
ltoa(data, n+1);
|
ltoa(data, n + 1);
|
||||||
key_bind("change_window", "Change window", key, data, (SIGNAL_FUNC) key_change_window);
|
key_bind("change_window", "Change window", key, data,
|
||||||
|
(SIGNAL_FUNC) key_change_window);
|
||||||
g_free(key);
|
g_free(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ int quitting;
|
||||||
static int display_firsttimer = FALSE;
|
static int display_firsttimer = FALSE;
|
||||||
static unsigned int user_settings_changed = 0;
|
static unsigned int user_settings_changed = 0;
|
||||||
|
|
||||||
|
|
||||||
static void sig_exit(void)
|
static void sig_exit(void)
|
||||||
{
|
{
|
||||||
quitting = TRUE;
|
quitting = TRUE;
|
||||||
|
|
@ -212,11 +211,11 @@ static void textui_finish_init(void)
|
||||||
statusbar_redraw(NULL, TRUE);
|
statusbar_redraw(NULL, TRUE);
|
||||||
|
|
||||||
if (servers == NULL && lookup_servers == NULL) {
|
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) {
|
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 */
|
/* see irc-servers-setup.c:init_userinfo */
|
||||||
|
|
@ -285,10 +284,9 @@ static void check_files(void)
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static int version = 0;
|
static int version = 0;
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version,
|
||||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display Irssi version", NULL },
|
"Display Irssi version", NULL },
|
||||||
{ NULL }
|
{ NULL } };
|
||||||
};
|
|
||||||
int loglev;
|
int loglev;
|
||||||
|
|
||||||
core_register_options();
|
core_register_options();
|
||||||
|
|
@ -297,8 +295,8 @@ int main(int argc, char **argv)
|
||||||
args_execute(argc, argv);
|
args_execute(argc, argv);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
printf(PACKAGE_TARNAME" " PACKAGE_VERSION" (%d %04d)\n",
|
printf(PACKAGE_TARNAME " " PACKAGE_VERSION " (%d %04d)\n", IRSSI_VERSION_DATE,
|
||||||
IRSSI_VERSION_DATE, IRSSI_VERSION_TIME);
|
IRSSI_VERSION_TIME);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,8 +345,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (settings_get_bool("quit_on_hup")) {
|
if (settings_get_bool("quit_on_hup")) {
|
||||||
signal_emit("gui exit", 0);
|
signal_emit("gui exit", 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
signal_emit("command reload", 1, "");
|
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))
|
if (config_node_get_bool(node, "sticky", FALSE))
|
||||||
gui_window_set_sticky(window);
|
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) {
|
if (config_node_get_str(node, "scroll", NULL) != NULL) {
|
||||||
gui->use_scroll = TRUE;
|
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)
|
static int window_node_cmp(CONFIG_NODE *n1, CONFIG_NODE *n2)
|
||||||
{
|
{
|
||||||
return (config_node_get_int(n1, "first_line", 0) ==
|
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(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(n1, "first_line", 0) >
|
||||||
config_node_get_int(n2, "first_line", 0)
|
config_node_get_int(n2, "first_line", 0) ?
|
||||||
? -1
|
-1 :
|
||||||
: 1;
|
1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns list of mainwindow nodes sorted by first_line
|
/* Returns list of mainwindow nodes sorted by first_line
|
||||||
|
|
@ -124,8 +123,7 @@ static GSList *get_sorted_windows_config(CONFIG_NODE *node)
|
||||||
output = NULL;
|
output = NULL;
|
||||||
tmp = config_node_first(node->value);
|
tmp = config_node_first(node->value);
|
||||||
for (; tmp != NULL; tmp = config_node_next(tmp)) {
|
for (; tmp != NULL; tmp = config_node_next(tmp)) {
|
||||||
output = g_slist_insert_sorted(output, tmp->data,
|
output = g_slist_insert_sorted(output, tmp->data, (GCompareFunc) window_node_cmp);
|
||||||
(GCompareFunc) window_node_cmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
@ -172,17 +170,18 @@ static void sig_layout_restore(void)
|
||||||
int i, lower_size, lines_count, columns_count, diff;
|
int i, lower_size, lines_count, columns_count, diff;
|
||||||
|
|
||||||
node = iconfig_node_traverse("mainwindows", FALSE);
|
node = iconfig_node_traverse("mainwindows", FALSE);
|
||||||
if (node == NULL) return;
|
if (node == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
sorted_config = get_sorted_windows_config(node);
|
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_config = get_windows_config_filter_line(sorted_config);
|
||||||
lines_count = g_slist_length(lines_config);
|
lines_count = g_slist_length(lines_config);
|
||||||
|
|
||||||
/* calculate the saved terminal height */
|
/* calculate the saved terminal height */
|
||||||
avail_height = term_height -
|
avail_height = term_height - screen_reserved_top - screen_reserved_bottom;
|
||||||
screen_reserved_top - screen_reserved_bottom;
|
|
||||||
height = 0;
|
height = 0;
|
||||||
heights = g_new0(int, lines_count);
|
heights = g_new0(int, lines_count);
|
||||||
for (i = 0, tmp = lines_config; tmp != NULL; tmp = tmp->next, i++) {
|
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)
|
if (max_wins_line < 1)
|
||||||
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 -
|
/* we can fit only one window to screen -
|
||||||
give it all the height we can */
|
give it all the height we can */
|
||||||
lines_count = 1;
|
lines_count = 1;
|
||||||
|
|
@ -205,7 +204,7 @@ static void sig_layout_restore(void)
|
||||||
/* Terminal's height is different from the saved one.
|
/* Terminal's height is different from the saved one.
|
||||||
Resize the windows so they fit to screen. */
|
Resize the windows so they fit to screen. */
|
||||||
while (height > avail_height &&
|
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,
|
/* all windows can't fit into screen,
|
||||||
remove the lowest ones */
|
remove the lowest ones */
|
||||||
lines_count--;
|
lines_count--;
|
||||||
|
|
@ -213,9 +212,9 @@ static void sig_layout_restore(void)
|
||||||
|
|
||||||
/* try to keep the windows' size about the same in percents */
|
/* try to keep the windows' size about the same in percents */
|
||||||
for (i = 0; i < lines_count; i++) {
|
for (i = 0; i < lines_count; i++) {
|
||||||
int size = avail_height*heights[i]/height;
|
int size = avail_height * heights[i] / height;
|
||||||
if (size < WINDOW_MIN_SIZE+1)
|
if (size < WINDOW_MIN_SIZE + 1)
|
||||||
size = WINDOW_MIN_SIZE+1;
|
size = WINDOW_MIN_SIZE + 1;
|
||||||
heights[i] = size;
|
heights[i] = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +228,7 @@ static void sig_layout_restore(void)
|
||||||
if (i == lines_count)
|
if (i == lines_count)
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
if (heights[i] > WINDOW_MIN_SIZE+1) {
|
if (heights[i] > WINDOW_MIN_SIZE + 1) {
|
||||||
height += diff;
|
height += diff;
|
||||||
heights[i] += diff;
|
heights[i] += diff;
|
||||||
}
|
}
|
||||||
|
|
@ -237,28 +236,35 @@ static void sig_layout_restore(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create all the visible windows with correct size */
|
/* 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++) {
|
for (i = 0, tmp = lines_config; i < lines_count; tmp = tmp->next, i++) {
|
||||||
GSList *tmp2, *columns_config, *line;
|
GSList *tmp2, *columns_config, *line;
|
||||||
int j, l1, l2;
|
int j, l1, l2;
|
||||||
CONFIG_NODE *node = tmp->data;
|
CONFIG_NODE *node = tmp->data;
|
||||||
if (node->key == NULL) continue;
|
if (node->key == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
l1 = config_node_get_int(node, "first_line", -1);
|
l1 = config_node_get_int(node, "first_line", -1);
|
||||||
l2 = l1 + config_node_get_int(node, "lines", 0) - 1;
|
l2 = l1 + config_node_get_int(node, "lines", 0) - 1;
|
||||||
columns_config = get_windows_config_filter_column(sorted_config, l1, l2);
|
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);
|
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;
|
int width;
|
||||||
WINDOW_REC *new_win;
|
WINDOW_REC *new_win;
|
||||||
CONFIG_NODE *node2 = tmp2->data;
|
CONFIG_NODE *node2 = tmp2->data;
|
||||||
if (node2->key == NULL) continue;
|
if (node2->key == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* create a new window + mainwindow */
|
/* create a new window + mainwindow */
|
||||||
signal_emit("gui window create override", 1,
|
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);
|
new_win = window_create(NULL, TRUE);
|
||||||
|
|
||||||
|
|
@ -279,7 +285,8 @@ static void sig_layout_restore(void)
|
||||||
continue;
|
continue;
|
||||||
line = g_slist_reverse(mainwindows_get_line(WINDOW_MAIN(window)));
|
line = g_slist_reverse(mainwindows_get_line(WINDOW_MAIN(window)));
|
||||||
for (j = g_slist_length(line), tmp2 = line; tmp2 != NULL; tmp2 = tmp2->next, j--) {
|
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;
|
MAIN_WINDOW_REC *rec = tmp2->data;
|
||||||
mainwindow_set_rsize(rec, width);
|
mainwindow_set_rsize(rec, width);
|
||||||
}
|
}
|
||||||
|
|
@ -291,8 +298,8 @@ static void sig_layout_restore(void)
|
||||||
|
|
||||||
lower_window = WINDOW_MAIN(window);
|
lower_window = WINDOW_MAIN(window);
|
||||||
lower_size = heights[i];
|
lower_size = heights[i];
|
||||||
if (lower_size < WINDOW_MIN_SIZE+1)
|
if (lower_size < WINDOW_MIN_SIZE + 1)
|
||||||
lower_size = WINDOW_MIN_SIZE+1;
|
lower_size = WINDOW_MIN_SIZE + 1;
|
||||||
}
|
}
|
||||||
g_slist_free(sorted_config);
|
g_slist_free(sorted_config);
|
||||||
g_free(heights);
|
g_free(heights);
|
||||||
|
|
|
||||||
|
|
@ -54,19 +54,19 @@ static int screen_collapsed = 0; /* see mainwindows_resize */
|
||||||
(window)->width - (window)->statusbar_columns, \
|
(window)->width - (window)->statusbar_columns, \
|
||||||
(window)->height - (window)->statusbar_lines);
|
(window)->height - (window)->statusbar_lines);
|
||||||
|
|
||||||
|
|
||||||
static MAIN_WINDOW_REC *find_window_with_room()
|
static MAIN_WINDOW_REC *find_window_with_room()
|
||||||
{
|
{
|
||||||
MAIN_WINDOW_REC *biggest_rec;
|
MAIN_WINDOW_REC *biggest_rec;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
int space, biggest;
|
int space, biggest;
|
||||||
|
|
||||||
biggest = 0; biggest_rec = NULL;
|
biggest = 0;
|
||||||
|
biggest_rec = NULL;
|
||||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
space = MAIN_WINDOW_TEXT_HEIGHT(rec);
|
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 = space;
|
||||||
biggest_rec = rec;
|
biggest_rec = rec;
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +81,8 @@ static MAIN_WINDOW_REC *find_window_with_room_right(void)
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
int space, biggest;
|
int space, biggest;
|
||||||
|
|
||||||
biggest = 0; biggest_rec = NULL;
|
biggest = 0;
|
||||||
|
biggest_rec = NULL;
|
||||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
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 sy = window->first_line + window->statusbar_lines_top;
|
||||||
int sw = window->width - window->statusbar_columns;
|
int sw = window->width - window->statusbar_columns;
|
||||||
int sh = window->height - window->statusbar_lines;
|
int sh = window->height - window->statusbar_lines;
|
||||||
if (sw < 1) sw = 1;
|
if (sw < 1)
|
||||||
if (sh < 1) sh = 1;
|
sw = 1;
|
||||||
|
if (sh < 1)
|
||||||
|
sh = 1;
|
||||||
term_window_move(window->screen_win, sx, sy, sw, sh);
|
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) {
|
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||||
WINDOW_REC *rec = tmp->data;
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (rec->gui_data != NULL &&
|
if (rec->gui_data != NULL && WINDOW_GUI(rec)->parent == window &&
|
||||||
WINDOW_GUI(rec)->parent == window &&
|
|
||||||
!window_size_equals(rec, window)) {
|
!window_size_equals(rec, window)) {
|
||||||
{
|
{
|
||||||
int tw = MAIN_WINDOW_TEXT_WIDTH(window);
|
int tw = MAIN_WINDOW_TEXT_WIDTH(window);
|
||||||
int th = MAIN_WINDOW_TEXT_HEIGHT(window);
|
int th = MAIN_WINDOW_TEXT_HEIGHT(window);
|
||||||
if (tw < 1) tw = 1;
|
if (tw < 1)
|
||||||
if (th < 1) th = 1;
|
tw = 1;
|
||||||
|
if (th < 1)
|
||||||
|
th = 1;
|
||||||
resized = TRUE;
|
resized = TRUE;
|
||||||
gui_window_resize(rec, tw, th);
|
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;
|
height = window->height + ydiff;
|
||||||
width = window->width + xdiff;
|
width = window->width + xdiff;
|
||||||
window->width = window->last_column-window->first_column+1;
|
window->width = window->last_column - window->first_column + 1;
|
||||||
window->height = window->last_line-window->first_line+1;
|
window->height = window->last_line - window->first_line + 1;
|
||||||
if (height != window->height || width != window->width) {
|
if (height != window->height || width != window->width) {
|
||||||
g_warning("Resizing window %p W:%d expected:%d H:%d expected:%d",
|
g_warning("Resizing window %p W:%d expected:%d H:%d expected:%d", window,
|
||||||
window, window->width, width, window->height, height);
|
window->width, width, window->height, height);
|
||||||
}
|
}
|
||||||
window->size_dirty = TRUE;
|
window->size_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -163,16 +167,14 @@ static GSList *get_sticky_windows_sorted(MAIN_WINDOW_REC *mainwin)
|
||||||
WINDOW_REC *rec = tmp->data;
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (WINDOW_GUI(rec)->sticky && WINDOW_MAIN(rec) == mainwin) {
|
if (WINDOW_GUI(rec)->sticky && WINDOW_MAIN(rec) == mainwin) {
|
||||||
list = g_slist_insert_sorted(list, rec, (GCompareFunc)
|
list = g_slist_insert_sorted(list, rec, (GCompareFunc) window_refnum_cmp);
|
||||||
window_refnum_cmp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin,
|
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin, WINDOW_REC *skip_window)
|
||||||
WINDOW_REC *skip_window)
|
|
||||||
{
|
{
|
||||||
WINDOW_REC *window, *other;
|
WINDOW_REC *window, *other;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
|
@ -183,8 +185,7 @@ void mainwindow_change_active(MAIN_WINDOW_REC *mainwin,
|
||||||
tmp = get_sticky_windows_sorted(mainwin);
|
tmp = get_sticky_windows_sorted(mainwin);
|
||||||
window = tmp->data;
|
window = tmp->data;
|
||||||
if (window == skip_window) {
|
if (window == skip_window) {
|
||||||
window = tmp->next == NULL ? NULL :
|
window = tmp->next == NULL ? NULL : tmp->next->data;
|
||||||
tmp->next->data;
|
|
||||||
}
|
}
|
||||||
g_slist_free(tmp);
|
g_slist_free(tmp);
|
||||||
|
|
||||||
|
|
@ -218,8 +219,7 @@ void mainwindows_recreate(void)
|
||||||
|
|
||||||
rec->screen_win = mainwindow_create_screen(rec);
|
rec->screen_win = mainwindow_create_screen(rec);
|
||||||
rec->dirty = TRUE;
|
rec->dirty = TRUE;
|
||||||
textbuffer_view_set_window(WINDOW_GUI(rec->active)->view,
|
textbuffer_view_set_window(WINDOW_GUI(rec->active)->view, rec->screen_win);
|
||||||
rec->screen_win);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,18 +235,17 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
|
||||||
active_mainwin = rec;
|
active_mainwin = rec;
|
||||||
|
|
||||||
rec->first_line = screen_reserved_top;
|
rec->first_line = screen_reserved_top;
|
||||||
rec->last_line = term_height-1 - screen_reserved_bottom;
|
rec->last_line = term_height - 1 - screen_reserved_bottom;
|
||||||
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->first_column = screen_reserved_left;
|
||||||
rec->last_column = screen_width-1 - screen_reserved_right;
|
rec->last_column = screen_width - 1 - screen_reserved_right;
|
||||||
rec->width = rec->last_column-rec->first_column+1;
|
rec->width = rec->last_column - rec->first_column + 1;
|
||||||
} else {
|
} else {
|
||||||
parent = WINDOW_MAIN(active_win);
|
parent = WINDOW_MAIN(active_win);
|
||||||
|
|
||||||
if (!right) {
|
if (!right) {
|
||||||
GSList *tmp, *line;
|
GSList *tmp, *line;
|
||||||
if (MAIN_WINDOW_TEXT_HEIGHT(parent) <
|
if (MAIN_WINDOW_TEXT_HEIGHT(parent) < WINDOW_MIN_SIZE + NEW_WINDOW_SIZE)
|
||||||
WINDOW_MIN_SIZE+NEW_WINDOW_SIZE)
|
|
||||||
parent = find_window_with_room();
|
parent = find_window_with_room();
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
g_free(rec);
|
g_free(rec);
|
||||||
|
|
@ -256,16 +255,16 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
|
||||||
space = parent->height / 2;
|
space = parent->height / 2;
|
||||||
rec->first_line = parent->first_line;
|
rec->first_line = parent->first_line;
|
||||||
rec->last_line = rec->first_line + space;
|
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->first_column = screen_reserved_left;
|
||||||
rec->last_column = screen_width-1 - screen_reserved_right;
|
rec->last_column = screen_width - 1 - screen_reserved_right;
|
||||||
rec->width = rec->last_column-rec->first_column+1;
|
rec->width = rec->last_column - rec->first_column + 1;
|
||||||
|
|
||||||
line = mainwindows_get_line(parent);
|
line = mainwindows_get_line(parent);
|
||||||
for (tmp = line; tmp != NULL; tmp = tmp->next) {
|
for (tmp = line; tmp != NULL; tmp = tmp->next) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
rec->first_line += space+1;
|
rec->first_line += space + 1;
|
||||||
mainwindow_resize(rec, 0, -space-1);
|
mainwindow_resize(rec, 0, -space - 1);
|
||||||
}
|
}
|
||||||
g_slist_free(line);
|
g_slist_free(line);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -283,10 +282,10 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
|
||||||
rec->height = parent->height;
|
rec->height = parent->height;
|
||||||
rec->first_column = parent->last_column - space + 1;
|
rec->first_column = parent->last_column - space + 1;
|
||||||
rec->last_column = parent->last_column;
|
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;
|
parent->last_column -= space + 1;
|
||||||
mainwindow_resize(parent, -space-1, 0);
|
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) {
|
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (rec->first_line >= first_line &&
|
if (rec->first_line >= first_line && rec->last_line <= last_line &&
|
||||||
rec->last_line <= last_line &&
|
|
||||||
rec->first_column > last_column &&
|
rec->first_column > last_column &&
|
||||||
(best == NULL || rec->first_column < best->first_column))
|
(best == NULL || rec->first_column < best->first_column))
|
||||||
best = rec;
|
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) {
|
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (rec->first_line >= first_line &&
|
if (rec->first_line >= first_line && rec->last_line <= last_line &&
|
||||||
rec->last_line <= last_line &&
|
|
||||||
rec->last_column < first_column &&
|
rec->last_column < first_column &&
|
||||||
(best == NULL || rec->last_column > best->last_column))
|
(best == NULL || rec->last_column > best->last_column))
|
||||||
best = rec;
|
best = rec;
|
||||||
|
|
@ -452,8 +449,7 @@ GSList *mainwindows_get_line(MAIN_WINDOW_REC *rec)
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
|
||||||
for (win = mainwindows_find_left(rec, FALSE);
|
for (win = mainwindows_find_left(rec, FALSE); win != NULL;
|
||||||
win != NULL;
|
|
||||||
win = mainwindows_find_left(win, FALSE)) {
|
win = mainwindows_find_left(win, FALSE)) {
|
||||||
list = g_slist_append(list, win);
|
list = g_slist_append(list, win);
|
||||||
}
|
}
|
||||||
|
|
@ -461,8 +457,7 @@ GSList *mainwindows_get_line(MAIN_WINDOW_REC *rec)
|
||||||
if (rec != NULL)
|
if (rec != NULL)
|
||||||
list = g_slist_append(list, rec);
|
list = g_slist_append(list, rec);
|
||||||
|
|
||||||
for (win = mainwindows_find_right(rec, FALSE);
|
for (win = mainwindows_find_right(rec, FALSE); win != NULL;
|
||||||
win != NULL;
|
|
||||||
win = mainwindows_find_right(win, FALSE)) {
|
win = mainwindows_find_right(win, FALSE)) {
|
||||||
list = g_slist_append(list, win);
|
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)
|
if (destroy_win->last_column < destroy_win->first_column)
|
||||||
return;
|
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);
|
rec = mainwindows_find_left(destroy_win, FALSE);
|
||||||
if (rec != NULL) {
|
if (rec != NULL) {
|
||||||
rec->last_column = destroy_win->last_column;
|
rec->last_column = destroy_win->last_column;
|
||||||
mainwindow_resize(rec, rsize+1, 0);
|
mainwindow_resize(rec, rsize + 1, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rec = mainwindows_find_right(destroy_win, FALSE);
|
rec = mainwindows_find_right(destroy_win, FALSE);
|
||||||
if (rec != NULL) {
|
if (rec != NULL) {
|
||||||
rec->first_column = destroy_win->first_column;
|
rec->first_column = destroy_win->first_column;
|
||||||
mainwindow_resize(rec, rsize+1, 0);
|
mainwindow_resize(rec, rsize + 1, 0);
|
||||||
return;
|
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);
|
rec = mainwindows_find_lower(destroy_win);
|
||||||
if (rec != NULL) {
|
if (rec != NULL) {
|
||||||
|
|
@ -563,7 +558,8 @@ static void mainwindow_destroy_full(MAIN_WINDOW_REC *window, int respace)
|
||||||
|
|
||||||
g_free(window);
|
g_free(window);
|
||||||
|
|
||||||
if (active_mainwin == window) active_mainwin = NULL;
|
if (active_mainwin == window)
|
||||||
|
active_mainwin = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainwindow_destroy(MAIN_WINDOW_REC *window)
|
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)
|
static int mainwindows_compare(MAIN_WINDOW_REC *w1, MAIN_WINDOW_REC *w2)
|
||||||
{
|
{
|
||||||
return w1->first_line < w2->first_line ? -1
|
return w1->first_line < w2->first_line ? -1 :
|
||||||
: 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 :
|
||||||
: w1->first_column > w2->first_column ? 1
|
w1->first_column > w2->first_column ? 1 :
|
||||||
: 0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainwindows_compare_reverse(MAIN_WINDOW_REC *w1, MAIN_WINDOW_REC *w2)
|
static int mainwindows_compare_reverse(MAIN_WINDOW_REC *w1, MAIN_WINDOW_REC *w2)
|
||||||
{
|
{
|
||||||
return w1->first_line < w2->first_line ? 1
|
return w1->first_line < w2->first_line ? 1 :
|
||||||
: 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 :
|
||||||
: w1->first_column > w2->first_column ? -1
|
w1->first_column > w2->first_column ? -1 :
|
||||||
: 0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *mainwindows_get_sorted(int reverse)
|
GSList *mainwindows_get_sorted(int reverse)
|
||||||
|
|
@ -612,8 +608,9 @@ GSList *mainwindows_get_sorted(int reverse)
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||||
list = g_slist_insert_sorted(list, tmp->data, (GCompareFunc)
|
list = g_slist_insert_sorted(
|
||||||
(reverse ? mainwindows_compare_reverse : mainwindows_compare));
|
list, tmp->data,
|
||||||
|
(GCompareFunc) (reverse ? mainwindows_compare_reverse : mainwindows_compare));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -626,9 +623,7 @@ static void mainwindows_resize_smaller(int ydiff)
|
||||||
int space;
|
int space;
|
||||||
|
|
||||||
sorted = NULL;
|
sorted = NULL;
|
||||||
for (rec = mainwindows_find_lower(NULL);
|
for (rec = mainwindows_find_lower(NULL); rec != NULL; rec = mainwindows_find_lower(rec)) {
|
||||||
rec != NULL;
|
|
||||||
rec = mainwindows_find_lower(rec)) {
|
|
||||||
sorted = g_slist_prepend(sorted, rec);
|
sorted = g_slist_prepend(sorted, rec);
|
||||||
}
|
}
|
||||||
if (sorted == NULL)
|
if (sorted == NULL)
|
||||||
|
|
@ -650,7 +645,7 @@ static void mainwindows_resize_smaller(int ydiff)
|
||||||
if (win == active_mainwin && tmp == sorted)
|
if (win == active_mainwin && tmp == sorted)
|
||||||
skip_active = TRUE;
|
skip_active = TRUE;
|
||||||
|
|
||||||
lmin = MAIN_WINDOW_TEXT_HEIGHT(win)-WINDOW_MIN_SIZE;
|
lmin = MAIN_WINDOW_TEXT_HEIGHT(win) - WINDOW_MIN_SIZE;
|
||||||
if (lmin < min)
|
if (lmin < min)
|
||||||
min = lmin;
|
min = lmin;
|
||||||
}
|
}
|
||||||
|
|
@ -701,7 +696,7 @@ static void mainwindows_resize_smaller(int ydiff)
|
||||||
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
||||||
int lmin;
|
int lmin;
|
||||||
MAIN_WINDOW_REC *win = ltmp->data;
|
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)
|
if (lmin < min)
|
||||||
min = lmin;
|
min = lmin;
|
||||||
}
|
}
|
||||||
|
|
@ -718,7 +713,8 @@ static void mainwindows_resize_smaller(int ydiff)
|
||||||
signal_emit("mainwindow moved", 1, win);
|
signal_emit("mainwindow moved", 1, win);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (space > -ydiff) space = -ydiff;
|
if (space > -ydiff)
|
||||||
|
space = -ydiff;
|
||||||
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
||||||
MAIN_WINDOW_REC *win = ltmp->data;
|
MAIN_WINDOW_REC *win = ltmp->data;
|
||||||
win->last_line += ydiff;
|
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 */
|
/* Available text width on this line should respect globally reserved columns */
|
||||||
new_avail = screen_width - screen_reserved_left - screen_reserved_right - windows + 1;
|
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;
|
extra_width = new_avail;
|
||||||
for (tmp = line, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
for (tmp = line, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
/* Scale each window proportionally based on available text widths (excluding reserved columns) */
|
/* Scale each window proportionally based on available text widths (excluding
|
||||||
widths[i] = old_avail > 0 ? (MAIN_WINDOW_TEXT_WIDTH(rec) * new_avail) / old_avail : MAIN_WINDOW_TEXT_WIDTH(rec);
|
* 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;
|
extra_width -= widths[i] + rec->statusbar_columns;
|
||||||
}
|
}
|
||||||
shrunk = FALSE;
|
shrunk = FALSE;
|
||||||
for (i = windows; extra_width < 0; i = i > 1 ? i - 1 : windows) {
|
for (i = windows; extra_width < 0; i = i > 1 ? i - 1 : windows) {
|
||||||
if (widths[i-1] > NEW_WINDOW_WIDTH || (i == 1 && !shrunk)) {
|
if (widths[i - 1] > NEW_WINDOW_WIDTH || (i == 1 && !shrunk)) {
|
||||||
widths[i-1]--;
|
widths[i - 1]--;
|
||||||
extra_width++;
|
extra_width++;
|
||||||
shrunk = i == 1;
|
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 */
|
/* Distribute any leftover width across windows; base modulo on available width */
|
||||||
width_mod = new_avail % windows;
|
width_mod = new_avail % windows;
|
||||||
#define extra ( (i >= width_mod && i < extra_width + width_mod) \
|
#define extra \
|
||||||
|| i + windows < extra_width + width_mod ? 1 : 0 )
|
((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++) {
|
for (tmp = line, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
|
|
@ -779,13 +781,16 @@ static void mainwindows_rresize_line(int xdiff, MAIN_WINDOW_REC *win)
|
||||||
if (is_last) {
|
if (is_last) {
|
||||||
/* Anchor rightmost window to reserved-right boundary to avoid gap/lag */
|
/* Anchor rightmost window to reserved-right boundary to avoid gap/lag */
|
||||||
rec->last_column = screen_width - 1 - screen_reserved_right;
|
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 {
|
} 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 */
|
/* Ensure we never write past the globally reserved right columns */
|
||||||
if (rec->last_column > screen_width - 1 - screen_reserved_right)
|
if (rec->last_column > screen_width - 1 - screen_reserved_right)
|
||||||
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;
|
rec->size_dirty = TRUE;
|
||||||
next_column = rec->last_column + 2;
|
next_column = rec->last_column + 2;
|
||||||
|
|
@ -800,8 +805,8 @@ void mainwindows_resize(int width, int height)
|
||||||
{
|
{
|
||||||
int xdiff, ydiff;
|
int xdiff, ydiff;
|
||||||
|
|
||||||
xdiff = width-screen_width;
|
xdiff = width - screen_width;
|
||||||
ydiff = height-screen_height;
|
ydiff = height - screen_height;
|
||||||
screen_width = width;
|
screen_width = width;
|
||||||
screen_height = height;
|
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;
|
int avail_h = screen_height - screen_reserved_top - screen_reserved_bottom;
|
||||||
if (avail_w <= 1 || avail_h <= 1) {
|
if (avail_w <= 1 || avail_h <= 1) {
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
if (!screen_collapsed) screen_collapsed = 1;
|
if (!screen_collapsed)
|
||||||
|
screen_collapsed = 1;
|
||||||
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
|
||||||
MAIN_WINDOW_REC *rec = tmp->data;
|
MAIN_WINDOW_REC *rec = tmp->data;
|
||||||
rec->first_column = screen_reserved_left;
|
rec->first_column = screen_reserved_left;
|
||||||
|
|
@ -830,7 +836,8 @@ void mainwindows_resize(int width, int height)
|
||||||
/* Recover from collapsed state: reflow horizontally. */
|
/* Recover from collapsed state: reflow horizontally. */
|
||||||
MAIN_WINDOW_REC *win;
|
MAIN_WINDOW_REC *win;
|
||||||
screen_collapsed = 0;
|
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);
|
mainwindows_rresize_line(0, win);
|
||||||
}
|
}
|
||||||
irssi_set_dirty();
|
irssi_set_dirty();
|
||||||
|
|
@ -854,8 +861,7 @@ void mainwindows_resize(int width, int height)
|
||||||
/* algorithm: distribute new space on each line */
|
/* algorithm: distribute new space on each line */
|
||||||
MAIN_WINDOW_REC *win;
|
MAIN_WINDOW_REC *win;
|
||||||
|
|
||||||
for (win = mainwindows_find_lower(NULL);
|
for (win = mainwindows_find_lower(NULL); win != NULL;
|
||||||
win != NULL;
|
|
||||||
win = mainwindows_find_lower(win)) {
|
win = mainwindows_find_lower(win)) {
|
||||||
mainwindows_rresize_line(xdiff, 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 */
|
destroy windows on the right if no room */
|
||||||
MAIN_WINDOW_REC *win;
|
MAIN_WINDOW_REC *win;
|
||||||
|
|
||||||
for (win = mainwindows_find_lower(NULL);
|
for (win = mainwindows_find_lower(NULL); win != NULL;
|
||||||
win != NULL;
|
|
||||||
win = mainwindows_find_lower(win)) {
|
win = mainwindows_find_lower(win)) {
|
||||||
int max_windows, i, last_column;
|
int max_windows, i, last_column;
|
||||||
GSList *line, *tmp;
|
GSList *line, *tmp;
|
||||||
|
|
||||||
line = mainwindows_get_line(win);
|
line = mainwindows_get_line(win);
|
||||||
/* Respect globally reserved columns when computing capacity */
|
/* 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)
|
if (max_windows < 1)
|
||||||
max_windows = 1;
|
max_windows = 1;
|
||||||
last_column = screen_width - 1 - screen_reserved_right;
|
last_column = screen_width - 1 - screen_reserved_right;
|
||||||
|
|
@ -888,7 +895,8 @@ void mainwindows_resize(int width, int height)
|
||||||
win = line->data;
|
win = line->data;
|
||||||
g_slist_free(line);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window,
|
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window, int top, int bottom)
|
||||||
int top, int bottom)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
@ -968,14 +975,13 @@ int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window,
|
||||||
window->statusbar_lines += bottom;
|
window->statusbar_lines += bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top+bottom != 0)
|
if (top + bottom != 0)
|
||||||
window->size_dirty = TRUE;
|
window->size_dirty = TRUE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mainwindows_resize_two(GSList *grow_list,
|
static void mainwindows_resize_two(GSList *grow_list, GSList *shrink_list, int count)
|
||||||
GSList *shrink_list, int count)
|
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
MAIN_WINDOW_REC *win;
|
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) {
|
for (tmp = shrink_list; tmp != NULL; tmp = tmp->next) {
|
||||||
win = tmp->data;
|
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;
|
ok = FALSE;
|
||||||
break;
|
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) {
|
for (tmp = shrink_list; tmp != NULL; tmp = tmp->next) {
|
||||||
win = tmp->data;
|
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;
|
ok = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1083,8 +1089,7 @@ static int try_shrink_upper(MAIN_WINDOW_REC *window, int count)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainwindow_grow(MAIN_WINDOW_REC *window, int count,
|
static int mainwindow_grow(MAIN_WINDOW_REC *window, int count, int resize_lower)
|
||||||
int resize_lower)
|
|
||||||
{
|
{
|
||||||
if (!resize_lower || !try_shrink_lower(window, count)) {
|
if (!resize_lower || !try_shrink_lower(window, count)) {
|
||||||
if (!try_shrink_upper(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);
|
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;
|
return FALSE;
|
||||||
|
|
||||||
if (!resize_lower || !try_grow_lower(window, count)) {
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mainwindows_rresize_two(MAIN_WINDOW_REC *grow_win,
|
static void mainwindows_rresize_two(MAIN_WINDOW_REC *grow_win, MAIN_WINDOW_REC *shrink_win,
|
||||||
MAIN_WINDOW_REC *shrink_win, int count)
|
int count)
|
||||||
{
|
{
|
||||||
irssi_set_dirty();
|
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);
|
shrink_win = mainwindows_find_right(window, FALSE);
|
||||||
if (shrink_win != NULL) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1206,7 +1211,7 @@ static int try_shrink_left(MAIN_WINDOW_REC *window, int count)
|
||||||
|
|
||||||
shrink_win = mainwindows_find_left(window, FALSE);
|
shrink_win = mainwindows_find_left(window, FALSE);
|
||||||
if (shrink_win != NULL) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
window->first_column -= count;
|
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);
|
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;
|
return FALSE;
|
||||||
|
|
||||||
if (!try_grow_right(window, count)) {
|
if (!try_grow_right(window, count)) {
|
||||||
|
|
@ -1338,20 +1343,19 @@ static void window_balance_vertical(void)
|
||||||
MAIN_WINDOW_REC *win;
|
MAIN_WINDOW_REC *win;
|
||||||
|
|
||||||
windows = g_slist_length(mainwindows);
|
windows = g_slist_length(mainwindows);
|
||||||
if (windows == 1) return;
|
if (windows == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
sorted = NULL;
|
sorted = NULL;
|
||||||
windows = 0;
|
windows = 0;
|
||||||
for (win = mainwindows_find_lower(NULL);
|
for (win = mainwindows_find_lower(NULL); win != NULL; win = mainwindows_find_lower(win)) {
|
||||||
win != NULL;
|
|
||||||
win = mainwindows_find_lower(win)) {
|
|
||||||
windows++;
|
windows++;
|
||||||
sorted = g_slist_append(sorted, win);
|
sorted = g_slist_append(sorted, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
avail_size = term_height - screen_reserved_top-screen_reserved_bottom;
|
avail_size = term_height - screen_reserved_top - screen_reserved_bottom;
|
||||||
unit_size = avail_size/windows;
|
unit_size = avail_size / windows;
|
||||||
bigger_units = avail_size%windows;
|
bigger_units = avail_size % windows;
|
||||||
|
|
||||||
last_line = screen_reserved_top;
|
last_line = screen_reserved_top;
|
||||||
for (stmp = sorted; stmp != NULL; stmp = stmp->next) {
|
for (stmp = sorted; stmp != NULL; stmp = stmp->next) {
|
||||||
|
|
@ -1362,7 +1366,7 @@ static void window_balance_vertical(void)
|
||||||
MAIN_WINDOW_REC *rec = ltmp->data;
|
MAIN_WINDOW_REC *rec = ltmp->data;
|
||||||
old_size = rec->height;
|
old_size = rec->height;
|
||||||
rec->first_line = last_line;
|
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) {
|
if (bigger_units > 0) {
|
||||||
rec->last_line++;
|
rec->last_line++;
|
||||||
|
|
@ -1373,7 +1377,7 @@ static void window_balance_vertical(void)
|
||||||
if (line != NULL && bigger_units > 0) {
|
if (line != NULL && bigger_units > 0) {
|
||||||
bigger_units--;
|
bigger_units--;
|
||||||
}
|
}
|
||||||
last_line = win->last_line+1;
|
last_line = win->last_line + 1;
|
||||||
|
|
||||||
g_slist_free(line);
|
g_slist_free(line);
|
||||||
}
|
}
|
||||||
|
|
@ -1388,8 +1392,7 @@ static void cmd_window_hide(const char *data)
|
||||||
WINDOW_REC *window;
|
WINDOW_REC *window;
|
||||||
|
|
||||||
if (mainwindows->next == NULL) {
|
if (mainwindows->next == NULL) {
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, TXT_CANT_HIDE_LAST);
|
||||||
TXT_CANT_HIDE_LAST);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1398,8 +1401,8 @@ static void cmd_window_hide(const char *data)
|
||||||
else if (is_numeric(data, 0)) {
|
else if (is_numeric(data, 0)) {
|
||||||
window = window_find_refnum(atoi(data));
|
window = window_find_refnum(atoi(data));
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
|
printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_REFNUM_NOT_FOUND,
|
||||||
TXT_REFNUM_NOT_FOUND, data);
|
data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window = window_find_item(active_win->active_server, data);
|
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')) {
|
if (is_numeric(args, '\0')) {
|
||||||
window = window_find_refnum(atoi(args));
|
window = window_find_refnum(atoi(args));
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
|
printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_REFNUM_NOT_FOUND,
|
||||||
TXT_REFNUM_NOT_FOUND, args);
|
args);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window = window_find_item(active_win->active_server, args);
|
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>] */
|
/* SYNTAX: WINDOW GROW [-right] [<lines>|<columns>] */
|
||||||
static void cmd_window_grow(const char *data)
|
static void cmd_window_grow(const char *data)
|
||||||
{
|
{
|
||||||
|
|
@ -1536,7 +1538,8 @@ static void cmd_window_shrink(const char *data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
count = *data == '\0' ? 1 : atoi(args);
|
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) {
|
if (g_hash_table_lookup(optlist, "right") != NULL) {
|
||||||
mainwindow_grow_right_int(-count);
|
mainwindow_grow_right_int(-count);
|
||||||
|
|
@ -1570,9 +1573,9 @@ static void cmd_window_size(const char *data)
|
||||||
|
|
||||||
mainwindow_grow_right_int(size);
|
mainwindow_grow_right_int(size);
|
||||||
} else {
|
} else {
|
||||||
size -= WINDOW_MAIN(active_win)->height -
|
size -= WINDOW_MAIN(active_win)->height - WINDOW_MAIN(active_win)->statusbar_lines;
|
||||||
WINDOW_MAIN(active_win)->statusbar_lines;
|
if (size < -INT_MAX)
|
||||||
if (size < -INT_MAX) size = -INT_MAX;
|
size = -INT_MAX;
|
||||||
|
|
||||||
mainwindow_grow_int(size);
|
mainwindow_grow_int(size);
|
||||||
}
|
}
|
||||||
|
|
@ -1594,16 +1597,16 @@ static void window_balance_horizontal(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
avail_width = term_width - screen_reserved_left-screen_reserved_right - windows + 1;
|
avail_width = term_width - screen_reserved_left - screen_reserved_right - windows + 1;
|
||||||
unit_width = avail_width/windows;
|
unit_width = avail_width / windows;
|
||||||
bigger_units = avail_width%windows;
|
bigger_units = avail_width % windows;
|
||||||
|
|
||||||
last_column = screen_reserved_left;
|
last_column = screen_reserved_left;
|
||||||
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
for (ltmp = line; ltmp != NULL; ltmp = ltmp->next) {
|
||||||
win = ltmp->data;
|
win = ltmp->data;
|
||||||
old_width = win->width;
|
old_width = win->width;
|
||||||
win->first_column = last_column;
|
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) {
|
if (bigger_units > 0) {
|
||||||
win->last_column++;
|
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);
|
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);
|
g_slist_free(line);
|
||||||
|
|
||||||
|
|
@ -1644,8 +1647,8 @@ static void cmd_window_up(const char *data)
|
||||||
GHashTable *optlist;
|
GHashTable *optlist;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
|
|
||||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS, "window up",
|
||||||
"window up", &optlist))
|
&optlist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
||||||
|
|
@ -1670,8 +1673,8 @@ static void cmd_window_down(const char *data)
|
||||||
GHashTable *optlist;
|
GHashTable *optlist;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
|
|
||||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS, "window down",
|
||||||
"window down", &optlist))
|
&optlist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
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) \
|
#define WINDOW_STICKY_MATCH(window, sticky_parent) \
|
||||||
((!WINDOW_GUI(window)->sticky && (sticky_parent) == NULL) || \
|
((!WINDOW_GUI(window)->sticky && (sticky_parent) == NULL) || \
|
||||||
(WINDOW_GUI(window)->sticky && \
|
(WINDOW_GUI(window)->sticky && WINDOW_MAIN(window) == (sticky_parent)))
|
||||||
WINDOW_MAIN(window) == (sticky_parent)))
|
|
||||||
|
|
||||||
static int window_refnum_left(int refnum, int wrap)
|
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);
|
window = window_find_refnum(refnum);
|
||||||
g_return_val_if_fail(window != NULL, -1);
|
g_return_val_if_fail(window != NULL, -1);
|
||||||
|
|
||||||
find_sticky = WINDOW_MAIN(window)->sticky_windows ?
|
find_sticky = WINDOW_MAIN(window)->sticky_windows ? WINDOW_MAIN(window) : NULL;
|
||||||
WINDOW_MAIN(window) : NULL;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
refnum = window_refnum_prev(refnum, wrap);
|
refnum = window_refnum_prev(refnum, wrap);
|
||||||
|
|
@ -1727,8 +1728,7 @@ static int window_refnum_right(int refnum, int wrap)
|
||||||
window = window_find_refnum(refnum);
|
window = window_find_refnum(refnum);
|
||||||
g_return_val_if_fail(window != NULL, -1);
|
g_return_val_if_fail(window != NULL, -1);
|
||||||
|
|
||||||
find_sticky = WINDOW_MAIN(window)->sticky_windows ?
|
find_sticky = WINDOW_MAIN(window)->sticky_windows ? WINDOW_MAIN(window) : NULL;
|
||||||
WINDOW_MAIN(window) : NULL;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
refnum = window_refnum_next(refnum, wrap);
|
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;
|
GHashTable *optlist;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
|
|
||||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS, "window left",
|
||||||
"window left", &optlist))
|
&optlist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
if (g_hash_table_lookup(optlist, "directional") != NULL) {
|
||||||
|
|
@ -1834,32 +1834,31 @@ static void cmd_window_stick(const char *data)
|
||||||
/* ref# specified */
|
/* ref# specified */
|
||||||
win = window_find_refnum(atoi(data));
|
win = window_find_refnum(atoi(data));
|
||||||
if (win == NULL) {
|
if (win == NULL) {
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
|
printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_REFNUM_NOT_FOUND,
|
||||||
TXT_REFNUM_NOT_FOUND, data);
|
data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*data != ' ' && *data != '\0') data++;
|
while (*data != ' ' && *data != '\0')
|
||||||
while (*data == ' ') data++;
|
data++;
|
||||||
|
while (*data == ' ')
|
||||||
|
data++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_ascii_strncasecmp(data, "OF", 2) == 0 || i_toupper(*data) == 'N') {
|
if (g_ascii_strncasecmp(data, "OF", 2) == 0 || i_toupper(*data) == 'N') {
|
||||||
/* unset sticky */
|
/* unset sticky */
|
||||||
if (!WINDOW_GUI(win)->sticky) {
|
if (!WINDOW_GUI(win)->sticky) {
|
||||||
printformat_window(win, MSGLEVEL_CLIENTERROR,
|
printformat_window(win, MSGLEVEL_CLIENTERROR, TXT_WINDOW_NOT_STICKY);
|
||||||
TXT_WINDOW_NOT_STICKY);
|
|
||||||
} else {
|
} else {
|
||||||
gui_window_set_unsticky(win);
|
gui_window_set_unsticky(win);
|
||||||
printformat_window(win, MSGLEVEL_CLIENTNOTICE,
|
printformat_window(win, MSGLEVEL_CLIENTNOTICE, TXT_WINDOW_UNSET_STICKY);
|
||||||
TXT_WINDOW_UNSET_STICKY);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* set sticky */
|
/* set sticky */
|
||||||
window_reparent(win, mainwin);
|
window_reparent(win, mainwin);
|
||||||
gui_window_set_sticky(win);
|
gui_window_set_sticky(win);
|
||||||
|
|
||||||
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
|
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE, TXT_WINDOW_SET_STICKY);
|
||||||
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_append_printf(str, "#%d, ", rec->refnum);
|
||||||
}
|
}
|
||||||
g_string_truncate(str, str->len-2);
|
g_string_truncate(str, str->len - 2);
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
|
|
||||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_STICKY, str->str);
|
||||||
TXT_WINDOW_INFO_STICKY, str->str);
|
|
||||||
g_string_free(str, TRUE);
|
g_string_free(str, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1997,8 +1995,7 @@ static void sig_window_print_info(WINDOW_REC *win)
|
||||||
|
|
||||||
gui = WINDOW_GUI(win);
|
gui = WINDOW_GUI(win);
|
||||||
if (gui->use_scroll) {
|
if (gui->use_scroll) {
|
||||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_SCROLL,
|
||||||
TXT_WINDOW_INFO_SCROLL,
|
|
||||||
gui->scroll ? "yes" : "no");
|
gui->scroll ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2106,8 +2103,7 @@ int mainwindows_reserve_columns(int left, int right)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window,
|
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window, int left, int right)
|
||||||
int left, int right)
|
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if (left != 0) {
|
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 += right;
|
||||||
window->statusbar_columns += right;
|
window->statusbar_columns += right;
|
||||||
}
|
}
|
||||||
if (left+right != 0)
|
if (left + right != 0)
|
||||||
window->size_dirty = TRUE;
|
window->size_dirty = TRUE;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@
|
||||||
#define WINDOW_MIN_SIZE 2
|
#define WINDOW_MIN_SIZE 2
|
||||||
#define NEW_WINDOW_WIDTH 20 /* must be >= MIN_SCREEN_WIDTH defined in term.c */
|
#define NEW_WINDOW_WIDTH 20 /* must be >= MIN_SCREEN_WIDTH defined in term.c */
|
||||||
|
|
||||||
#define MAIN_WINDOW_TEXT_HEIGHT(window) \
|
#define MAIN_WINDOW_TEXT_HEIGHT(window) ((window)->height - (window)->statusbar_lines)
|
||||||
((window)->height-(window)->statusbar_lines)
|
|
||||||
|
|
||||||
#define MAIN_WINDOW_TEXT_WIDTH(window) \
|
#define MAIN_WINDOW_TEXT_WIDTH(window) ((window)->width - (window)->statusbar_columns)
|
||||||
((window)->width-(window)->statusbar_columns)
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WINDOW_REC *active;
|
WINDOW_REC *active;
|
||||||
|
|
@ -19,8 +17,10 @@ typedef struct {
|
||||||
TERM_WINDOW *screen_win;
|
TERM_WINDOW *screen_win;
|
||||||
int sticky_windows; /* number of sticky windows */
|
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_line,
|
||||||
int first_column, last_column; /* first/last column used by this window (0..x) (includes statusbars) */
|
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) */
|
int width, height; /* width/height of the window (includes statusbars) */
|
||||||
|
|
||||||
GSList *statusbars;
|
GSList *statusbars;
|
||||||
|
|
@ -29,8 +29,9 @@ typedef struct {
|
||||||
int statusbar_columns_left, statusbar_columns_right;
|
int statusbar_columns_left, statusbar_columns_right;
|
||||||
int statusbar_columns; /* left+right */
|
int statusbar_columns; /* left+right */
|
||||||
|
|
||||||
unsigned int dirty:1; /* This window needs a redraw */
|
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 size_dirty : 1; /* We'll need to resize the window, but haven't got around
|
||||||
|
doing it just yet. */
|
||||||
} MAIN_WINDOW_REC;
|
} MAIN_WINDOW_REC;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -55,23 +56,19 @@ void mainwindows_recreate(void);
|
||||||
/* Change the window height - the height includes the lines needed for
|
/* Change the window height - the height includes the lines needed for
|
||||||
statusbars. If resize_lower is TRUE, the lower window is first tried
|
statusbars. If resize_lower is TRUE, the lower window is first tried
|
||||||
to be resized instead of upper window. */
|
to be resized instead of upper window. */
|
||||||
void mainwindow_set_size(MAIN_WINDOW_REC *window, int height,
|
void mainwindow_set_size(MAIN_WINDOW_REC *window, int height, int resize_lower);
|
||||||
int resize_lower);
|
|
||||||
void mainwindow_set_rsize(MAIN_WINDOW_REC *window, int width);
|
void mainwindow_set_rsize(MAIN_WINDOW_REC *window, int width);
|
||||||
void mainwindows_resize(int width, int height);
|
void mainwindows_resize(int width, int height);
|
||||||
|
|
||||||
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin,
|
void mainwindow_change_active(MAIN_WINDOW_REC *mainwin, WINDOW_REC *skip_window);
|
||||||
WINDOW_REC *skip_window);
|
|
||||||
|
|
||||||
int mainwindows_reserve_lines(int top, int bottom);
|
int mainwindows_reserve_lines(int top, int bottom);
|
||||||
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window,
|
int mainwindow_set_statusbar_lines(MAIN_WINDOW_REC *window, int top, int bottom);
|
||||||
int top, int bottom);
|
|
||||||
void mainwindows_redraw_dirty(void);
|
void mainwindows_redraw_dirty(void);
|
||||||
|
|
||||||
/* Reserve columns at left/right of a main window (for side panels). */
|
/* Reserve columns at left/right of a main window (for side panels). */
|
||||||
int mainwindows_reserve_columns(int left, int right);
|
int mainwindows_reserve_columns(int left, int right);
|
||||||
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window,
|
int mainwindow_set_statusbar_columns(MAIN_WINDOW_REC *window, int left, int right);
|
||||||
int left, int right);
|
|
||||||
|
|
||||||
GSList *mainwindows_get_sorted(int reverse);
|
GSList *mainwindows_get_sorted(int reverse);
|
||||||
GSList *mainwindows_get_line(MAIN_WINDOW_REC *rec);
|
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_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_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_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
|
#endif
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue