]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Scroll optimisations are now controlled by #ifdef OPTIMISE_SCROLL.
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 2 Mar 1999 23:47:23 +0000 (23:47 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 2 Mar 1999 23:47:23 +0000 (23:47 +0000)
Scroll-bar manipulation now uses scroll optimisation more sensibly.

[originally from svn r69]

putty.h
terminal.c

diff --git a/putty.h b/putty.h
index 9f960ad166947e3e02c26375a609672e28bc0f77..2a7a8e3a17545abfd288a72547628adecd5daecd 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -3,6 +3,10 @@
 
 #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
 
+#ifdef macintosh
+#define OPTIMISE_SCROLL
+#endif
+
 #ifdef macintosh
 #include <MacTypes.h>
 #include <Palettes.h>
index e44b7b2c87f4b4529658726064c19a483053657b..939705e143da7d877d21b96aee1e86d9eb09d6fe 100644 (file)
@@ -398,9 +398,12 @@ static void scroll (int topline, int botline, int lines, int sb) {
                selend = scroll_top + size + scroll_size;
        }
     }
+#ifdef OPTIMISE_SCROLL
     scroll_display(topline, botline, lines);
+#endif
 }
 
+#ifdef OPTIMISE_SCROLL
 static void scroll_display(int topline, int botline, int lines) {
     unsigned long *start, *end;
     int distance, size, i;
@@ -420,6 +423,7 @@ static void scroll_display(int topline, int botline, int 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) {
     int n = where * (cols+1);
+#ifdef OPTIMISE_SCROLL
+    unsigned long *olddisptop = disptop;
+    int shift;
+#endif /* OPTIMISE_SCROLL */
 
     disptop = (rel < 0 ? scrtop :
               rel > 0 ? sbtop : disptop) + n;
@@ -1300,8 +1308,11 @@ void term_scroll (int rel, int where) {
     if (disptop > scrtop)
        disptop = scrtop;
     update_sbar();
-    if (rel == 0 && where < rows && where > -rows)
-       scroll_display(0, rows - 1, where);
+#ifdef OPTIMISE_SCROLL
+    shift = (disptop - olddisptop) / (cols + 1);
+    if (shift < rows && shift > -rows)
+       scroll_display(0, rows - 1, shift);
+#endif /* OPTIMISE_SCROLL */
     term_update();
 }