--- rxvt-unicode/src/screen.C 2004/02/13 12:16:21 1.30 +++ rxvt-unicode/src/screen.C 2004/02/24 22:28:42 1.36 @@ -487,9 +487,6 @@ scr_clear (); scr_refresh (SLOW_REFRESH); -#ifdef RXVT_GRAPHICS - Gr_reset (); -#endif } /* ------------------------------------------------------------------------- * @@ -595,26 +592,9 @@ SWAP_IT (screen.flags, swap.flags, int); screen.flags |= Screen_VisibleCursor; swap.flags |= Screen_VisibleCursor; - -# ifdef RXVT_GRAPHICS - - if (Gr_Displayed ()) - { - Gr_scroll (0); - Gr_ChangeScreen (); - } -# endif #else # ifdef SCROLL_ON_NO_SECONDARY -# ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_ClearScreen (); -# endif - if (current_screen == PRIMARY -# ifdef RXVT_GRAPHICS - && !Gr_Displayed () -# endif - ) + if (current_screen == PRIMARY) scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); # endif #endif @@ -774,11 +754,6 @@ (unsigned int)j, rstyle); } -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (count); -#endif - return count; } @@ -1077,10 +1052,6 @@ { want_refresh = 1; ZERO_SCROLLBACK (); -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (0); -#endif 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)); @@ -1138,11 +1109,6 @@ ZERO_SCROLLBACK (); -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (0); -#endif - screen.flags &= ~Screen_WrapNext; if ((screen.cur.row == screen.bscroll && direction == UP) || (screen.cur.row == screen.tscroll && direction == DN)) @@ -1170,11 +1136,6 @@ D_SCREEN ((stderr, "rxvt_scr_erase_line (%d) at screen row: %d", mode, screen.cur.row)); ZERO_SCROLLBACK (); -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (0); -#endif - selection_check (1); screen.flags &= ~Screen_WrapNext; @@ -1252,9 +1213,6 @@ break; case 2: /* erase whole screen */ selection_check (3); -#ifdef RXVT_GRAPHICS - Gr_ClearScreen (); -#endif row = 0; num = TermWin.nrow; break; @@ -1333,11 +1291,6 @@ ZERO_SCROLLBACK (); -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (0); -#endif - selection_check (1); if (screen.cur.row > screen.bscroll) @@ -1372,11 +1325,6 @@ want_refresh = 1; ZERO_SCROLLBACK (); -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (0); -#endif - if (count <= 0) return; @@ -1810,10 +1758,6 @@ if (TermWin.view_start != oldviewstart) { want_refresh = 1; -#ifdef RXVT_GRAPHICS - if (Gr_Displayed ()) - Gr_scroll (0); -#endif num_scr -= (TermWin.view_start - oldviewstart); } return (int) (TermWin.view_start - oldviewstart); @@ -1893,21 +1837,20 @@ void rxvt_term::scr_refresh (unsigned char refresh_type) { - unsigned char clearfirst, /* first character writes before cell */ - clearlast, /* last character writes beyond cell */ - must_clear, /* use draw_string not draw_image_string */ - rvid, /* reverse video this position */ - showcursor; /* show the cursor */ - int16_t col, row, /* column/row we're processing */ - ocrow; /* old cursor row */ - int cursorwidth; - int i, /* tmp */ - row_offset; /* basic offset in screen structure */ + unsigned char clearfirst, /* first character writes before cell */ + clearlast, /* last character writes beyond cell */ + must_clear, /* use draw_string not draw_image_string */ + rvid, /* reverse video this position */ + showcursor; /* show the cursor */ + int16_t col, row, /* column/row we're processing */ + ocrow; /* old cursor row */ + int i, /* tmp */ + row_offset; /* basic offset in screen structure */ #ifndef NO_CURSORCOLOR - rend_t cc1; /* store colours at cursor position (s) */ + rend_t cc1; /* store colours at cursor position (s) */ #endif - rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ - text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ + rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ + text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ if (refresh_type == NO_REFRESH || !TermWin.mapped) return; @@ -1949,18 +1892,13 @@ ccol2; /* Cursor colour2 */ showcursor = (screen.flags & Screen_VisibleCursor); - cursorwidth = 0; #ifdef CURSOR_BLINK if (hidden_cursor) showcursor = 0; #endif - cursorwidth = 0; - if (showcursor) { - cursorwidth++; - srp = & (screen.rend[screen.cur.row + TermWin.saveLines] [screen.cur.col]); @@ -1988,7 +1926,6 @@ *srp = SET_FGCOLOR (*srp, ccol1); *srp = SET_BGCOLOR (*srp, ccol2); #endif - } } @@ -2179,21 +2116,8 @@ rend = GET_ATTR (rend); - rvid = !! (rend & RS_RVid); - if (rvid) - { - SWAP_IT (fore, back, int); + rvid = !!(rend & RS_RVid); -#ifndef NO_BOLD_UNDERLINE_REVERSE - if (ISSET_PIXCOLOR (Color_RV) -# ifndef NO_CURSORCOLOR - && !ISSET_PIXCOLOR (Color_cursor) -# endif - ) - back = Color_RV; -#endif - - } #ifdef TEXT_BLINK if (rend & RS_Blink) { @@ -2206,28 +2130,44 @@ fore = back; } #endif + #ifndef NO_BOLD_UNDERLINE_REVERSE - else if (rend & RS_Bold) + if (rend & RS_Bold && fore == Color_fg) { if (ISSET_PIXCOLOR (Color_BD)) fore = Color_BD; - else if (fore == Color_fg) - fore = Color_White; + else + rvid = !rvid; } - else if (rend & RS_Uline) + + if (rend & RS_Uline) { if (ISSET_PIXCOLOR (Color_UL)) fore = Color_UL; } #endif + if (rvid) + { + SWAP_IT (fore, back, int); + +#ifndef NO_BOLD_UNDERLINE_REVERSE + if (ISSET_PIXCOLOR (Color_RV) +# ifndef NO_CURSORCOLOR + && !ISSET_PIXCOLOR (Color_cursor) +# endif + ) + back = Color_RV; +#endif + } + /* * Actually do the drawing of the string here */ rxvt_font *font = (*TermWin.fontset)[fid]; if (back == fore) - font->clear_rect (xpixel, ypixel, + font->clear_rect (*TermWin.drawable, xpixel, ypixel, TermWin.fwidth * count, TermWin.fheight, back); else if (back == Color_bg) @@ -2239,15 +2179,15 @@ for (i = 0; i < count; i++) /* don't draw empty strings */ if (text[i] != ' ') { - font->draw (xpixel, ypixel, text, count, fore, -1); + font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, -1); break; } } else - font->draw (xpixel, ypixel, text, count, fore, Color_bg); + font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); } else - font->draw (xpixel, ypixel, text, count, fore, back); + font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); if ((rend & RS_Uline) && (font->descent > 1)) XDrawLine (display->display, drawBuffer, TermWin.gc, @@ -2269,7 +2209,6 @@ #ifndef NO_CURSORCOLOR *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; #endif - } else if (oldcursor.row >= 0) { @@ -2277,6 +2216,11 @@ if (ISSET_PIXCOLOR (Color_cursor)) XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); #endif + int cursorwidth = 1; + while (oldcursor.col + cursorwidth < TermWin.ncol + && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR) + cursorwidth++; + XDrawRectangle (display->display, drawBuffer, TermWin.gc, Col2Pixel (oldcursor.col), Row2Pixel (oldcursor.row), @@ -2318,6 +2262,29 @@ want_refresh = 0; /* screen is current */ } +void +rxvt_term::scr_remap_chars (text_t *tp, rend_t *rp) +{ + if (!rp || !tp) + return; + + for (int i = TermWin.ncol; i; i--, rp++, tp++) + *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp)); +} + +void +rxvt_term::scr_remap_chars () +{ + for (int i = TermWin.nrow + TermWin.saveLines; i--; ) + scr_remap_chars (screen.text[i], screen.rend[i]); + + for (int i = TermWin.nrow; i--; ) + { + scr_remap_chars (drawn_text[i], drawn_rend[i]); + scr_remap_chars (swap.text[i], swap.rend[i]); + } +} + /* ------------------------------------------------------------------------- */ void rxvt_term::scr_clear () @@ -2725,8 +2692,7 @@ D_SELECT ((stderr, "rxvt_selection_clear ()")); want_refresh = 1; - if (selection.text) - free (selection.text); + free (selection.text); selection.text = NULL; selection.len = 0; CLEAR_SELECTION ();