xterm-13.patch.txt

XFree86 3.1.2Df - xterm patch #13 - 1996/4/23 - T.Dickey
 
This corrects my earlier changes for colors - the inner border of the xterm was
getting painted with the wrong color, since I'd moved the call to set the
background into the logic that tracks SGR information.
 
--------------------------------------------------------------------------------
 charproc.c |    3 ---
 util.c     |   45 +++++++++++++++++++++++++++++++!!!!!!!!!!!!!!
 xterm.h    |    1 +
 3 files changed, 32 insertions, 3 deletions, 14 modifications
--------------------------------------------------------------------------------
Index: charproc.c
*** /build/x11r6/XFree86-960419/xc/programs/xterm/charproc.c    Sun Mar 17 13:33:40 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/charproc.c   Mon Apr 22 20:38:49 1996
***************
*** 745,753 ****
        XSetForeground(screen->display, screen->reverseGC, bg);
        XSetBackground(screen->display, screen->normalboldGC, bg);
        XSetForeground(screen->display, screen->reverseboldGC, bg);
- 
-       /* update the screen's background (for XClearArea) */
-       XSetWindowBackground(screen->display, TextWindow(screen), bg);
  }
  
  static void VTparse()
--- 745,750 ----
Index: util.c
*** /build/x11r6/XFree86-960419/xc/programs/xterm/util.c        Mon Mar 11 13:48:46 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/util.c       Tue Apr 23 06:25:29 1996
***************
*** 509,520 ****
--- 509,522 ----
                cx = CursorX (screen, screen->cur_col);
                cy = CursorY (screen, screen->cur_row);
  
+               useCurBackground(TRUE);
                XFillRectangle(
                    screen->display,
                    TextWindow(screen), 
                    screen->reverseGC,
                    cx, cy,
                    (unsigned) n * FontWidth(screen), (unsigned) FontHeight(screen));
+               useCurBackground(FALSE);
            }
        }
        /* adjust screen->buf */
***************
*** 547,552 ****
--- 549,555 ----
                                     screen->max_col+1 - (screen->cur_col+n),
                                     -n);
        
+               useCurBackground(TRUE);
                XFillRectangle
                    (screen->display, TextWindow(screen),
                     screen->reverseGC,
***************
*** 554,559 ****
--- 557,563 ----
                       + Width(screen) - n*FontWidth(screen),
                     CursorY (screen, screen->cur_row), n * FontWidth(screen),
                     FontHeight(screen));
+               useCurBackground(FALSE);
            }
        }
        /* adjust screen->buf */
***************
*** 578,588 ****
                        FlushScroll(screen);
                if((height = screen->cur_row + top) > screen->max_row)
                        height = screen->max_row;
!               if((height -= top) > 0)
                        XClearArea(screen->display, TextWindow(screen),
                         screen->border + screen->scrollbar, top *
                         FontHeight(screen) + screen->border,
                         Width(screen), height * FontHeight(screen), FALSE);
  
                if(screen->cur_row - screen->topline <= screen->max_row)
                        ClearLeft(screen);
--- 582,595 ----
                        FlushScroll(screen);
                if((height = screen->cur_row + top) > screen->max_row)
                        height = screen->max_row;
!               if((height -= top) > 0) {
!                       useCurBackground(TRUE);
                        XClearArea(screen->display, TextWindow(screen),
                         screen->border + screen->scrollbar, top *
                         FontHeight(screen) + screen->border,
                         Width(screen), height * FontHeight(screen), FALSE);
+                       useCurBackground(FALSE);
+               }
  
                if(screen->cur_row - screen->topline <= screen->max_row)
                        ClearLeft(screen);
***************
*** 603,614 ****
        if((top = screen->cur_row - screen->topline) <= screen->max_row) {
                if(screen->scroll_amt)
                        FlushScroll(screen);
!               if(++top <= screen->max_row)
                        XClearArea(screen->display, TextWindow(screen),
                         screen->border + screen->scrollbar, top *
                         FontHeight(screen) + screen->border,
                         Width(screen), (screen->max_row - top + 1) *
                         FontHeight(screen), FALSE);
        }
        ClearBufRows(screen, screen->cur_row + 1, screen->max_row);
  }
--- 610,624 ----
        if((top = screen->cur_row - screen->topline) <= screen->max_row) {
                if(screen->scroll_amt)
                        FlushScroll(screen);
!               if(++top <= screen->max_row) {
!                       useCurBackground(TRUE);
                        XClearArea(screen->display, TextWindow(screen),
                         screen->border + screen->scrollbar, top *
                         FontHeight(screen) + screen->border,
                         Width(screen), (screen->max_row - top + 1) *
                         FontHeight(screen), FALSE);
+                       useCurBackground(FALSE);
+               }
        }
        ClearBufRows(screen, screen->cur_row + 1, screen->max_row);
  }
***************
*** 631,642 ****
--- 641,654 ----
            if(!AddToRefresh(screen)) {
        if(screen->scroll_amt)
                FlushScroll(screen);
+               useCurBackground(TRUE);
                XFillRectangle(screen->display, TextWindow(screen),
                  screen->reverseGC,
                 CursorX(screen, screen->cur_col),
                 CursorY(screen, screen->cur_row),
                 Width(screen) - screen->cur_col * FontWidth(screen),
                 FontHeight(screen));
+               useCurBackground(FALSE);
            }
        }
        bzero(BUF_CHARS(buf, screen->cur_row) + screen->cur_col, len);
***************
*** 669,680 ****
--- 681,694 ----
            if(!AddToRefresh(screen)) {
                if(screen->scroll_amt)
                        FlushScroll(screen);
+               useCurBackground(TRUE);
                XFillRectangle (screen->display, TextWindow(screen),
                     screen->reverseGC,
                     screen->border + screen->scrollbar,
                      CursorY (screen, screen->cur_row),
                     len * FontWidth(screen),
                     FontHeight(screen));
+               useCurBackground(FALSE);
            }
        }
        
***************
*** 701,711 ****
--- 715,727 ----
            if(!AddToRefresh(screen)) {
                if(screen->scroll_amt)
                        FlushScroll(screen);
+               useCurBackground(TRUE);
                XFillRectangle (screen->display, TextWindow(screen), 
                     screen->reverseGC,
                     screen->border + screen->scrollbar,
                      CursorY (screen, screen->cur_row),
                     Width(screen), FontHeight(screen));
+               useCurBackground(FALSE);
            }
        }
        bzero (SCRN_BUF_CHARS(screen, screen->cur_row), (screen->max_col + 1));
***************
*** 726,741 ****
        if((top = -screen->topline) <= screen->max_row) {
                if(screen->scroll_amt)
                        FlushScroll(screen);
! #if 1 /* FIXME */
!               if(top == 0)
!                       XClearWindow(screen->display, TextWindow(screen));
!               else
! #endif
!                       XClearArea(screen->display, TextWindow(screen),
                         screen->border + screen->scrollbar, 
                         top * FontHeight(screen) + screen->border,     
                         Width(screen), (screen->max_row - top + 1) *
                         FontHeight(screen), FALSE);
        }
        ClearBufRows (screen, 0, screen->max_row);
  }
--- 742,754 ----
        if((top = -screen->topline) <= screen->max_row) {
                if(screen->scroll_amt)
                        FlushScroll(screen);
!               useCurBackground(TRUE);
!               XClearArea(screen->display, TextWindow(screen),
                         screen->border + screen->scrollbar, 
                         top * FontHeight(screen) + screen->border,     
                         Width(screen), (screen->max_row - top + 1) *
                         FontHeight(screen), FALSE);
+               useCurBackground(FALSE);
        }
        ClearBufRows (screen, 0, screen->max_row);
  }
***************
*** 1235,1238 ****
--- 1248,1267 ----
                bg = term->screen.original_fg;
  
        return bg;
+ }
+ 
+ /*
+  * Update the screen's background (for XClearArea)
+  *
+  * If the argument is true, sets the window's background to the value set
+  * in the current SGR background. Otherwise, reset to the window's default
+  * background.
+  */
+ void useCurBackground(Bool flag)
+ {
+       TScreen *screen = &term->screen;
+       int color = flag ? term->cur_background : -1;
+       Pixel   bg = getXtermBackground(term->flags, color);
+ 
+       XSetWindowBackground(screen->display, TextWindow(screen), bg);
  }
Index: xterm.h
*** /build/x11r6/XFree86-960419/xc/programs/xterm/xterm.h       Mon Mar 11 13:48:46 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/xterm.h      Mon Apr 22 20:38:11 1996
***************
*** 190,194 ****
--- 190,195 ----
  extern void recolor_cursor PROTO((Cursor cursor, unsigned long fg, unsigned long bg));
  extern void resetXtermGC PROTO((TScreen *screen, int flags, Bool hilite));
  extern void scrolling_copy_area PROTO((TScreen *screen, int firstline, int nlines, int amount));
+ extern void useCurBackground PROTO((Bool flag));
  
  #endif        /* included_xterm_h */