1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Windowing system fixes, doesn't crash anymore after window resizes.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@577 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-08-10 19:13:54 +00:00 committed by cras
parent fc890ebd82
commit a900cb580f
5 changed files with 14 additions and 18 deletions

View File

@ -88,14 +88,14 @@ static void window_prev_page(void)
{ {
GUI_WINDOW_REC *gui = WINDOW_GUI(active_win); GUI_WINDOW_REC *gui = WINDOW_GUI(active_win);
gui_window_scroll(active_win, -(gui->parent->last_line-gui->parent->first_line)/2); gui_window_scroll(active_win, -gui->parent->lines/2);
} }
static void window_next_page(void) static void window_next_page(void)
{ {
GUI_WINDOW_REC *gui = WINDOW_GUI(active_win); GUI_WINDOW_REC *gui = WINDOW_GUI(active_win);
gui_window_scroll(active_win, (gui->parent->last_line-gui->parent->first_line)/2); gui_window_scroll(active_win, gui->parent->lines/2);
} }
static const char *get_key_name(int key) static const char *get_key_name(int key)

View File

@ -269,7 +269,7 @@ static void scrollback_goto_pos(WINDOW_REC *window, GList *pos)
gui->startline = gui->bottom_startline; gui->startline = gui->bottom_startline;
gui->subline = gui->bottom_subline; gui->subline = gui->bottom_subline;
gui->ypos = gui->parent->last_line-gui->parent->first_line; gui->ypos = gui->parent->lines-1;
gui->bottom = TRUE; gui->bottom = TRUE;
} }
@ -400,7 +400,7 @@ static void cmd_scrollback_end(const char *data)
gui->startline = gui->bottom_startline; gui->startline = gui->bottom_startline;
gui->subline = gui->bottom_subline; gui->subline = gui->bottom_subline;
gui->ypos = gui->parent->last_line-gui->parent->first_line; gui->ypos = gui->parent->lines-1;
gui->bottom = TRUE; gui->bottom = TRUE;
if (is_window_visible(active_win)) if (is_window_visible(active_win))

View File

@ -57,12 +57,6 @@ static MAIN_WINDOW_REC *find_window_with_room(void)
return biggest_rec; return biggest_rec;
} }
static void create_curses_window(MAIN_WINDOW_REC *window)
{
window->curses_win =
subwin(stdscr, window->lines, COLS, window->first_line, 0);
}
static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange) static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
{ {
GSList *tmp; GSList *tmp;
@ -70,8 +64,8 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
if (ychange == 0 && !xchange) return; if (ychange == 0 && !xchange) return;
window->lines = window->last_line-window->first_line+1; window->lines = window->last_line-window->first_line+1;
delwin(window->curses_win); wresize(window->curses_win, window->lines, COLS);
create_curses_window(window); mvwin(window->curses_win, window->first_line, 0);
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;
@ -110,13 +104,13 @@ MAIN_WINDOW_REC *mainwindow_create(void)
rec->lines = rec->last_line-rec->first_line+1; rec->lines = rec->last_line-rec->first_line+1;
parent->first_line = rec->last_line+1+rec->statusbar_lines; parent->first_line = rec->last_line+1+rec->statusbar_lines;
parent->lines = parent->last_line-parent->first_line+1; parent->lines = parent->last_line-parent->first_line+1;
delwin(parent->curses_win);
create_curses_window(parent);
mainwindow_resize(parent, -space-1, FALSE); mainwindow_resize(parent, -space-1, FALSE);
} }
create_curses_window(rec); rec->curses_win = newwin(rec->lines, COLS, rec->first_line, 0);
refresh();
mainwindows = g_slist_append(mainwindows, rec); mainwindows = g_slist_append(mainwindows, rec);
signal_emit("mainwindow created", 1, rec); signal_emit("mainwindow created", 1, rec);
return rec; return rec;
@ -416,7 +410,8 @@ int mainwindows_reserve_lines(int count, int up)
return ret; return ret;
} }
static void mainwindows_resize_two(MAIN_WINDOW_REC *grow_win, MAIN_WINDOW_REC *shrink_win, int count) static void mainwindows_resize_two(MAIN_WINDOW_REC *grow_win,
MAIN_WINDOW_REC *shrink_win, int count)
{ {
mainwindow_resize(grow_win, count, FALSE); mainwindow_resize(grow_win, count, FALSE);
mainwindow_resize(shrink_win, -count, FALSE); mainwindow_resize(shrink_win, -count, FALSE);
@ -526,6 +521,7 @@ static void cmd_window_balance(void)
rec->first_line = last_line+1; rec->first_line = last_line+1;
rec->last_line = rec->first_line-1 + unit_size - rec->last_line = rec->first_line-1 + unit_size -
rec->statusbar_lines; rec->statusbar_lines;
rec->lines = rec->last_line-rec->first_line+1;
if (bigger_units > 0) { if (bigger_units > 0) {
rec->last_line++; rec->last_line++;

View File

@ -781,7 +781,7 @@ static void sidebar_remove_items(MAIN_WINDOW_REC *window)
static void sig_mainwindow_created(MAIN_WINDOW_REC *window) static void sig_mainwindow_created(MAIN_WINDOW_REC *window)
{ {
window->statusbar = statusbar_create(STATUSBAR_POS_MIDDLE, window->last_line+1); window->statusbar = statusbar_create(STATUSBAR_POS_MIDDLE, window->first_line+window->lines);
sidebar_add_items(window); sidebar_add_items(window);
} }

View File

@ -242,7 +242,7 @@ static void sig_mainwindow_resized(MAIN_WINDOW_REC *window)
STATUSBAR_REC *rec; STATUSBAR_REC *rec;
rec = window->statusbar; rec = window->statusbar;
rec->ypos = window->last_line+1; rec->ypos = window->first_line+window->lines;
} }
void statusbar_init(void) void statusbar_init(void)