… | |
… | |
2048 | int i; /* tmp */ |
2048 | int i; /* tmp */ |
2049 | rend_t ccol1, /* Cursor colour */ |
2049 | rend_t ccol1, /* Cursor colour */ |
2050 | ccol2; /* Cursor colour2 */ |
2050 | ccol2; /* Cursor colour2 */ |
2051 | rend_t cur_rend; |
2051 | rend_t cur_rend; |
2052 | int cur_col; |
2052 | int cur_col; |
|
|
2053 | int cursorwidth; |
2053 | |
2054 | |
2054 | want_refresh = 0; /* screen is current */ |
2055 | want_refresh = 0; /* screen is current */ |
2055 | |
2056 | |
2056 | if (refresh_type == NO_REFRESH || !mapped) |
2057 | if (refresh_type == NO_REFRESH || !mapped) |
2057 | return; |
2058 | return; |
… | |
… | |
2082 | |
2083 | |
2083 | /* |
2084 | /* |
2084 | * C: set the cursor character (s) |
2085 | * C: set the cursor character (s) |
2085 | */ |
2086 | */ |
2086 | { |
2087 | { |
2087 | bool setoldcursor; |
|
|
2088 | |
|
|
2089 | #ifdef CURSOR_BLINK |
2088 | #ifdef CURSOR_BLINK |
2090 | if (hidden_cursor) |
2089 | if (hidden_cursor) |
2091 | showcursor = 0; |
2090 | showcursor = 0; |
2092 | #endif |
2091 | #endif |
2093 | |
2092 | |
… | |
… | |
2095 | { |
2094 | { |
2096 | int col = screen.cur.col; |
2095 | int col = screen.cur.col; |
2097 | |
2096 | |
2098 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
2097 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
2099 | col--; |
2098 | col--; |
|
|
2099 | |
|
|
2100 | cursorwidth = 1; |
|
|
2101 | while (col + cursorwidth < ncol |
|
|
2102 | && ROW(screen.cur.row).t[col + cursorwidth] == NOCHAR) |
|
|
2103 | cursorwidth++; |
2100 | |
2104 | |
2101 | cur_rend = ROW(screen.cur.row).r[col]; |
2105 | cur_rend = ROW(screen.cur.row).r[col]; |
2102 | cur_col = col; |
2106 | cur_col = col; |
2103 | |
2107 | |
2104 | #ifndef NO_CURSORCOLOR |
2108 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2139 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2143 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2140 | } |
2144 | } |
2141 | } |
2145 | } |
2142 | |
2146 | |
2143 | /* make sure no outline cursor is left around */ |
2147 | /* make sure no outline cursor is left around */ |
2144 | setoldcursor = 0; |
|
|
2145 | if (ocrow != -1) |
2148 | if (ocrow != -1) |
2146 | { |
2149 | { |
2147 | if (screen.cur.row - view_start != ocrow |
2150 | if (screen.cur.row - view_start != ocrow |
2148 | || screen.cur.col != oldcursor.col) |
2151 | || screen.cur.col != oldcursor.col) |
2149 | { |
2152 | { |
2150 | if (ocrow < nrow |
2153 | if (ocrow < nrow |
2151 | && oldcursor.col < ncol) |
2154 | && oldcursor.col < ncol) |
2152 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2155 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2153 | |
|
|
2154 | if (focus || !showcursor) |
|
|
2155 | oldcursor.row = -1; |
|
|
2156 | else |
|
|
2157 | setoldcursor = 1; |
|
|
2158 | } |
2156 | } |
2159 | } |
2157 | } |
2160 | else if (!focus) |
|
|
2161 | setoldcursor = 1; |
|
|
2162 | |
2158 | |
2163 | if (setoldcursor) |
2159 | // save the current cursor coordinates if the cursor is visible |
|
|
2160 | // and the window is unfocused, so as to clear the outline cursor |
|
|
2161 | // in the next refresh if the cursor moves |
|
|
2162 | if (showcursor && !focus && screen.cur.row - view_start < nrow) |
2164 | { |
2163 | { |
2165 | if (screen.cur.row - view_start >= nrow) |
|
|
2166 | oldcursor.row = -1; |
|
|
2167 | else |
|
|
2168 | { |
|
|
2169 | oldcursor.row = screen.cur.row - view_start; |
2164 | oldcursor.row = screen.cur.row - view_start; |
2170 | oldcursor.col = screen.cur.col; |
2165 | oldcursor.col = screen.cur.col; |
2171 | } |
|
|
2172 | } |
2166 | } |
|
|
2167 | else |
|
|
2168 | oldcursor.row = -1; |
2173 | } |
2169 | } |
2174 | |
2170 | |
2175 | #ifndef NO_SLOW_LINK_SUPPORT |
2171 | #ifndef NO_SLOW_LINK_SUPPORT |
2176 | /* |
2172 | /* |
2177 | * D: CopyArea pass - very useful for slower links |
2173 | * D: CopyArea pass - very useful for slower links |
… | |
… | |
2443 | else |
2439 | else |
2444 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2440 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2445 | |
2441 | |
2446 | if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) |
2442 | if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) |
2447 | { |
2443 | { |
|
|
2444 | if (showcursor && focus && row == screen.cur.row |
|
|
2445 | && IN_RANGE_EXC (col, cur_col, cur_col + cursorwidth)) |
|
|
2446 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2447 | else |
2448 | #if ENABLE_FRILLS |
2448 | #if ENABLE_FRILLS |
2449 | if (ISSET_PIXCOLOR (Color_underline)) |
2449 | if (ISSET_PIXCOLOR (Color_underline)) |
2450 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2450 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2451 | else |
2451 | else |
2452 | #endif |
2452 | #endif |
… | |
… | |
2466 | { |
2466 | { |
2467 | if (focus) |
2467 | if (focus) |
2468 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2468 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2469 | else if (oldcursor.row >= 0) |
2469 | else if (oldcursor.row >= 0) |
2470 | { |
2470 | { |
2471 | int cursorwidth = 1; |
|
|
2472 | int col = oldcursor.col; |
|
|
2473 | |
|
|
2474 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
|
|
2475 | col--; |
|
|
2476 | |
|
|
2477 | while (col + cursorwidth < ncol |
|
|
2478 | && drawn_buf[oldcursor.row].t[col + cursorwidth] == NOCHAR) |
|
|
2479 | cursorwidth++; |
|
|
2480 | |
|
|
2481 | #ifndef NO_CURSORCOLOR |
|
|
2482 | if (ISSET_PIXCOLOR (Color_cursor)) |
|
|
2483 | XSetForeground (dpy, gc, pix_colors[Color_cursor]); |
|
|
2484 | else |
|
|
2485 | #endif |
|
|
2486 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2471 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2487 | |
2472 | |
2488 | XDrawRectangle (dpy, vt, gc, |
2473 | XDrawRectangle (dpy, vt, gc, |
2489 | Col2Pixel (col), |
2474 | Col2Pixel (cur_col), |
2490 | Row2Pixel (oldcursor.row), |
2475 | Row2Pixel (oldcursor.row), |
2491 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2476 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2492 | (unsigned int) (Height2Pixel (1) - 1)); |
2477 | (unsigned int) (Height2Pixel (1) - 1)); |
2493 | } |
2478 | } |
2494 | } |
2479 | } |