ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.74 by pcg, Sun May 9 18:19:49 2004 UTC vs.
Revision 1.82 by root, Wed Aug 4 03:33:53 2004 UTC

29#include "rxvt.h" /* NECESSARY */ 29#include "rxvt.h" /* NECESSARY */
30#include "screen.intpro" /* PROTOS for internal routines */ 30#include "screen.intpro" /* PROTOS for internal routines */
31 31
32#include <X11/Xmd.h> /* get the typedef for CARD32 */ 32#include <X11/Xmd.h> /* get the typedef for CARD32 */
33 33
34#include <stdint.h> 34#include <inttypes.h>
35#include <wchar.h> 35#include <wchar.h>
36 36
37#include "salloc.C" // HACK, should be a seperate compile! 37#include "salloc.C" // HACK, should be a seperate compile!
38 38
39inline void fill_text (text_t *start, text_t value, int len) 39inline void fill_text (text_t *start, text_t value, int len)
48 48
49/* ------------------------------------------------------------------------- * 49/* ------------------------------------------------------------------------- *
50 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * 50 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES *
51 * ------------------------------------------------------------------------- */ 51 * ------------------------------------------------------------------------- */
52#define ZERO_SCROLLBACK() \ 52#define ZERO_SCROLLBACK() \
53 if ((Options & Opt_scrollTtyOutput) == Opt_scrollTtyOutput) \ 53 if (Options & Opt_scrollTtyOutput) \
54 TermWin.view_start = 0 54 TermWin.view_start = 0
55#define CLEAR_SELECTION() \ 55#define CLEAR_SELECTION() \
56 selection.beg.row = selection.beg.col \ 56 selection.beg.row = selection.beg.col \
57 = selection.end.row = selection.end.col = 0 57 = selection.end.row = selection.end.col = 0
58#define CLEAR_ALL_SELECTION() \ 58#define CLEAR_ALL_SELECTION() \
59 selection.beg.row = selection.beg.col \ 59 selection.beg.row = selection.beg.col \
60 = selection.mark.row = selection.mark.col \ 60 = selection.mark.row = selection.mark.col \
61 = selection.end.row = selection.end.col = 0 61 = selection.end.row = selection.end.col = 0
62 62
63#define ROW_AND_COL_IS_AFTER(A, B, C, D) \ 63#define ROW_AND_COL_IS_AFTER(A, B, C, D) \
64 (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) 64 (((A) > (C)) || (((A) == (C)) && ((B) > (D))))
65#define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ 65#define ROW_AND_COL_IS_BEFORE(A, B, C, D) \
66 (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) 66 (((A) < (C)) || (((A) == (C)) && ((B) < (D))))
67#define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \ 67#define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \
68 (((A) == (C)) && ((B) > (D))) 68 (((A) == (C)) && ((B) > (D)))
69#define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \ 69#define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \
70 (((A) == (C)) && ((B) >= (D))) 70 (((A) == (C)) && ((B) >= (D)))
71#define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \ 71#define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \
72 (((A) == (C)) && ((B) < (D))) 72 (((A) == (C)) && ((B) < (D)))
73#define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \ 73#define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \
74 (((A) == (C)) && ((B) <= (D))) 74 (((A) == (C)) && ((B) <= (D)))
75 75
76/* these must be row_col_t */ 76/* these must be row_col_t */
77#define ROWCOL_IS_AFTER(X, Y) \ 77#define ROWCOL_IS_AFTER(X, Y) \
78 ROW_AND_COL_IS_AFTER ((X).row, (X).col, (Y).row, (Y).col) 78 ROW_AND_COL_IS_AFTER ((X).row, (X).col, (Y).row, (Y).col)
79#define ROWCOL_IS_BEFORE(X, Y) \ 79#define ROWCOL_IS_BEFORE(X, Y) \
80 ROW_AND_COL_IS_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 80 ROW_AND_COL_IS_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
81#define ROWCOL_IN_ROW_AFTER(X, Y) \ 81#define ROWCOL_IN_ROW_AFTER(X, Y) \
82 ROW_AND_COL_IN_ROW_AFTER ((X).row, (X).col, (Y).row, (Y).col) 82 ROW_AND_COL_IN_ROW_AFTER ((X).row, (X).col, (Y).row, (Y).col)
83#define ROWCOL_IN_ROW_BEFORE(X, Y) \ 83#define ROWCOL_IN_ROW_BEFORE(X, Y) \
84 ROW_AND_COL_IN_ROW_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 84 ROW_AND_COL_IN_ROW_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
85#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ 85#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \
86 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) 86 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col)
87#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ 87#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \
88 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 88 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
89 89
90/* 90/*
91 * CLEAR_ROWS : clear <num> rows starting from row <row> 91 * CLEAR_ROWS : clear <num> rows starting from row <row>
92 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> 92 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
93 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour 93 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
94 */ 94 */
95#define drawBuffer TermWin.vt 95#define drawBuffer TermWin.vt
96 96
97#define CLEAR_ROWS(row, num) \ 97#define CLEAR_ROWS(row, num) \
98 if (TermWin.mapped) \ 98 if (TermWin.mapped) \
99 XClearArea (display->display, drawBuffer, TermWin.int_bwidth, \ 99 XClearArea (display->display, drawBuffer, 0, \
100 Row2Pixel (row), (unsigned int)TermWin.width, \ 100 Row2Pixel (row), (unsigned int)TermWin.width, \
101 (unsigned int)Height2Pixel (num), False) 101 (unsigned int)Height2Pixel (num), False)
102 102
103#define CLEAR_CHARS(x, y, num) \ 103#define CLEAR_CHARS(x, y, num) \
104 if (TermWin.mapped) \ 104 if (TermWin.mapped) \
105 XClearArea (display->display, drawBuffer, x, y, \ 105 XClearArea (display->display, drawBuffer, x, y, \
106 (unsigned int)Width2Pixel (num), \ 106 (unsigned int)Width2Pixel (num), \
107 (unsigned int)Height2Pixel (1), False) 107 (unsigned int)Height2Pixel (1), False)
108 108
109#define ERASE_ROWS(row, num) \ 109#define ERASE_ROWS(row, num) \
110 XFillRectangle (display->display, drawBuffer, TermWin.gc, \ 110 XFillRectangle (display->display, drawBuffer, TermWin.gc, \
111 TermWin.int_bwidth, Row2Pixel (row), \ 111 0, Row2Pixel (row), \
112 (unsigned int)TermWin.width, \ 112 (unsigned int)TermWin.width, \
113 (unsigned int)Height2Pixel (num)) 113 (unsigned int)Height2Pixel (num))
114 114
115/* ------------------------------------------------------------------------- * 115/* ------------------------------------------------------------------------- *
116 * SCREEN `COMMON' ROUTINES * 116 * SCREEN `COMMON' ROUTINES *
117 * ------------------------------------------------------------------------- */ 117 * ------------------------------------------------------------------------- */
118/* Fill part/all of a line with blanks. */ 118/* Fill part/all of a line with blanks. */
119void 119void
120rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) 120rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs)
121{ 121{
122 efs &= ~RS_baseattrMask; 122 efs &= ~RS_baseattrMask;
123 efs = SET_FONT (efs, TermWin.fontset->find_font (' ')); 123 efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]);
124 124
125 while (width--) 125 while (width--)
126 { 126 {
127 *et++ = ' '; 127 *et++ = ' ';
128 *er++ = efs; 128 *er++ = efs;
794 } 794 }
795 } 795 }
796#ifdef DEBUG_STRICT 796#ifdef DEBUG_STRICT
797 assert (screen.cur.col < last_col); 797 assert (screen.cur.col < last_col);
798 assert ((screen.cur.row < TermWin.nrow) 798 assert ((screen.cur.row < TermWin.nrow)
799 && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); 799 && (screen.cur.row >= - (int32_t)TermWin.nscrolled));
800#else /* drive with your eyes closed */ 800#else /* drive with your eyes closed */
801 MIN_IT (screen.cur.col, last_col - 1); 801 MIN_IT (screen.cur.col, last_col - 1);
802 MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); 802 MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1);
803 MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); 803 MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled);
804#endif 804#endif
897#if !UNICODE_3 && ENABLE_COMBINING 897#if !UNICODE_3 && ENABLE_COMBINING
898 // trim characters we can't store directly :( 898 // trim characters we can't store directly :(
899 if (c >= 0x10000) 899 if (c >= 0x10000)
900 c = rxvt_composite.compose (c); // map to lower 16 bits 900 c = rxvt_composite.compose (c); // map to lower 16 bits
901#endif 901#endif
902 rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c)); 902 bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0);
903 rend_t rend = SET_FONT (rstyle,
904 c > 0x7f || bold || c < 0x20
905 ? TermWin.fontset->find_font (c, bold)
906 : TermWin.ascii_map [c - 0x20]);
903 907
904 do 908 do
905 { 909 {
906 stp[screen.cur.col] = c; 910 stp[screen.cur.col] = c;
907 srp[screen.cur.col] = rend; 911 srp[screen.cur.col] = rend;
1746 row_col_t rc[RC_COUNT]; 1750 row_col_t rc[RC_COUNT];
1747 1751
1748 if (drawn_text == NULL) /* sanity check */ 1752 if (drawn_text == NULL) /* sanity check */
1749 return; 1753 return;
1750 1754
1755#ifndef NO_SLOW_LINK_SUPPORT
1756 if (refresh_type == FAST_REFRESH && !display->is_local)
1757 {
1758 y = 0;
1759 height = TermWin.height;
1760 }
1761#endif
1762
1751#ifdef DEBUG_STRICT 1763#ifdef DEBUG_STRICT
1752 x = max (x, (int)TermWin.int_bwidth); 1764 x = max (x, 0);
1753 x = min (x, (int)TermWin.width); 1765 x = min (x, (int)TermWin.width);
1754 y = max (y, (int)TermWin.int_bwidth); 1766 y = max (y, 0);
1755 y = min (y, (int)TermWin.height); 1767 y = min (y, (int)TermWin.height);
1756#endif 1768#endif
1757 1769
1758 /* round down */ 1770 /* round down */
1759 rc[PART_BEG].col = Pixel2Col (x); 1771 rc[PART_BEG].col = Pixel2Col (x);
2054 /* 2066 /*
2055 * D: CopyArea pass - very useful for slower links 2067 * D: CopyArea pass - very useful for slower links
2056 * This has been deliberately kept simple. 2068 * This has been deliberately kept simple.
2057 */ 2069 */
2058 i = num_scr; 2070 i = num_scr;
2071 if (!display->is_local
2059 if (refresh_type == FAST_REFRESH && num_scr_allow && i 2072 && refresh_type == FAST_REFRESH && num_scr_allow && i
2060 && abs (i) < TermWin.nrow && !must_clear) 2073 && abs (i) < TermWin.nrow && !must_clear)
2061 { 2074 {
2062 int16_t nits; 2075 int16_t nits;
2063 int j; 2076 int j;
2064 rend_t *drp2; 2077 rend_t *drp2;
2206 rend = GET_ATTR (rend); 2219 rend = GET_ATTR (rend);
2207 2220
2208 rvid = !!(rend & RS_RVid); 2221 rvid = !!(rend & RS_RVid);
2209 2222
2210#ifndef NO_BOLD_UNDERLINE_REVERSE 2223#ifndef NO_BOLD_UNDERLINE_REVERSE
2211 if (rend & RS_Bold && fore == Color_fg) 2224 if (rend & RS_Bold && fore == Color_fg && !(Options & Opt_realBold))
2212 { 2225 {
2213 if (ISSET_PIXCOLOR (Color_BD)) 2226 if (ISSET_PIXCOLOR (Color_BD))
2214 fore = Color_BD; 2227 fore = Color_BD;
2215 else 2228 else
2216 rvid = !rvid; 2229 rvid = !rvid;
2234 back = Color_RV; 2247 back = Color_RV;
2235#endif 2248#endif
2236 } 2249 }
2237 2250
2238#ifdef TEXT_BLINK 2251#ifdef TEXT_BLINK
2239 if (rend & RS_Blink && back == Color_bg) 2252 if (rend & RS_Blink && (back == Color_bg || fore == Color_bg))
2240 { 2253 {
2241 if (!text_blink_ev.active) 2254 if (!text_blink_ev.active)
2242 { 2255 {
2243 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 2256 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
2244 hidden_text = 0; 2257 hidden_text = 0;
2274 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); 2287 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg);
2275 } 2288 }
2276 else 2289 else
2277 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); 2290 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back);
2278 2291
2279 if ((rend & RS_Uline) && (font->descent > 1)) 2292 if (rend & RS_Uline && font->descent > 1 && fore != back)
2280 XDrawLine (display->display, drawBuffer, TermWin.gc, 2293 XDrawLine (display->display, drawBuffer, TermWin.gc,
2281 xpixel, ypixel + font->ascent + 1, 2294 xpixel, ypixel + font->ascent + 1,
2282 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2295 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2283 } /* for (col....) */ 2296 } /* for (col....) */
2284 } /* for (row....) */ 2297 } /* for (row....) */
2322 scr_reverse_selection (); 2335 scr_reverse_selection ();
2323 2336
2324 /* 2337 /*
2325 * I: other general cleanup 2338 * I: other general cleanup
2326 */ 2339 */
2340#if 0
2327 if (clearfirst && TermWin.int_bwidth) 2341 if (clearfirst && TermWin.int_bwidth)
2328 /* 2342 /*
2329 * clear the whole screen height, note that width == 0 is treated 2343 * clear the whole screen height, note that width == 0 is treated
2330 * specially by XClearArea 2344 * specially by XClearArea
2331 */ 2345 */
2340 */ 2354 */
2341 XClearArea (display->display, TermWin.vt, 2355 XClearArea (display->display, TermWin.vt,
2342 TermWin.width + TermWin.int_bwidth, 0, 2356 TermWin.width + TermWin.int_bwidth, 0,
2343 (unsigned int)TermWin.int_bwidth, 2357 (unsigned int)TermWin.int_bwidth,
2344 (unsigned int)TermWin_TotalHeight (), False); 2358 (unsigned int)TermWin_TotalHeight (), False);
2359#endif
2345 2360
2346 if (refresh_type & SMOOTH_REFRESH) 2361 if (refresh_type & SMOOTH_REFRESH)
2347 XSync (display->display, False); 2362 XFlush (display->display);
2348 2363
2349 num_scr = 0; 2364 num_scr = 0;
2350 num_scr_allow = 1; 2365 num_scr_allow = 1;
2351 want_refresh = 0; /* screen is current */ 2366 want_refresh = 0; /* screen is current */
2352} 2367}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines