1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 09:12:24 +00:00

Scroll optimisations are now controlled by #ifdef OPTIMISE_SCROLL.

Scroll-bar manipulation now uses scroll optimisation more sensibly.

[originally from svn r69]
This commit is contained in:
Ben Harris 1999-03-02 23:47:23 +00:00
parent 23634d10df
commit f4d6dbcc0e
2 changed files with 17 additions and 2 deletions

View File

@ -3,6 +3,10 @@
#define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY" #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
#ifdef macintosh
#define OPTIMISE_SCROLL
#endif
#ifdef macintosh #ifdef macintosh
#include <MacTypes.h> #include <MacTypes.h>
#include <Palettes.h> #include <Palettes.h>

View File

@ -398,9 +398,12 @@ static void scroll (int topline, int botline, int lines, int sb) {
selend = scroll_top + size + scroll_size; selend = scroll_top + size + scroll_size;
} }
} }
#ifdef OPTIMISE_SCROLL
scroll_display(topline, botline, lines); scroll_display(topline, botline, lines);
#endif
} }
#ifdef OPTIMISE_SCROLL
static void scroll_display(int topline, int botline, int lines) { static void scroll_display(int topline, int botline, int lines) {
unsigned long *start, *end; unsigned long *start, *end;
int distance, size, i; int distance, size, i;
@ -420,6 +423,7 @@ static void scroll_display(int topline, int botline, int lines) {
} }
do_scroll(topline, botline, lines); do_scroll(topline, botline, lines);
} }
#endif /* OPTIMISE_SCROLL */
/* /*
@ -1292,6 +1296,10 @@ void term_paint (Context ctx, int l, int t, int r, int b) {
*/ */
void term_scroll (int rel, int where) { void term_scroll (int rel, int where) {
int n = where * (cols+1); int n = where * (cols+1);
#ifdef OPTIMISE_SCROLL
unsigned long *olddisptop = disptop;
int shift;
#endif /* OPTIMISE_SCROLL */
disptop = (rel < 0 ? scrtop : disptop = (rel < 0 ? scrtop :
rel > 0 ? sbtop : disptop) + n; rel > 0 ? sbtop : disptop) + n;
@ -1300,8 +1308,11 @@ void term_scroll (int rel, int where) {
if (disptop > scrtop) if (disptop > scrtop)
disptop = scrtop; disptop = scrtop;
update_sbar(); update_sbar();
if (rel == 0 && where < rows && where > -rows) #ifdef OPTIMISE_SCROLL
scroll_display(0, rows - 1, where); shift = (disptop - olddisptop) / (cols + 1);
if (shift < rows && shift > -rows)
scroll_display(0, rows - 1, shift);
#endif /* OPTIMISE_SCROLL */
term_update(); term_update();
} }