diff --git a/putty.h b/putty.h index b8350eb8..da6a175e 100644 --- a/putty.h +++ b/putty.h @@ -1020,9 +1020,6 @@ void do_text(Context, int, int, wchar_t *, int, unsigned long, int, void do_cursor(Context, int, int, wchar_t *, int, unsigned long, int, truecolour); int char_width(Context ctx, int uc); -#ifdef OPTIMISE_SCROLL -void do_scroll(Context, int, int, int); -#endif void set_title(Frontend *frontend, char *); void set_icon(Frontend *frontend, char *); void set_sbar(Frontend *frontend, int, int, int); @@ -1043,7 +1040,6 @@ void modalfatalbox(const char *, ...); void do_beep(Frontend *frontend, int); void sys_cursor(Frontend *frontend, int x, int y); void frontend_request_paste(Frontend *frontend, int clipboard); -#define OPTIMISE_IS_SCROLL 1 void set_iconic(Frontend *frontend, int iconic); void move_window(Frontend *frontend, int x, int y); diff --git a/terminal.c b/terminal.c index 621d81de..01fd8da0 100644 --- a/terminal.c +++ b/terminal.c @@ -101,7 +101,7 @@ static void resizeline(Terminal *, termline *, int); static termline *lineptr(Terminal *, int, int, int); static void unlineptr(termline *); static void check_line_size(Terminal *, termline *); -static void do_paint(Terminal *, Context, int); +static void do_paint(Terminal *, Context); static void erase_lots(Terminal *, int, int, int); static int find_last_nonempty_line(Terminal *, tree234 *); static void swap_screen(Terminal *, int, int, int); @@ -110,9 +110,6 @@ static void deselect(Terminal *); static void term_print_finish(Terminal *); static void scroll(Terminal *, int, int, int, int); static void parse_optionalrgb(optionalrgb *out, unsigned *values); -#ifdef OPTIMISE_SCROLL -static void scroll_display(Terminal *, int, int, int); -#endif /* OPTIMISE_SCROLL */ static termline *newline(Terminal *term, int cols, int bce) { @@ -1366,7 +1363,7 @@ void term_update(Terminal *term) if (need_sbar_update) update_sbar(term); - do_paint(term, ctx, TRUE); + do_paint(term, ctx); sys_cursor(term->frontend, term->curs.x, term->curs.y - term->disptop); free_ctx(ctx); } @@ -1686,9 +1683,6 @@ Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata, term->rows = term->cols = -1; power_on(term, TRUE); term->beephead = term->beeptail = NULL; -#ifdef OPTIMISE_SCROLL - term->scrollhead = term->scrolltail = NULL; -#endif /* OPTIMISE_SCROLL */ term->nbeeps = 0; term->lastbeep = FALSE; term->beep_overloaded = FALSE; @@ -2126,18 +2120,10 @@ static void scroll(Terminal *term, int topline, int botline, int lines, int sb) { termline *line; int i, seltop, scrollwinsize; -#ifdef OPTIMISE_SCROLL - int olddisptop, shift; -#endif /* OPTIMISE_SCROLL */ if (topline != 0 || term->alt_which != 0) sb = FALSE; -#ifdef OPTIMISE_SCROLL - olddisptop = term->disptop; - shift = lines; -#endif /* OPTIMISE_SCROLL */ - scrollwinsize = botline - topline + 1; if (lines < 0) { @@ -2258,81 +2244,8 @@ static void scroll(Terminal *term, int topline, int botline, int lines, int sb) } } } -#ifdef OPTIMISE_SCROLL - shift += term->disptop - olddisptop; - if (shift < term->rows && shift > -term->rows && shift != 0) - scroll_display(term, topline, botline, shift); -#endif /* OPTIMISE_SCROLL */ } -#ifdef OPTIMISE_SCROLL -/* - * Add a scroll of a region on the screen into the pending scroll list. - * `lines' is +ve for scrolling forward, -ve for backward. - * - * If the scroll is on the same area as the last scroll in the list, - * merge them. - */ -static void save_scroll(Terminal *term, int topline, int botline, int lines) -{ - struct scrollregion *newscroll; - if (term->scrolltail && - term->scrolltail->topline == topline && - term->scrolltail->botline == botline) { - term->scrolltail->lines += lines; - } else { - newscroll = snew(struct scrollregion); - newscroll->topline = topline; - newscroll->botline = botline; - newscroll->lines = lines; - newscroll->next = NULL; - - if (!term->scrollhead) - term->scrollhead = newscroll; - else - term->scrolltail->next = newscroll; - term->scrolltail = newscroll; - } -} - -/* - * Scroll the physical display, and our conception of it in disptext. - */ -static void scroll_display(Terminal *term, int topline, int botline, int lines) -{ - int distance, nlines, i, j; - - distance = lines > 0 ? lines : -lines; - nlines = botline - topline + 1 - distance; - if (lines > 0) { - for (i = 0; i < nlines; i++) - for (j = 0; j < term->cols; j++) - copy_termchar(term->disptext[i], j, - term->disptext[i+distance]->chars+j); - if (term->dispcursy >= 0 && - term->dispcursy >= topline + distance && - term->dispcursy < topline + distance + nlines) - term->dispcursy -= distance; - for (i = 0; i < distance; i++) - for (j = 0; j < term->cols; j++) - term->disptext[nlines+i]->chars[j].attr |= ATTR_INVALID; - } else { - for (i = nlines; i-- ;) - for (j = 0; j < term->cols; j++) - copy_termchar(term->disptext[i+distance], j, - term->disptext[i]->chars+j); - if (term->dispcursy >= 0 && - term->dispcursy >= topline && - term->dispcursy < topline + nlines) - term->dispcursy += distance; - for (i = 0; i < distance; i++) - for (j = 0; j < term->cols; j++) - term->disptext[i]->chars[j].attr |= ATTR_INVALID; - } - save_scroll(term, topline, botline, lines); -} -#endif /* OPTIMISE_SCROLL */ - /* * Move the cursor to a given position, clipping at boundaries. We * may or may not want to clip at the scroll margin: marg_clip is 0 @@ -5109,19 +5022,15 @@ static termchar *term_bidi_line(Terminal *term, struct termline *ldata, } /* - * Given a context, update the window. Out of paranoia, we don't - * allow WM_PAINT responses to do scrolling optimisations. + * Given a context, update the window. */ -static void do_paint(Terminal *term, Context ctx, int may_optimise) +static void do_paint(Terminal *term, Context ctx) { int i, j, our_curs_y, our_curs_x; int rv, cursor; pos scrpos; wchar_t *ch; int chlen; -#ifdef OPTIMISE_SCROLL - struct scrollregion *sr; -#endif /* OPTIMISE_SCROLL */ termchar *newline; chlen = 1024; @@ -5201,18 +5110,6 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise) } term->dispcursx = term->dispcursy = -1; -#ifdef OPTIMISE_SCROLL - /* Do scrolls */ - sr = term->scrollhead; - while (sr) { - struct scrollregion *next = sr->next; - do_scroll(ctx, sr->topline, sr->botline, sr->lines); - sfree(sr); - sr = next; - } - term->scrollhead = term->scrolltail = NULL; -#endif /* OPTIMISE_SCROLL */ - /* The normal screen data */ for (i = 0; i < term->rows; i++) { termline *ldata; @@ -5574,7 +5471,7 @@ void term_paint(Terminal *term, Context ctx, } if (immediately) { - do_paint (term, ctx, FALSE); + do_paint (term, ctx); } else { term_schedule_update(term); } @@ -5590,10 +5487,6 @@ void term_paint(Terminal *term, Context ctx, void term_scroll(Terminal *term, int rel, int where) { int sbtop = -sblines(term); -#ifdef OPTIMISE_SCROLL - int olddisptop = term->disptop; - int shift; -#endif /* OPTIMISE_SCROLL */ term->disptop = (rel < 0 ? 0 : rel > 0 ? sbtop : term->disptop) + where; if (term->disptop < sbtop) @@ -5601,11 +5494,6 @@ void term_scroll(Terminal *term, int rel, int where) if (term->disptop > 0) term->disptop = 0; update_sbar(term); -#ifdef OPTIMISE_SCROLL - shift = (term->disptop - olddisptop); - if (shift < term->rows && shift > -term->rows) - scroll_display(term, 0, term->rows - 1, shift); -#endif /* OPTIMISE_SCROLL */ term_update(term); } diff --git a/terminal.h b/terminal.h index be3c589f..5129149c 100644 --- a/terminal.h +++ b/terminal.h @@ -20,15 +20,6 @@ typedef struct { int y, x; } pos; -#ifdef OPTIMISE_SCROLL -struct scrollregion { - struct scrollregion *next; - int topline; /* Top line of scroll region. */ - int botline; /* Bottom line of scroll region. */ - int lines; /* Number of lines to scroll by - +ve is forwards. */ -}; -#endif /* OPTIMISE_SCROLL */ - typedef struct termchar termchar; typedef struct termline termline; @@ -98,10 +89,6 @@ struct terminal_tag { #define TTYPE termchar #define TSIZE (sizeof(TTYPE)) -#ifdef OPTIMISE_SCROLL - struct scrollregion *scrollhead, *scrolltail; -#endif /* OPTIMISE_SCROLL */ - int default_attr, curr_attr, save_attr; truecolour curr_truecolour, save_truecolour; termchar basic_erase_char, erase_char; diff --git a/windows/window.c b/windows/window.c index d3047b25..613c1fdc 100644 --- a/windows/window.c +++ b/windows/window.c @@ -5514,27 +5514,6 @@ void frontend_request_paste(Frontend *frontend, int clipboard) hwnd, 0, &in_threadid); } -#if 0 -/* - * Move `lines' lines from position `from' to position `to' in the - * window. - */ -void optimised_move(Frontend *frontend, int to, int from, int lines) -{ - RECT r; - int min, max; - - min = (to < from ? to : from); - max = to + from - min; - - r.left = offset_width; - r.right = offset_width + term->cols * font_width; - r.top = offset_height + min * font_height; - r.bottom = offset_height + (max + lines) * font_height; - ScrollWindow(hwnd, 0, (to - from) * font_height, &r, &r); -} -#endif - /* * Print a modal (Really Bad) message box and perform a fatal exit. */