… | |
… | |
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 3 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. |
… | |
… | |
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 (); |
… | |
… | |
2118 | ccol2 = bgcolor_of (rstyle); |
2119 | ccol2 = bgcolor_of (rstyle); |
2119 | #else |
2120 | #else |
2120 | ccol2 = Color_bg; |
2121 | ccol2 = Color_bg; |
2121 | #endif |
2122 | #endif |
2122 | |
2123 | |
2123 | if (focus && cursor_type != 2) |
2124 | if (focus && cursor_type == 0) |
2124 | { |
2125 | { |
2125 | rend_t rend = cur_rend; |
2126 | rend_t rend = cur_rend; |
2126 | |
2127 | |
2127 | if (cursor_type == 1) |
|
|
2128 | rend ^= RS_Uline; |
|
|
2129 | else |
|
|
2130 | { |
|
|
2131 | rend ^= RS_RVid; |
2128 | rend ^= RS_RVid; |
2132 | rend = SET_FGCOLOR (rend, ccol1); |
2129 | rend = SET_FGCOLOR (rend, ccol1); |
2133 | rend = SET_BGCOLOR (rend, ccol2); |
2130 | rend = SET_BGCOLOR (rend, ccol2); |
2134 | } |
|
|
2135 | |
2131 | |
2136 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2132 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2137 | } |
2133 | } |
2138 | } |
2134 | } |
2139 | |
2135 | |
2140 | /* make sure no outline cursor is left around */ |
2136 | /* make sure no outline cursor is left around */ |
2141 | if (ocrow != -1) |
2137 | if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol) |
2142 | { |
|
|
2143 | if (screen.cur.row - view_start != ocrow |
|
|
2144 | || screen.cur.col != oldcursor.col || !showcursor) |
|
|
2145 | { |
|
|
2146 | if (ocrow < nrow |
|
|
2147 | && oldcursor.col < ncol) |
|
|
2148 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2138 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2149 | } |
|
|
2150 | } |
|
|
2151 | |
2139 | |
2152 | // save the current cursor coordinates if the cursor is visible |
2140 | // save the current cursor coordinates if the cursor is visible |
2153 | // and either the window is unfocused or the cursor style is |
2141 | // and either the window is unfocused or the cursor style is |
2154 | // vertical bar, so as to clear the outline cursor in the next |
2142 | // underline or vertical bar, so as to clear the outline cursor in |
2155 | // refresh if the cursor moves or becomes invisible |
2143 | // the next refresh if the cursor moves or becomes invisible |
2156 | if (showcursor && (!focus || cursor_type == 2) && screen.cur.row - view_start < nrow) |
2144 | if (showcursor && (!focus || cursor_type != 0) && screen.cur.row - view_start < nrow) |
2157 | { |
2145 | { |
2158 | oldcursor.row = screen.cur.row - view_start; |
2146 | oldcursor.row = screen.cur.row - view_start; |
2159 | oldcursor.col = screen.cur.col; |
2147 | oldcursor.col = screen.cur.col; |
2160 | } |
2148 | } |
2161 | else |
2149 | else |
… | |
… | |
2455 | */ |
2443 | */ |
2456 | if (showcursor) |
2444 | if (showcursor) |
2457 | { |
2445 | { |
2458 | if (focus) |
2446 | if (focus) |
2459 | { |
2447 | { |
2460 | if (cursor_type != 2) |
2448 | if (cursor_type == 0) |
2461 | 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); |
2462 | else if (oldcursor.row >= 0) |
2450 | else if (oldcursor.row >= 0) |
2463 | { |
2451 | { |
2464 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2452 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2453 | if (cursor_type == 1) |
2465 | XFillRectangle (dpy, vt, gc, |
2454 | XFillRectangle (dpy, vt, gc, |
2466 | Col2Pixel (cur_col), |
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), |
2467 | Row2Pixel (oldcursor.row), |
2462 | Row2Pixel (oldcursor.row), |
2468 | 1, |
2463 | 2, |
2469 | Height2Pixel (1)); |
2464 | Height2Pixel (1)); |
2470 | } |
2465 | } |
2471 | } |
2466 | } |
2472 | else if (oldcursor.row >= 0) |
2467 | else if (oldcursor.row >= 0) |
2473 | { |
2468 | { |
2474 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2469 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
… | |
… | |
2520 | scr_remap_chars (swap_buf [i]); |
2515 | scr_remap_chars (swap_buf [i]); |
2521 | } |
2516 | } |
2522 | } |
2517 | } |
2523 | |
2518 | |
2524 | void ecb_cold |
2519 | void ecb_cold |
2525 | rxvt_term::scr_recolour (bool refresh) NOTHROW |
2520 | rxvt_term::scr_recolor (bool refresh) NOTHROW |
2526 | { |
2521 | { |
2527 | bool transparent = false; |
2522 | bool transparent = false; |
2528 | |
2523 | |
2529 | #ifdef HAVE_IMG |
2524 | #ifdef HAVE_IMG |
2530 | if (bg_img != 0) |
2525 | if (bg_img != 0) |
… | |
… | |
2551 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2546 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2552 | } |
2547 | } |
2553 | |
2548 | |
2554 | XClearWindow (dpy, parent); |
2549 | XClearWindow (dpy, parent); |
2555 | |
2550 | |
2556 | if (scrollBar.win) |
2551 | if (scrollBar.state && scrollBar.win) |
2557 | { |
2552 | { |
2558 | if (transparent) |
2553 | if (transparent) |
2559 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2554 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2560 | else |
2555 | else |
2561 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
2556 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |