void update_screen_size(void) { if (!term_get_size(&screen_w, &screen_h)) { if (screen_w < 3) screen_w = 3; if (screen_h < 3) screen_h = 3; update_window_sizes(); } }
/* Resize the terminal if needed */ void term_resize_dirty(void) { int width, height; if (!resize_dirty) return; resize_dirty = FALSE; if (!term_get_size(&width, &height)) width = height = -1; term_resize(width, height); mainwindows_resize(term_width, term_height); term_resize_final(width, height); }
int term_init(void) { struct sigaction act; int width, height; last_fg = last_bg = -1; last_attrs = 0; vcx = vcy = 0; crealx = crealy = -1; vcmove = FALSE; cforcemove = TRUE; curs_visible = TRUE; current_term = terminfo_core_init(stdin, stdout); if (current_term == NULL) return FALSE; if (term_get_size(&width, &height)) { current_term->width = width; current_term->height = height; } /* grab CONT signal */ sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = sig_cont; sigaction(SIGCONT, &act, NULL); sigcont_source = g_source_new(&sigcont_funcs, sizeof(GSource)); g_source_set_callback(sigcont_source, do_redraw, NULL, NULL); g_source_attach(sigcont_source, NULL); curs_x = curs_y = 0; term_width = current_term->width; term_height = current_term->height; root_window = term_window_create(0, 0, term_width, term_height); term_lines_empty = g_new0(char, term_height); term_set_input_type(TERM_TYPE_8BIT); term_common_init(); atexit(term_deinit); return TRUE; }