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.444 by sf-exg, Tue Apr 2 21:03:35 2013 UTC vs.
Revision 1.456 by sf-exg, Tue Oct 13 08:10:43 2015 UTC

2 * File: screen.C 2 * File: screen.C
3 *---------------------------------------------------------------------------* 3 *---------------------------------------------------------------------------*
4 * 4 *
5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
6 * Copyright (c) 2003-2007 Marc Lehmann <schmorp@schmorp.de> 6 * Copyright (c) 2003-2007 Marc Lehmann <schmorp@schmorp.de>
7 * Copyright (c) 2015 Emanuele Giaquinta <e.giaquinta@glauco.it>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version. 12 * (at your option) any later version.
12 * 13 *
13 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1011 } 1012 }
1012 else if (screen.cur.row > 0 1013 else if (screen.cur.row > 0
1013 && ROW(screen.cur.row - 1).is_longer ()) 1014 && ROW(screen.cur.row - 1).is_longer ())
1014 { 1015 {
1015 linep = &ROW(screen.cur.row - 1); 1016 linep = &ROW(screen.cur.row - 1);
1016 tp = line->t + ncol - 1; 1017 tp = linep->t + ncol - 1;
1017 rp = line->r + ncol - 1; 1018 rp = linep->r + ncol - 1;
1018 } 1019 }
1019 else 1020 else
1020 continue; 1021 continue;
1021 1022
1022 linep->touch (); 1023 linep->touch ();
1897 * the top of the screen 1898 * the top of the screen
1898 */ 1899 */
1899void 1900void
1900rxvt_term::scr_move_to (int y, int len) NOTHROW 1901rxvt_term::scr_move_to (int y, int len) NOTHROW
1901{ 1902{
1902 scr_changeview ((top_row - nrow) * (len - y) / len + (nrow - 1)); 1903 // lerp (y, 0, len, top_row, nrow - 1)
1904 scr_changeview (top_row + (nrow - 1 - top_row) * y / len);
1903} 1905}
1904 1906
1905/* ------------------------------------------------------------------------- */ 1907/* ------------------------------------------------------------------------- */
1906/* 1908/*
1907 * Page the screen up/down nlines 1909 * Page the screen up/down nlines
2117 ccol2 = bgcolor_of (rstyle); 2119 ccol2 = bgcolor_of (rstyle);
2118#else 2120#else
2119 ccol2 = Color_bg; 2121 ccol2 = Color_bg;
2120#endif 2122#endif
2121 2123
2122 if (focus) 2124 if (focus && cursor_type == 0)
2123 { 2125 {
2124 rend_t rend = cur_rend; 2126 rend_t rend = cur_rend;
2125 2127
2126 if (option (Opt_cursorUnderline))
2127 rend ^= RS_Uline;
2128 else
2129 {
2130 rend ^= RS_RVid; 2128 rend ^= RS_RVid;
2131 rend = SET_FGCOLOR (rend, ccol1); 2129 rend = SET_FGCOLOR (rend, ccol1);
2132 rend = SET_BGCOLOR (rend, ccol2); 2130 rend = SET_BGCOLOR (rend, ccol2);
2133 }
2134 2131
2135 scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); 2132 scr_set_char_rend (ROW(screen.cur.row), cur_col, rend);
2136 } 2133 }
2137 } 2134 }
2138 2135
2139 /* make sure no outline cursor is left around */ 2136 /* make sure no outline cursor is left around */
2140 if (ocrow != -1) 2137 if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol)
2141 {
2142 if (screen.cur.row - view_start != ocrow
2143 || screen.cur.col != oldcursor.col)
2144 {
2145 if (ocrow < nrow
2146 && oldcursor.col < ncol)
2147 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); 2138 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline);
2148 }
2149 }
2150 2139
2151 // save the current cursor coordinates if the cursor is visible 2140 // save the current cursor coordinates if the cursor is visible
2152 // and the window is unfocused, so as to clear the outline cursor 2141 // and either the window is unfocused or the cursor style is
2142 // underline or vertical bar, so as to clear the outline cursor in
2153 // in the next refresh if the cursor moves 2143 // the next refresh if the cursor moves or becomes invisible
2154 if (showcursor && !focus && screen.cur.row - view_start < nrow) 2144 if (showcursor && (!focus || cursor_type != 0) && screen.cur.row - view_start < nrow)
2155 { 2145 {
2156 oldcursor.row = screen.cur.row - view_start; 2146 oldcursor.row = screen.cur.row - view_start;
2157 oldcursor.col = screen.cur.col; 2147 oldcursor.col = screen.cur.col;
2158 } 2148 }
2159 else 2149 else
2246 int ypixel = (int)Row2Pixel (row); 2236 int ypixel = (int)Row2Pixel (row);
2247 2237
2248 for (col = 0; col < ncol; col++) 2238 for (col = 0; col < ncol; col++)
2249 { 2239 {
2250 /* compare new text with old - if exactly the same then continue */ 2240 /* compare new text with old - if exactly the same then continue */
2251 if (stp[col] == dtp[col] /* Must match characters to skip. */ 2241 if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col]))
2252 && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */
2253 || (stp[col] == ' ' /* space w/ no background change */
2254 && GET_BGATTR (srp[col]) == GET_BGATTR (drp[col]))))
2255 continue; 2242 continue;
2256 2243
2257 // redraw one or more characters 2244 // redraw one or more characters
2258 2245
2259 // seek to the beginning of wide characters 2246 // seek to the beginning of wide characters
2455 * G: cleanup cursor and display outline cursor if necessary 2442 * G: cleanup cursor and display outline cursor if necessary
2456 */ 2443 */
2457 if (showcursor) 2444 if (showcursor)
2458 { 2445 {
2459 if (focus) 2446 if (focus)
2447 {
2448 if (cursor_type == 0)
2460 scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); 2449 scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend);
2450 else if (oldcursor.row >= 0)
2451 {
2452 XSetForeground (dpy, gc, pix_colors[ccol1]);
2453 if (cursor_type == 1)
2454 XFillRectangle (dpy, vt, gc,
2455 Col2Pixel (cur_col),
2456 Row2Pixel (oldcursor.row + 1) - 2,
2457 Width2Pixel (1),
2458 2);
2459 else
2460 XFillRectangle (dpy, vt, gc,
2461 Col2Pixel (cur_col),
2462 Row2Pixel (oldcursor.row),
2463 2,
2464 Height2Pixel (1));
2465 }
2466 }
2461 else if (oldcursor.row >= 0) 2467 else if (oldcursor.row >= 0)
2462 { 2468 {
2463 XSetForeground (dpy, gc, pix_colors[ccol1]); 2469 XSetForeground (dpy, gc, pix_colors[ccol1]);
2464 2470
2465 XDrawRectangle (dpy, vt, gc, 2471 XDrawRectangle (dpy, vt, gc,
2509 scr_remap_chars (swap_buf [i]); 2515 scr_remap_chars (swap_buf [i]);
2510 } 2516 }
2511} 2517}
2512 2518
2513void ecb_cold 2519void ecb_cold
2514rxvt_term::scr_recolour (bool refresh) NOTHROW 2520rxvt_term::scr_recolor (bool refresh) NOTHROW
2515{ 2521{
2516 bool transparent = false; 2522 bool transparent = false;
2517 2523
2518#ifdef HAVE_IMG 2524#ifdef HAVE_IMG
2519 if (bg_img != 0) 2525 if (bg_img != 0)
2540 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 2546 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
2541 } 2547 }
2542 2548
2543 XClearWindow (dpy, parent); 2549 XClearWindow (dpy, parent);
2544 2550
2545 if (scrollBar.win) 2551 if (scrollBar.state && scrollBar.win)
2546 { 2552 {
2547 if (transparent) 2553 if (transparent)
2548 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); 2554 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);
2549 else 2555 else
2550 XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); 2556 XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines