… | |
… | |
2008 | * screen.text/screen.rend contain what the screen will change to. |
2008 | * screen.text/screen.rend contain what the screen will change to. |
2009 | */ |
2009 | */ |
2010 | void |
2010 | void |
2011 | rxvt_term::scr_refresh () NOTHROW |
2011 | rxvt_term::scr_refresh () NOTHROW |
2012 | { |
2012 | { |
2013 | unsigned char have_bg, |
|
|
2014 | showcursor; /* show the cursor */ |
|
|
2015 | int16_t col, row, /* column/row we're processing */ |
2013 | int16_t col, row, /* column/row we're processing */ |
2016 | ocrow; /* old cursor row */ |
2014 | ocrow; /* old cursor row */ |
2017 | int i; /* tmp */ |
2015 | int i; /* tmp */ |
2018 | #ifndef NO_CURSORCOLOR |
2016 | #ifndef NO_CURSORCOLOR |
2019 | rend_t cc1; /* store colours at cursor position (s) */ |
2017 | rend_t cc1; /* store colours at cursor position (s) */ |
… | |
… | |
2030 | /* |
2028 | /* |
2031 | * A: set up vars |
2029 | * A: set up vars |
2032 | */ |
2030 | */ |
2033 | refresh_count = 0; |
2031 | refresh_count = 0; |
2034 | |
2032 | |
|
|
2033 | unsigned int old_screen_flags = screen.flags; |
2035 | have_bg = 0; |
2034 | char have_bg = 0; |
2036 | #ifdef HAVE_BG_PIXMAP |
2035 | #ifdef HAVE_BG_PIXMAP |
2037 | have_bg = bgPixmap.pixmap != None; |
2036 | have_bg = bgPixmap.pixmap != None; |
2038 | #endif |
2037 | #endif |
2039 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2038 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2040 | |
2039 | |
2041 | /* |
2040 | /* |
2042 | * B: reverse any characters which are selected |
2041 | * B: reverse any characters which are selected |
2043 | */ |
2042 | */ |
2044 | scr_reverse_selection (); |
2043 | scr_reverse_selection (); |
|
|
2044 | |
|
|
2045 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
|
|
2046 | #if ENABLE_OVERLAY |
|
|
2047 | scr_swap_overlay (); |
|
|
2048 | #endif |
|
|
2049 | |
|
|
2050 | char showcursor = screen.flags & Screen_VisibleCursor; |
2045 | |
2051 | |
2046 | /* |
2052 | /* |
2047 | * C: set the cursor character (s) |
2053 | * C: set the cursor character (s) |
2048 | */ |
2054 | */ |
2049 | { |
2055 | { |
2050 | unsigned char setoldcursor; |
2056 | unsigned char setoldcursor; |
2051 | |
2057 | |
2052 | showcursor = (screen.flags & Screen_VisibleCursor); |
|
|
2053 | #ifdef CURSOR_BLINK |
2058 | #ifdef CURSOR_BLINK |
2054 | if (hidden_cursor) |
2059 | if (hidden_cursor) |
2055 | showcursor = 0; |
2060 | showcursor = 0; |
2056 | #endif |
2061 | #endif |
2057 | |
2062 | |
… | |
… | |
2130 | oldcursor.col = screen.cur.col; |
2135 | oldcursor.col = screen.cur.col; |
2131 | } |
2136 | } |
2132 | } |
2137 | } |
2133 | } |
2138 | } |
2134 | |
2139 | |
2135 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
|
|
2136 | #if ENABLE_OVERLAY |
|
|
2137 | scr_swap_overlay (); |
|
|
2138 | #endif |
|
|
2139 | |
|
|
2140 | #ifndef NO_SLOW_LINK_SUPPORT |
2140 | #ifndef NO_SLOW_LINK_SUPPORT |
2141 | /* |
2141 | /* |
2142 | * D: CopyArea pass - very useful for slower links |
2142 | * D: CopyArea pass - very useful for slower links |
2143 | * This has been deliberately kept simple. |
2143 | * This has been deliberately kept simple. |
2144 | */ |
2144 | */ |
… | |
… | |
2416 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2416 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2417 | } |
2417 | } |
2418 | } /* for (col....) */ |
2418 | } /* for (col....) */ |
2419 | } /* for (row....) */ |
2419 | } /* for (row....) */ |
2420 | |
2420 | |
2421 | #if ENABLE_OVERLAY |
|
|
2422 | scr_swap_overlay (); |
|
|
2423 | #endif |
|
|
2424 | HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END)); |
|
|
2425 | |
|
|
2426 | /* |
2421 | /* |
2427 | * G: cleanup cursor and display outline cursor if necessary |
2422 | * G: cleanup cursor and display outline cursor if necessary |
2428 | */ |
2423 | */ |
2429 | if (showcursor) |
2424 | if (showcursor) |
2430 | { |
2425 | { |
… | |
… | |
2468 | } |
2463 | } |
2469 | |
2464 | |
2470 | /* |
2465 | /* |
2471 | * H: cleanup selection |
2466 | * H: cleanup selection |
2472 | */ |
2467 | */ |
|
|
2468 | #if ENABLE_OVERLAY |
|
|
2469 | scr_swap_overlay (); |
|
|
2470 | #endif |
|
|
2471 | HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END)); |
|
|
2472 | |
2473 | scr_reverse_selection (); |
2473 | scr_reverse_selection (); |
2474 | |
2474 | |
|
|
2475 | screen.flags = old_screen_flags; |
2475 | num_scr = 0; |
2476 | num_scr = 0; |
2476 | num_scr_allow = 1; |
2477 | num_scr_allow = 1; |
2477 | } |
2478 | } |
2478 | |
2479 | |
2479 | void |
2480 | void |
… | |
… | |
3738 | h += 2; min_it (h, nrow); |
3739 | h += 2; min_it (h, nrow); |
3739 | |
3740 | |
3740 | x -= 1; clamp_it (x, 0, ncol - w); |
3741 | x -= 1; clamp_it (x, 0, ncol - w); |
3741 | y -= 1; clamp_it (y, 0, nrow - h); |
3742 | y -= 1; clamp_it (y, 0, nrow - h); |
3742 | |
3743 | |
3743 | ov_x = x; ov_y = y; |
3744 | ov.x = x; ov.y = y; |
3744 | ov_w = w; ov_h = h; |
3745 | ov.w = w; ov.h = h; |
3745 | |
3746 | |
3746 | ov_text = new text_t *[h]; |
3747 | ov.text = new text_t *[h]; |
3747 | ov_rend = new rend_t *[h]; |
3748 | ov.rend = new rend_t *[h]; |
3748 | |
3749 | |
3749 | for (y = 0; y < h; y++) |
3750 | for (y = 0; y < h; y++) |
3750 | { |
3751 | { |
3751 | text_t *tp = ov_text[y] = new text_t[w]; |
3752 | text_t *tp = ov.text[y] = new text_t[w]; |
3752 | rend_t *rp = ov_rend[y] = new rend_t[w]; |
3753 | rend_t *rp = ov.rend[y] = new rend_t[w]; |
3753 | |
3754 | |
3754 | text_t t0, t1, t2; |
3755 | text_t t0, t1, t2; |
3755 | rend_t r = OVERLAY_RSTYLE; |
3756 | rend_t r = OVERLAY_RSTYLE; |
3756 | |
3757 | |
3757 | if (y == 0) |
3758 | if (y == 0) |
… | |
… | |
3776 | } |
3777 | } |
3777 | |
3778 | |
3778 | void |
3779 | void |
3779 | rxvt_term::scr_overlay_off () NOTHROW |
3780 | rxvt_term::scr_overlay_off () NOTHROW |
3780 | { |
3781 | { |
3781 | if (!ov_text) |
3782 | if (!ov.text) |
3782 | return; |
3783 | return; |
3783 | |
3784 | |
3784 | want_refresh = 1; |
3785 | want_refresh = 1; |
3785 | |
3786 | |
3786 | for (int y = 0; y < ov_h; y++) |
3787 | for (int y = 0; y < ov.h; y++) |
3787 | { |
3788 | { |
3788 | delete [] ov_text[y]; |
3789 | delete [] ov.text[y]; |
3789 | delete [] ov_rend[y]; |
3790 | delete [] ov.rend[y]; |
3790 | } |
3791 | } |
3791 | |
3792 | |
3792 | delete [] ov_text; ov_text = 0; |
3793 | delete [] ov.text; ov.text = 0; |
3793 | delete [] ov_rend; ov_rend = 0; |
3794 | delete [] ov.rend; ov.rend = 0; |
3794 | } |
3795 | } |
3795 | |
3796 | |
3796 | void |
3797 | void |
3797 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW |
3798 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW |
3798 | { |
3799 | { |
3799 | if (!ov_text || x >= ov_w - 2 || y >= ov_h - 2) |
3800 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3800 | return; |
3801 | return; |
3801 | |
3802 | |
3802 | x++, y++; |
3803 | x++, y++; |
3803 | |
3804 | |
3804 | ov_text[y][x] = text; |
3805 | ov.text[y][x] = text; |
3805 | ov_rend[y][x] = rend; |
3806 | ov.rend[y][x] = rend; |
3806 | } |
3807 | } |
3807 | |
3808 | |
3808 | void |
3809 | void |
3809 | rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW |
3810 | rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW |
3810 | { |
3811 | { |
… | |
… | |
3829 | } |
3830 | } |
3830 | |
3831 | |
3831 | void |
3832 | void |
3832 | rxvt_term::scr_swap_overlay () NOTHROW |
3833 | rxvt_term::scr_swap_overlay () NOTHROW |
3833 | { |
3834 | { |
3834 | if (!ov_text) |
3835 | if (!ov.text) |
3835 | return; |
3836 | return; |
3836 | |
3837 | |
|
|
3838 | // hide cursor if it is within the overlay area |
|
|
3839 | if (IN_RANGE_EXC (screen.cur.col - ov.x, 0, ov.w) |
|
|
3840 | && IN_RANGE_EXC (screen.cur.row - ov.y, 0, ov.h)) |
|
|
3841 | screen.flags &= ~Screen_VisibleCursor; |
|
|
3842 | |
3837 | // swap screen mem with overlay |
3843 | // swap screen mem with overlay |
3838 | for (int y = ov_h; y--; ) |
3844 | for (int y = ov.h; y--; ) |
3839 | { |
3845 | { |
3840 | text_t *t1 = ov_text[y]; |
3846 | text_t *t1 = ov.text[y]; |
3841 | rend_t *r1 = ov_rend[y]; |
3847 | rend_t *r1 = ov.rend[y]; |
3842 | |
3848 | |
3843 | text_t *t2 = ROW(y + ov_y + view_start).t + ov_x; |
3849 | text_t *t2 = ROW(y + ov.y + view_start).t + ov.x; |
3844 | rend_t *r2 = ROW(y + ov_y + view_start).r + ov_x; |
3850 | rend_t *r2 = ROW(y + ov.y + view_start).r + ov.x; |
3845 | |
3851 | |
3846 | for (int x = ov_w; x--; ) |
3852 | for (int x = ov.w; x--; ) |
3847 | { |
3853 | { |
3848 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3854 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3849 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3855 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3850 | } |
3856 | } |
3851 | } |
3857 | } |