… | |
… | |
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 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * 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 |
9 | * 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 |
10 | * the Free Software Foundation; either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
… | |
… | |
2118 | ccol2 = bgcolor_of (rstyle); |
2118 | ccol2 = bgcolor_of (rstyle); |
2119 | #else |
2119 | #else |
2120 | ccol2 = Color_bg; |
2120 | ccol2 = Color_bg; |
2121 | #endif |
2121 | #endif |
2122 | |
2122 | |
2123 | if (focus) |
2123 | if (focus && cursor_type != 2) |
2124 | { |
2124 | { |
2125 | rend_t rend = cur_rend; |
2125 | rend_t rend = cur_rend; |
2126 | |
2126 | |
2127 | if (option (Opt_cursorUnderline)) |
2127 | if (cursor_type == 1) |
2128 | rend ^= RS_Uline; |
2128 | rend ^= RS_Uline; |
2129 | else |
2129 | else |
2130 | { |
2130 | { |
2131 | rend ^= RS_RVid; |
2131 | rend ^= RS_RVid; |
2132 | rend = SET_FGCOLOR (rend, ccol1); |
2132 | rend = SET_FGCOLOR (rend, ccol1); |
… | |
… | |
2136 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2136 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2137 | } |
2137 | } |
2138 | } |
2138 | } |
2139 | |
2139 | |
2140 | /* make sure no outline cursor is left around */ |
2140 | /* make sure no outline cursor is left around */ |
2141 | if (ocrow != -1) |
2141 | if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol) |
2142 | { |
|
|
2143 | if (screen.cur.row - view_start != ocrow |
|
|
2144 | || screen.cur.col != oldcursor.col) |
|
|
2145 | { |
|
|
2146 | if (ocrow < nrow |
|
|
2147 | && oldcursor.col < ncol) |
|
|
2148 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2142 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2149 | } |
|
|
2150 | } |
|
|
2151 | |
2143 | |
2152 | // save the current cursor coordinates if the cursor is visible |
2144 | // save the current cursor coordinates if the cursor is visible |
2153 | // and the window is unfocused, so as to clear the outline cursor |
2145 | // and either the window is unfocused or the cursor style is |
2154 | // in the next refresh if the cursor moves |
2146 | // vertical bar, so as to clear the outline cursor in the next |
|
|
2147 | // refresh if the cursor moves or becomes invisible |
2155 | if (showcursor && !focus && screen.cur.row - view_start < nrow) |
2148 | if (showcursor && (!focus || cursor_type == 2) && screen.cur.row - view_start < nrow) |
2156 | { |
2149 | { |
2157 | oldcursor.row = screen.cur.row - view_start; |
2150 | oldcursor.row = screen.cur.row - view_start; |
2158 | oldcursor.col = screen.cur.col; |
2151 | oldcursor.col = screen.cur.col; |
2159 | } |
2152 | } |
2160 | else |
2153 | else |
… | |
… | |
2247 | int ypixel = (int)Row2Pixel (row); |
2240 | int ypixel = (int)Row2Pixel (row); |
2248 | |
2241 | |
2249 | for (col = 0; col < ncol; col++) |
2242 | for (col = 0; col < ncol; col++) |
2250 | { |
2243 | { |
2251 | /* compare new text with old - if exactly the same then continue */ |
2244 | /* compare new text with old - if exactly the same then continue */ |
2252 | if (stp[col] == dtp[col] /* Must match characters to skip. */ |
2245 | if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col])) |
2253 | && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */ |
|
|
2254 | || (stp[col] == ' ' /* space w/ no background change */ |
|
|
2255 | && GET_BGATTR (srp[col]) == GET_BGATTR (drp[col])))) |
|
|
2256 | continue; |
2246 | continue; |
2257 | |
2247 | |
2258 | // redraw one or more characters |
2248 | // redraw one or more characters |
2259 | |
2249 | |
2260 | // seek to the beginning of wide characters |
2250 | // seek to the beginning of wide characters |
… | |
… | |
2456 | * G: cleanup cursor and display outline cursor if necessary |
2446 | * G: cleanup cursor and display outline cursor if necessary |
2457 | */ |
2447 | */ |
2458 | if (showcursor) |
2448 | if (showcursor) |
2459 | { |
2449 | { |
2460 | if (focus) |
2450 | if (focus) |
|
|
2451 | { |
|
|
2452 | if (cursor_type != 2) |
2461 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2453 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
|
|
2454 | else if (oldcursor.row >= 0) |
|
|
2455 | { |
|
|
2456 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2457 | XFillRectangle (dpy, vt, gc, |
|
|
2458 | Col2Pixel (cur_col), |
|
|
2459 | Row2Pixel (oldcursor.row), |
|
|
2460 | 1, |
|
|
2461 | Height2Pixel (1)); |
|
|
2462 | } |
|
|
2463 | } |
2462 | else if (oldcursor.row >= 0) |
2464 | else if (oldcursor.row >= 0) |
2463 | { |
2465 | { |
2464 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2466 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2465 | |
2467 | |
2466 | XDrawRectangle (dpy, vt, gc, |
2468 | XDrawRectangle (dpy, vt, gc, |
… | |
… | |
2541 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2543 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2542 | } |
2544 | } |
2543 | |
2545 | |
2544 | XClearWindow (dpy, parent); |
2546 | XClearWindow (dpy, parent); |
2545 | |
2547 | |
2546 | if (scrollBar.win) |
2548 | if (scrollBar.state && scrollBar.win) |
2547 | { |
2549 | { |
2548 | if (transparent) |
2550 | if (transparent) |
2549 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2551 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2550 | else |
2552 | else |
2551 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
2553 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |