--- rxvt-unicode/src/screen.C 2014/10/30 09:53:05 1.448 +++ rxvt-unicode/src/screen.C 2017/07/15 08:16:22 1.458 @@ -4,6 +4,7 @@ * * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2003-2007 Marc Lehmann + * Copyright (c) 2015 Emanuele Giaquinta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -616,7 +617,7 @@ void rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW { - if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) + if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24)) color = fgbg; if (fgbg == Color_fg) @@ -1013,8 +1014,8 @@ && ROW(screen.cur.row - 1).is_longer ()) { linep = &ROW(screen.cur.row - 1); - tp = line->t + ncol - 1; - rp = line->r + ncol - 1; + tp = linep->t + ncol - 1; + rp = linep->r + ncol - 1; } else continue; @@ -1715,6 +1716,14 @@ { rvideo_state = on; +#if OFF_FOCUS_FADING + if (rs[Rs_fade]) + { + ::swap (pix_colors_focused[Color_fg], pix_colors_focused[Color_bg]); + ::swap (pix_colors_unfocused[Color_fg], pix_colors_unfocused[Color_bg]); + } + else +#endif ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); #ifdef HAVE_IMG if (bg_img == 0) @@ -2120,40 +2129,27 @@ ccol2 = Color_bg; #endif - if (focus && cursor_type != 2) + if (focus && cursor_type == 0) { rend_t rend = cur_rend; - if (cursor_type == 1) - rend ^= RS_Uline; - else - { - rend ^= RS_RVid; - rend = SET_FGCOLOR (rend, ccol1); - rend = SET_BGCOLOR (rend, ccol2); - } + rend ^= RS_RVid; + rend = SET_FGCOLOR (rend, ccol1); + rend = SET_BGCOLOR (rend, ccol2); scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); } } /* make sure no outline cursor is left around */ - if (ocrow != -1) - { - if (screen.cur.row - view_start != ocrow - || screen.cur.col != oldcursor.col || !showcursor) - { - if (ocrow < nrow - && oldcursor.col < ncol) - drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); - } - } + if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol) + drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); // save the current cursor coordinates if the cursor is visible // and either the window is unfocused or the cursor style is - // vertical bar, so as to clear the outline cursor in the next - // refresh if the cursor moves or becomes invisible - if (showcursor && (!focus || cursor_type == 2) && screen.cur.row - view_start < nrow) + // underline or vertical bar, so as to clear the outline cursor in + // the next refresh if the cursor moves or becomes invisible + if (showcursor && (!focus || cursor_type != 0) && screen.cur.row - view_start < nrow) { oldcursor.row = screen.cur.row - view_start; oldcursor.col = screen.cur.col; @@ -2250,10 +2246,7 @@ for (col = 0; col < ncol; col++) { /* compare new text with old - if exactly the same then continue */ - if (stp[col] == dtp[col] /* Must match characters to skip. */ - && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */ - || (stp[col] == ' ' /* space w/ no background change */ - && !((srp[col] ^ drp[col]) & (RS_attrMask | RS_bgMask))))) + if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col])) continue; // redraw one or more characters @@ -2460,16 +2453,23 @@ { if (focus) { - if (cursor_type != 2) + if (cursor_type == 0) scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); else if (oldcursor.row >= 0) { XSetForeground (dpy, gc, pix_colors[ccol1]); - XFillRectangle (dpy, vt, gc, - Col2Pixel (cur_col), - Row2Pixel (oldcursor.row), - 1, - Height2Pixel (1)); + if (cursor_type == 1) + XFillRectangle (dpy, vt, gc, + Col2Pixel (cur_col), + Row2Pixel (oldcursor.row + 1) - 2, + Width2Pixel (1), + 2); + else + XFillRectangle (dpy, vt, gc, + Col2Pixel (cur_col), + Row2Pixel (oldcursor.row), + 2, + Height2Pixel (1)); } } else if (oldcursor.row >= 0) @@ -2525,7 +2525,7 @@ } void ecb_cold -rxvt_term::scr_recolour (bool refresh) NOTHROW +rxvt_term::scr_recolor (bool refresh) NOTHROW { bool transparent = false; @@ -2556,7 +2556,7 @@ XClearWindow (dpy, parent); - if (scrollBar.win) + if (scrollBar.state && scrollBar.win) { if (transparent) XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);