Remove non-working detach/attach code.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4806 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-04-19 15:01:16 +00:00 committed by exg
commit 7bd938542e
4 changed files with 3 additions and 76 deletions

View file

@ -47,7 +47,6 @@ static char *term_lines_empty; /* 1 if line is entirely empty */
static int vcmove, vcx, vcy, curs_visible;
static int crealx, crealy, cforcemove;
static int curs_x, curs_y;
static int auto_detach;
static int last_fg, last_bg, last_attrs;
@ -106,7 +105,6 @@ int term_init(void)
term_width = current_term->width;
term_height = current_term->height;
root_window = term_window_create(0, 0, term_width, term_height);
term_detached = FALSE;
term_lines_empty = g_new0(char, term_height);
@ -130,8 +128,6 @@ void term_deinit(void)
static void term_move_real(void)
{
if (term_detached) return;
if (vcx != crealx || vcy != crealy || cforcemove) {
if (curs_visible) {
terminfo_set_cursor_visible(FALSE);
@ -194,16 +190,12 @@ int term_has_colors(void)
/* Force the colors on any way you can */
void term_force_colors(int set)
{
if (term_detached) return;
terminfo_setup_colors(current_term, set);
}
/* Clear screen */
void term_clear(void)
{
if (term_detached) return;
term_set_color(root_window, ATTR_RESET);
terminfo_clear();
term_move_reset(0, 0);
@ -214,8 +206,6 @@ void term_clear(void)
/* Beep */
void term_beep(void)
{
if (term_detached) return;
terminfo_beep(current_term);
}
@ -252,8 +242,6 @@ void term_window_clear(TERM_WINDOW *window)
{
int y;
if (term_detached) return;
terminfo_set_normal();
if (window->y == 0 && window->height == term_height) {
term_clear();
@ -270,8 +258,6 @@ void term_window_scroll(TERM_WINDOW *window, int count)
{
int y;
if (term_detached) return;
terminfo_scroll(window->y, window->y+window->height-1, count);
term_move_reset(vcx, vcy);
@ -285,8 +271,6 @@ void term_set_color(TERM_WINDOW *window, int col)
{
int set_normal;
if (term_detached) return;
set_normal = ((col & ATTR_RESETFG) && last_fg != -1) ||
((col & ATTR_RESETBG) && last_bg != -1);
if (((last_attrs & ATTR_BOLD) && (col & ATTR_BOLD) == 0) ||
@ -387,8 +371,6 @@ static void term_printed_text(int count)
void term_addch(TERM_WINDOW *window, char chr)
{
if (term_detached) return;
if (vcmove) term_move_real();
if (vcy < term_height-1 || vcx < term_width-1) {
@ -416,8 +398,6 @@ static void term_addch_utf8(TERM_WINDOW *window, unichar chr)
void term_add_unichar(TERM_WINDOW *window, unichar chr)
{
if (term_detached) return;
if (vcmove) term_move_real();
if (vcy == term_height-1 && vcx == term_width-1)
return; /* last char in screen */
@ -447,8 +427,6 @@ void term_addstr(TERM_WINDOW *window, const char *str)
{
int len;
if (term_detached) return;
if (vcmove) term_move_real();
len = strlen(str); /* FIXME utf8 or big5 */
term_printed_text(len);
@ -461,8 +439,6 @@ void term_addstr(TERM_WINDOW *window, const char *str)
void term_clrtoeol(TERM_WINDOW *window)
{
if (term_detached) return;
/* clrtoeol() doesn't necessarily understand colors */
if (last_fg == -1 && last_bg == -1 &&
(last_attrs & (ATTR_UNDERLINE|ATTR_REVERSE)) == 0) {
@ -488,7 +464,7 @@ void term_move_cursor(int x, int y)
void term_refresh(TERM_WINDOW *window)
{
if (term_detached || freeze_counter > 0)
if (freeze_counter > 0)
return;
term_move(root_window, curs_x, curs_y);
@ -514,43 +490,12 @@ void term_refresh_thaw(void)
term_refresh(NULL);
}
void term_auto_detach(int set)
{
auto_detach = set;
}
void term_detach(void)
{
terminfo_stop(current_term);
fclose(current_term->in);
fclose(current_term->out);
current_term->in = NULL;
current_term->out = NULL;
term_detached = TRUE;
}
void term_attach(FILE *in, FILE *out)
{
current_term->in = in;
current_term->out = out;
term_detached = FALSE;
terminfo_cont(current_term);
irssi_redraw();
}
void term_stop(void)
{
if (term_detached) {
kill(getpid(), SIGTSTP);
} else {
terminfo_stop(current_term);
kill(getpid(), SIGTSTP);
terminfo_cont(current_term);
irssi_redraw();
}
}
static int input_utf8(const unsigned char *buffer, int size, unichar *result)
@ -612,18 +557,12 @@ void term_gets(void)
{
int ret, i, char_len;
if (term_detached)
return;
/* fread() doesn't work */
ret = read(fileno(current_term->in),
term_inbuf + term_inbuf_pos, sizeof(term_inbuf)-term_inbuf_pos);
if (ret == 0) {
/* EOF - terminal got lost */
if (auto_detach)
term_detach();
else
ret = -1;
} else if (ret == -1 && (errno == EINTR || errno == EAGAIN))
ret = 0;