… | |
… | |
485 | prev_nrow = prev_ncol = 0; |
485 | prev_nrow = prev_ncol = 0; |
486 | scr_reset (); |
486 | scr_reset (); |
487 | |
487 | |
488 | scr_clear (); |
488 | scr_clear (); |
489 | scr_refresh (SLOW_REFRESH); |
489 | scr_refresh (SLOW_REFRESH); |
490 | #ifdef RXVT_GRAPHICS |
|
|
491 | Gr_reset (); |
|
|
492 | #endif |
|
|
493 | } |
490 | } |
494 | |
491 | |
495 | /* ------------------------------------------------------------------------- * |
492 | /* ------------------------------------------------------------------------- * |
496 | * PROCESS SCREEN COMMANDS * |
493 | * PROCESS SCREEN COMMANDS * |
497 | * ------------------------------------------------------------------------- */ |
494 | * ------------------------------------------------------------------------- */ |
… | |
… | |
593 | # endif |
590 | # endif |
594 | SWAP_IT (screen.charset, swap.charset, int16_t); |
591 | SWAP_IT (screen.charset, swap.charset, int16_t); |
595 | SWAP_IT (screen.flags, swap.flags, int); |
592 | SWAP_IT (screen.flags, swap.flags, int); |
596 | screen.flags |= Screen_VisibleCursor; |
593 | screen.flags |= Screen_VisibleCursor; |
597 | swap.flags |= Screen_VisibleCursor; |
594 | swap.flags |= Screen_VisibleCursor; |
598 | |
|
|
599 | # ifdef RXVT_GRAPHICS |
|
|
600 | |
|
|
601 | if (Gr_Displayed ()) |
|
|
602 | { |
|
|
603 | Gr_scroll (0); |
|
|
604 | Gr_ChangeScreen (); |
|
|
605 | } |
|
|
606 | # endif |
|
|
607 | #else |
595 | #else |
608 | # ifdef SCROLL_ON_NO_SECONDARY |
596 | # ifdef SCROLL_ON_NO_SECONDARY |
609 | # ifdef RXVT_GRAPHICS |
|
|
610 | if (Gr_Displayed ()) |
|
|
611 | Gr_ClearScreen (); |
|
|
612 | # endif |
|
|
613 | if (current_screen == PRIMARY |
597 | if (current_screen == PRIMARY) |
614 | # ifdef RXVT_GRAPHICS |
|
|
615 | && !Gr_Displayed () |
|
|
616 | # endif |
|
|
617 | ) |
|
|
618 | scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); |
598 | scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); |
619 | # endif |
599 | # endif |
620 | #endif |
600 | #endif |
621 | return scrn; |
601 | return scrn; |
622 | } |
602 | } |
… | |
… | |
771 | |
751 | |
772 | if (!spec) /* line length may not equal TermWin.ncol */ |
752 | if (!spec) /* line length may not equal TermWin.ncol */ |
773 | scr_blank_screen_mem (screen.text, screen.rend, |
753 | scr_blank_screen_mem (screen.text, screen.rend, |
774 | (unsigned int)j, rstyle); |
754 | (unsigned int)j, rstyle); |
775 | } |
755 | } |
776 | |
|
|
777 | #ifdef RXVT_GRAPHICS |
|
|
778 | if (Gr_Displayed ()) |
|
|
779 | Gr_scroll (count); |
|
|
780 | #endif |
|
|
781 | |
756 | |
782 | return count; |
757 | return count; |
783 | } |
758 | } |
784 | |
759 | |
785 | /* ------------------------------------------------------------------------- */ |
760 | /* ------------------------------------------------------------------------- */ |
… | |
… | |
1075 | void |
1050 | void |
1076 | rxvt_term::scr_gotorc (int row, int col, int relative) |
1051 | rxvt_term::scr_gotorc (int row, int col, int relative) |
1077 | { |
1052 | { |
1078 | want_refresh = 1; |
1053 | want_refresh = 1; |
1079 | ZERO_SCROLLBACK (); |
1054 | ZERO_SCROLLBACK (); |
1080 | #ifdef RXVT_GRAPHICS |
|
|
1081 | if (Gr_Displayed ()) |
|
|
1082 | Gr_scroll (0); |
|
|
1083 | #endif |
|
|
1084 | |
1055 | |
1085 | D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); |
1056 | D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); |
1086 | |
1057 | |
1087 | screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) |
1058 | screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) |
1088 | : col); |
1059 | : col); |
… | |
… | |
1135 | want_refresh = 1; |
1106 | want_refresh = 1; |
1136 | dirn = ((direction == UP) ? 1 : -1); |
1107 | dirn = ((direction == UP) ? 1 : -1); |
1137 | D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); |
1108 | D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); |
1138 | |
1109 | |
1139 | ZERO_SCROLLBACK (); |
1110 | ZERO_SCROLLBACK (); |
1140 | |
|
|
1141 | #ifdef RXVT_GRAPHICS |
|
|
1142 | if (Gr_Displayed ()) |
|
|
1143 | Gr_scroll (0); |
|
|
1144 | #endif |
|
|
1145 | |
1111 | |
1146 | screen.flags &= ~Screen_WrapNext; |
1112 | screen.flags &= ~Screen_WrapNext; |
1147 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1113 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1148 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1114 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1149 | scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0); |
1115 | scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0); |
… | |
… | |
1167 | unsigned int row, col, num; |
1133 | unsigned int row, col, num; |
1168 | |
1134 | |
1169 | want_refresh = 1; |
1135 | want_refresh = 1; |
1170 | D_SCREEN ((stderr, "rxvt_scr_erase_line (%d) at screen row: %d", mode, screen.cur.row)); |
1136 | D_SCREEN ((stderr, "rxvt_scr_erase_line (%d) at screen row: %d", mode, screen.cur.row)); |
1171 | ZERO_SCROLLBACK (); |
1137 | ZERO_SCROLLBACK (); |
1172 | |
|
|
1173 | #ifdef RXVT_GRAPHICS |
|
|
1174 | if (Gr_Displayed ()) |
|
|
1175 | Gr_scroll (0); |
|
|
1176 | #endif |
|
|
1177 | |
1138 | |
1178 | selection_check (1); |
1139 | selection_check (1); |
1179 | |
1140 | |
1180 | screen.flags &= ~Screen_WrapNext; |
1141 | screen.flags &= ~Screen_WrapNext; |
1181 | |
1142 | |
… | |
… | |
1250 | row = 0; |
1211 | row = 0; |
1251 | num = screen.cur.row; |
1212 | num = screen.cur.row; |
1252 | break; |
1213 | break; |
1253 | case 2: /* erase whole screen */ |
1214 | case 2: /* erase whole screen */ |
1254 | selection_check (3); |
1215 | selection_check (3); |
1255 | #ifdef RXVT_GRAPHICS |
|
|
1256 | Gr_ClearScreen (); |
|
|
1257 | #endif |
|
|
1258 | row = 0; |
1216 | row = 0; |
1259 | num = TermWin.nrow; |
1217 | num = TermWin.nrow; |
1260 | break; |
1218 | break; |
1261 | default: |
1219 | default: |
1262 | return; |
1220 | return; |
… | |
… | |
1331 | { |
1289 | { |
1332 | int end; |
1290 | int end; |
1333 | |
1291 | |
1334 | ZERO_SCROLLBACK (); |
1292 | ZERO_SCROLLBACK (); |
1335 | |
1293 | |
1336 | #ifdef RXVT_GRAPHICS |
|
|
1337 | if (Gr_Displayed ()) |
|
|
1338 | Gr_scroll (0); |
|
|
1339 | #endif |
|
|
1340 | |
|
|
1341 | selection_check (1); |
1294 | selection_check (1); |
1342 | |
1295 | |
1343 | if (screen.cur.row > screen.bscroll) |
1296 | if (screen.cur.row > screen.bscroll) |
1344 | return; |
1297 | return; |
1345 | |
1298 | |
… | |
… | |
1369 | rend_t *srp; |
1322 | rend_t *srp; |
1370 | int16_t *slp; |
1323 | int16_t *slp; |
1371 | |
1324 | |
1372 | want_refresh = 1; |
1325 | want_refresh = 1; |
1373 | ZERO_SCROLLBACK (); |
1326 | ZERO_SCROLLBACK (); |
1374 | |
|
|
1375 | #ifdef RXVT_GRAPHICS |
|
|
1376 | if (Gr_Displayed ()) |
|
|
1377 | Gr_scroll (0); |
|
|
1378 | #endif |
|
|
1379 | |
1327 | |
1380 | if (count <= 0) |
1328 | if (count <= 0) |
1381 | return; |
1329 | return; |
1382 | |
1330 | |
1383 | selection_check (1); |
1331 | selection_check (1); |
… | |
… | |
1808 | rxvt_term::scr_changeview (uint16_t oldviewstart) |
1756 | rxvt_term::scr_changeview (uint16_t oldviewstart) |
1809 | { |
1757 | { |
1810 | if (TermWin.view_start != oldviewstart) |
1758 | if (TermWin.view_start != oldviewstart) |
1811 | { |
1759 | { |
1812 | want_refresh = 1; |
1760 | want_refresh = 1; |
1813 | #ifdef RXVT_GRAPHICS |
|
|
1814 | if (Gr_Displayed ()) |
|
|
1815 | Gr_scroll (0); |
|
|
1816 | #endif |
|
|
1817 | num_scr -= (TermWin.view_start - oldviewstart); |
1761 | num_scr -= (TermWin.view_start - oldviewstart); |
1818 | } |
1762 | } |
1819 | return (int) (TermWin.view_start - oldviewstart); |
1763 | return (int) (TermWin.view_start - oldviewstart); |
1820 | } |
1764 | } |
1821 | |
1765 | |
… | |
… | |
1891 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1835 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1892 | |
1836 | |
1893 | void |
1837 | void |
1894 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1838 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1895 | { |
1839 | { |
1896 | unsigned char clearfirst, /* first character writes before cell */ |
1840 | unsigned char clearfirst, /* first character writes before cell */ |
1897 | clearlast, /* last character writes beyond cell */ |
1841 | clearlast, /* last character writes beyond cell */ |
1898 | must_clear, /* use draw_string not draw_image_string */ |
1842 | must_clear, /* use draw_string not draw_image_string */ |
1899 | rvid, /* reverse video this position */ |
1843 | rvid, /* reverse video this position */ |
1900 | showcursor; /* show the cursor */ |
1844 | showcursor; /* show the cursor */ |
1901 | int16_t col, row, /* column/row we're processing */ |
1845 | int16_t col, row, /* column/row we're processing */ |
1902 | ocrow; /* old cursor row */ |
1846 | ocrow; /* old cursor row */ |
1903 | int cursorwidth; |
|
|
1904 | int i, /* tmp */ |
1847 | int i, /* tmp */ |
1905 | row_offset; /* basic offset in screen structure */ |
1848 | row_offset; /* basic offset in screen structure */ |
1906 | #ifndef NO_CURSORCOLOR |
1849 | #ifndef NO_CURSORCOLOR |
1907 | rend_t cc1; /* store colours at cursor position (s) */ |
1850 | rend_t cc1; /* store colours at cursor position (s) */ |
1908 | #endif |
1851 | #endif |
1909 | rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ |
1852 | rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ |
1910 | text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ |
1853 | text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ |
1911 | |
1854 | |
1912 | if (refresh_type == NO_REFRESH || !TermWin.mapped) |
1855 | if (refresh_type == NO_REFRESH || !TermWin.mapped) |
1913 | return; |
1856 | return; |
1914 | |
1857 | |
1915 | /* |
1858 | /* |
… | |
… | |
1947 | unsigned char setoldcursor; |
1890 | unsigned char setoldcursor; |
1948 | rend_t ccol1, /* Cursor colour */ |
1891 | rend_t ccol1, /* Cursor colour */ |
1949 | ccol2; /* Cursor colour2 */ |
1892 | ccol2; /* Cursor colour2 */ |
1950 | |
1893 | |
1951 | showcursor = (screen.flags & Screen_VisibleCursor); |
1894 | showcursor = (screen.flags & Screen_VisibleCursor); |
1952 | cursorwidth = 0; |
|
|
1953 | #ifdef CURSOR_BLINK |
1895 | #ifdef CURSOR_BLINK |
1954 | if (hidden_cursor) |
1896 | if (hidden_cursor) |
1955 | showcursor = 0; |
1897 | showcursor = 0; |
1956 | #endif |
1898 | #endif |
1957 | |
1899 | |
1958 | cursorwidth = 0; |
|
|
1959 | |
|
|
1960 | if (showcursor) |
1900 | if (showcursor) |
1961 | { |
1901 | { |
1962 | cursorwidth++; |
|
|
1963 | |
|
|
1964 | srp = & (screen.rend[screen.cur.row + TermWin.saveLines] |
1902 | srp = & (screen.rend[screen.cur.row + TermWin.saveLines] |
1965 | [screen.cur.col]); |
1903 | [screen.cur.col]); |
1966 | |
1904 | |
1967 | if (showcursor && TermWin.focus) |
1905 | if (showcursor && TermWin.focus) |
1968 | { |
1906 | { |
… | |
… | |
1986 | ccol2 = Color_bg; |
1924 | ccol2 = Color_bg; |
1987 | #endif |
1925 | #endif |
1988 | *srp = SET_FGCOLOR (*srp, ccol1); |
1926 | *srp = SET_FGCOLOR (*srp, ccol1); |
1989 | *srp = SET_BGCOLOR (*srp, ccol2); |
1927 | *srp = SET_BGCOLOR (*srp, ccol2); |
1990 | #endif |
1928 | #endif |
1991 | |
|
|
1992 | } |
1929 | } |
1993 | } |
1930 | } |
1994 | |
1931 | |
1995 | /* make sure no outline cursor is left around */ |
1932 | /* make sure no outline cursor is left around */ |
1996 | setoldcursor = 0; |
1933 | setoldcursor = 0; |
… | |
… | |
2225 | * Actually do the drawing of the string here |
2162 | * Actually do the drawing of the string here |
2226 | */ |
2163 | */ |
2227 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2164 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2228 | |
2165 | |
2229 | if (back == fore) |
2166 | if (back == fore) |
2230 | font->clear_rect (xpixel, ypixel, |
2167 | font->clear_rect (*TermWin.drawable, xpixel, ypixel, |
2231 | TermWin.fwidth * count, TermWin.fheight, |
2168 | TermWin.fwidth * count, TermWin.fheight, |
2232 | back); |
2169 | back); |
2233 | else if (back == Color_bg) |
2170 | else if (back == Color_bg) |
2234 | { |
2171 | { |
2235 | if (must_clear) |
2172 | if (must_clear) |
… | |
… | |
2237 | CLEAR_CHARS (xpixel, ypixel, count); |
2174 | CLEAR_CHARS (xpixel, ypixel, count); |
2238 | |
2175 | |
2239 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2176 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2240 | if (text[i] != ' ') |
2177 | if (text[i] != ' ') |
2241 | { |
2178 | { |
2242 | font->draw (xpixel, ypixel, text, count, fore, -1); |
2179 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, -1); |
2243 | break; |
2180 | break; |
2244 | } |
2181 | } |
2245 | } |
2182 | } |
2246 | else |
2183 | else |
2247 | font->draw (xpixel, ypixel, text, count, fore, Color_bg); |
2184 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2248 | } |
2185 | } |
2249 | else |
2186 | else |
2250 | font->draw (xpixel, ypixel, text, count, fore, back); |
2187 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2251 | |
2188 | |
2252 | if ((rend & RS_Uline) && (font->descent > 1)) |
2189 | if ((rend & RS_Uline) && (font->descent > 1)) |
2253 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2190 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2254 | xpixel, ypixel + font->ascent + 1, |
2191 | xpixel, ypixel + font->ascent + 1, |
2255 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2192 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
… | |
… | |
2267 | [screen.cur.col]); |
2204 | [screen.cur.col]); |
2268 | *srp ^= RS_RVid; |
2205 | *srp ^= RS_RVid; |
2269 | #ifndef NO_CURSORCOLOR |
2206 | #ifndef NO_CURSORCOLOR |
2270 | *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2207 | *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2271 | #endif |
2208 | #endif |
2272 | |
|
|
2273 | } |
2209 | } |
2274 | else if (oldcursor.row >= 0) |
2210 | else if (oldcursor.row >= 0) |
2275 | { |
2211 | { |
2276 | #ifndef NO_CURSORCOLOR |
2212 | #ifndef NO_CURSORCOLOR |
2277 | if (ISSET_PIXCOLOR (Color_cursor)) |
2213 | if (ISSET_PIXCOLOR (Color_cursor)) |
2278 | XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); |
2214 | XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); |
2279 | #endif |
2215 | #endif |
|
|
2216 | int cursorwidth = 1; |
|
|
2217 | while (oldcursor.col + cursorwidth < TermWin.ncol |
|
|
2218 | && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR) |
|
|
2219 | cursorwidth++; |
|
|
2220 | |
2280 | XDrawRectangle (display->display, drawBuffer, TermWin.gc, |
2221 | XDrawRectangle (display->display, drawBuffer, TermWin.gc, |
2281 | Col2Pixel (oldcursor.col), |
2222 | Col2Pixel (oldcursor.col), |
2282 | Row2Pixel (oldcursor.row), |
2223 | Row2Pixel (oldcursor.row), |
2283 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2224 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2284 | (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); |
2225 | (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); |
… | |
… | |
2316 | num_scr = 0; |
2257 | num_scr = 0; |
2317 | num_scr_allow = 1; |
2258 | num_scr_allow = 1; |
2318 | want_refresh = 0; /* screen is current */ |
2259 | want_refresh = 0; /* screen is current */ |
2319 | } |
2260 | } |
2320 | |
2261 | |
|
|
2262 | void |
|
|
2263 | rxvt_term::scr_remap_chars (text_t *tp, rend_t *rp) |
|
|
2264 | { |
|
|
2265 | if (!rp || !tp) |
|
|
2266 | return; |
|
|
2267 | |
|
|
2268 | for (int i = TermWin.ncol; i; i--, rp++, tp++) |
|
|
2269 | *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp)); |
|
|
2270 | } |
|
|
2271 | |
|
|
2272 | void |
|
|
2273 | rxvt_term::scr_remap_chars () |
|
|
2274 | { |
|
|
2275 | for (int i = TermWin.nrow + TermWin.saveLines; i--; ) |
|
|
2276 | scr_remap_chars (screen.text[i], screen.rend[i]); |
|
|
2277 | |
|
|
2278 | for (int i = TermWin.nrow; i--; ) |
|
|
2279 | { |
|
|
2280 | scr_remap_chars (drawn_text[i], drawn_rend[i]); |
|
|
2281 | scr_remap_chars (swap.text[i], swap.rend[i]); |
|
|
2282 | } |
|
|
2283 | } |
|
|
2284 | |
2321 | /* ------------------------------------------------------------------------- */ |
2285 | /* ------------------------------------------------------------------------- */ |
2322 | void |
2286 | void |
2323 | rxvt_term::scr_clear () |
2287 | rxvt_term::scr_clear () |
2324 | { |
2288 | { |
2325 | if (!TermWin.mapped) |
2289 | if (!TermWin.mapped) |
… | |
… | |
2723 | rxvt_term::selection_clear () |
2687 | rxvt_term::selection_clear () |
2724 | { |
2688 | { |
2725 | D_SELECT ((stderr, "rxvt_selection_clear ()")); |
2689 | D_SELECT ((stderr, "rxvt_selection_clear ()")); |
2726 | |
2690 | |
2727 | want_refresh = 1; |
2691 | want_refresh = 1; |
2728 | if (selection.text) |
|
|
2729 | free (selection.text); |
2692 | free (selection.text); |
2730 | selection.text = NULL; |
2693 | selection.text = NULL; |
2731 | selection.len = 0; |
2694 | selection.len = 0; |
2732 | CLEAR_SELECTION (); |
2695 | CLEAR_SELECTION (); |
2733 | } |
2696 | } |
2734 | |
2697 | |