… | |
… | |
29 | #include "rxvt.h" /* NECESSARY */ |
29 | #include "rxvt.h" /* NECESSARY */ |
30 | #include "screen.intpro" /* PROTOS for internal routines */ |
30 | #include "screen.intpro" /* PROTOS for internal routines */ |
31 | |
31 | |
32 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
32 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
33 | |
33 | |
34 | #include <stdint.h> |
34 | #include <inttypes.h> |
35 | #include <wchar.h> |
35 | #include <wchar.h> |
36 | |
36 | |
37 | #include "salloc.C" // HACK, should be a seperate compile! |
37 | #include "salloc.C" // HACK, should be a seperate compile! |
38 | |
38 | |
39 | inline void fill_text (text_t *start, text_t value, int len) |
39 | inline void fill_text (text_t *start, text_t value, int len) |
… | |
… | |
118 | /* Fill part/all of a line with blanks. */ |
118 | /* Fill part/all of a line with blanks. */ |
119 | void |
119 | void |
120 | rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) |
120 | rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) |
121 | { |
121 | { |
122 | efs &= ~RS_baseattrMask; |
122 | efs &= ~RS_baseattrMask; |
123 | efs = SET_FONT (efs, TermWin.fontset->find_font (' ')); |
123 | efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]); |
124 | |
124 | |
125 | while (width--) |
125 | while (width--) |
126 | { |
126 | { |
127 | *et++ = ' '; |
127 | *et++ = ' '; |
128 | *er++ = efs; |
128 | *er++ = efs; |
… | |
… | |
172 | nrow = TermWin.nrow; |
172 | nrow = TermWin.nrow; |
173 | |
173 | |
174 | if (ncol == prev_ncol && nrow == prev_nrow) |
174 | if (ncol == prev_ncol && nrow == prev_nrow) |
175 | return; |
175 | return; |
176 | |
176 | |
|
|
177 | // we need at least two lines for wrapping to work correctly |
|
|
178 | if (nrow + TermWin.saveLines < 2) |
|
|
179 | { |
|
|
180 | TermWin.saveLines++; |
|
|
181 | prev_nrow--; |
|
|
182 | TermWin.nscrolled++; |
|
|
183 | } |
|
|
184 | |
177 | want_refresh = 1; |
185 | want_refresh = 1; |
178 | |
186 | |
|
|
187 | prev_total_rows = prev_nrow + TermWin.saveLines; |
179 | total_rows = nrow + TermWin.saveLines; |
188 | total_rows = nrow + TermWin.saveLines; |
180 | prev_total_rows = prev_nrow + TermWin.saveLines; |
|
|
181 | |
189 | |
182 | screen.tscroll = 0; |
190 | screen.tscroll = 0; |
183 | screen.bscroll = nrow - 1; |
191 | screen.bscroll = nrow - 1; |
184 | |
192 | |
185 | if (!talloc) |
193 | if (!talloc) |
186 | { |
194 | { |
187 | talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
195 | talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
188 | ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); |
196 | ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); |
189 | } |
197 | } |
190 | |
198 | |
191 | if (prev_nrow == 0) |
199 | if (!screen.text) |
192 | { |
200 | { |
193 | /* |
201 | /* |
194 | * first time called so just malloc everything: don't rely on realloc |
202 | * first time called so just malloc everything: don't rely on realloc |
195 | * Note: this is still needed so that all the scrollback lines are NULL |
203 | * Note: this is still needed so that all the scrollback lines are NULL |
196 | */ |
204 | */ |
… | |
… | |
705 | if (j > 0) |
713 | if (j > 0) |
706 | { |
714 | { |
707 | /* A: scroll up */ |
715 | /* A: scroll up */ |
708 | |
716 | |
709 | /* A1: Copy lines that will get clobbered by the rotation */ |
717 | /* A1: Copy lines that will get clobbered by the rotation */ |
|
|
718 | memcpy (buf_text, screen.text + row1, count * sizeof (text_t *)); |
|
|
719 | memcpy (buf_rend, screen.rend + row1, count * sizeof (rend_t *)); |
|
|
720 | |
|
|
721 | /* A2: Rotate lines */ |
|
|
722 | i = row2 - row1 - count + 1; |
|
|
723 | memmove (screen.tlen + row1, screen.tlen + row1 + count, i * sizeof (int16_t)); |
|
|
724 | memmove (screen.text + row1, screen.text + row1 + count, i * sizeof (text_t *)); |
|
|
725 | memmove (screen.rend + row1, screen.rend + row1 + count, i * sizeof (rend_t *)); |
|
|
726 | |
|
|
727 | j = row2 - count + 1, i = count; |
|
|
728 | } |
|
|
729 | else /* if (j < 0) */ |
|
|
730 | { |
|
|
731 | /* B: scroll down */ |
|
|
732 | |
|
|
733 | /* B1: Copy lines that will get clobbered by the rotation */ |
710 | for (i = 0, j = row1; i < count; i++, j++) |
734 | for (i = 0, j = row2; i < count; i++, j--) |
711 | { |
735 | { |
712 | buf_text[i] = screen.text[j]; |
736 | buf_text[i] = screen.text[j]; |
713 | buf_rend[i] = screen.rend[j]; |
737 | buf_rend[i] = screen.rend[j]; |
714 | } |
738 | } |
715 | |
739 | |
716 | /* A2: Rotate lines */ |
740 | /* B2: Rotate lines */ |
717 | for (j = row1, i = j + count; i <= row2; i++, j++) |
741 | for (j = row2, i = j - count; i >= row1; i--, j--) |
718 | { |
742 | { |
719 | screen.tlen[j] = screen.tlen[i]; |
743 | screen.tlen[j] = screen.tlen[i]; |
720 | screen.text[j] = screen.text[i]; |
744 | screen.text[j] = screen.text[i]; |
721 | screen.rend[j] = screen.rend[i]; |
745 | screen.rend[j] = screen.rend[i]; |
722 | } |
746 | } |
723 | |
747 | |
724 | j = row2 - count + 1, i = count; |
|
|
725 | } |
|
|
726 | else /* if (j < 0) */ |
|
|
727 | { |
|
|
728 | /* B: scroll down */ |
|
|
729 | |
|
|
730 | /* B1: Copy lines that will get clobbered by the rotation */ |
|
|
731 | for (i = 0, j = row2; i < count; i++, j--) |
|
|
732 | { |
|
|
733 | buf_text[i] = screen.text[j]; |
|
|
734 | buf_rend[i] = screen.rend[j]; |
|
|
735 | } |
|
|
736 | |
|
|
737 | /* B2: Rotate lines */ |
|
|
738 | for (j = row2, i = j - count; i >= row1; i--, j--) |
|
|
739 | { |
|
|
740 | screen.tlen[j] = screen.tlen[i]; |
|
|
741 | screen.text[j] = screen.text[i]; |
|
|
742 | screen.rend[j] = screen.rend[i]; |
|
|
743 | } |
|
|
744 | |
|
|
745 | j = row1, i = count; |
748 | j = row1, i = count; |
746 | count = -count; |
749 | count = -count; |
747 | } |
750 | } |
748 | |
751 | |
749 | /* C: Resurrect lines */ |
752 | /* C: Resurrect lines */ |
|
|
753 | memset (screen.tlen + j, 0, i * sizeof (int16_t)); |
|
|
754 | memcpy (screen.text + j, buf_text, i * sizeof (text_t *)); |
|
|
755 | memcpy (screen.rend + j, buf_rend, i * sizeof (text_t *)); |
|
|
756 | if (!spec) /* line length may not equal TermWin.ncol */ |
750 | for (; i--; j++) |
757 | for (; i--; j++) |
751 | { |
|
|
752 | screen.tlen[j] = 0; |
|
|
753 | screen.text[j] = buf_text[i]; |
|
|
754 | screen.rend[j] = buf_rend[i]; |
|
|
755 | |
|
|
756 | if (!spec) /* line length may not equal TermWin.ncol */ |
|
|
757 | scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); |
758 | scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); |
758 | } |
|
|
759 | |
759 | |
760 | return count; |
760 | return count; |
761 | } |
761 | } |
762 | |
762 | |
763 | /* ------------------------------------------------------------------------- */ |
763 | /* ------------------------------------------------------------------------- */ |
… | |
… | |
781 | |
781 | |
782 | D_SCREEN ((stderr, "rxvt_scr_add_lines (%d,%d)", nlines, len)); |
782 | D_SCREEN ((stderr, "rxvt_scr_add_lines (%d,%d)", nlines, len)); |
783 | ZERO_SCROLLBACK (); |
783 | ZERO_SCROLLBACK (); |
784 | if (nlines > 0) |
784 | if (nlines > 0) |
785 | { |
785 | { |
786 | nlines += (screen.cur.row - screen.bscroll); |
786 | nlines += screen.cur.row - screen.bscroll; |
787 | if ((nlines > 0) |
787 | if ((nlines > 0) |
788 | && (screen.tscroll == 0) |
788 | && (screen.tscroll == 0) |
789 | && (screen.bscroll == (TermWin.nrow - 1))) |
789 | && (screen.bscroll == (TermWin.nrow - 1))) |
790 | { |
790 | { |
791 | /* _at least_ this many lines need to be scrolled */ |
791 | /* _at least_ this many lines need to be scrolled */ |
792 | scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0); |
792 | scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0); |
793 | screen.cur.row -= nlines; |
793 | screen.cur.row -= nlines; |
794 | } |
794 | } |
795 | } |
795 | } |
|
|
796 | |
796 | #ifdef DEBUG_STRICT |
797 | #ifdef DEBUG_STRICT |
797 | assert (screen.cur.col < last_col); |
798 | assert (screen.cur.col < last_col); |
798 | assert ((screen.cur.row < TermWin.nrow) |
799 | assert ((screen.cur.row < TermWin.nrow) |
799 | && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); |
800 | && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); |
800 | #else /* drive with your eyes closed */ |
801 | #else /* drive with your eyes closed */ |
801 | MIN_IT (screen.cur.col, last_col - 1); |
802 | MIN_IT (screen.cur.col, last_col - 1); |
802 | MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); |
803 | MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); |
803 | MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); |
804 | MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); |
804 | #endif |
805 | #endif |
… | |
… | |
871 | scr_insdel_chars (1, INSERT); |
872 | scr_insdel_chars (1, INSERT); |
872 | |
873 | |
873 | // rely on wcwidth to tell us the character width, at least for non-latin1 |
874 | // rely on wcwidth to tell us the character width, at least for non-latin1 |
874 | // do wcwidth before further replacements, as wcwidth says that line-drawing |
875 | // do wcwidth before further replacements, as wcwidth says that line-drawing |
875 | // characters have width -1 (DOH!) on GNU/Linux sometimes. |
876 | // characters have width -1 (DOH!) on GNU/Linux sometimes. |
876 | int width = c < 256 ? 1 : wcwidth (c); |
877 | int width = c < 0x100 ? 1 : wcwidth (c); |
877 | |
878 | |
878 | if (charsets[screen.charset] == '0') // DEC SPECIAL |
879 | if (charsets[screen.charset] == '0') // DEC SPECIAL |
879 | { |
880 | { |
880 | // vt100 special graphics and line drawing |
881 | // vt100 special graphics and line drawing |
881 | static uint16_t vt100_0[32] = { // 5f .. 7e |
882 | static uint16_t vt100_0[32] = { // 5f .. 7e |
… | |
… | |
898 | // trim characters we can't store directly :( |
899 | // trim characters we can't store directly :( |
899 | if (c >= 0x10000) |
900 | if (c >= 0x10000) |
900 | c = rxvt_composite.compose (c); // map to lower 16 bits |
901 | c = rxvt_composite.compose (c); // map to lower 16 bits |
901 | #endif |
902 | #endif |
902 | bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0); |
903 | bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0); |
903 | rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c, bold)); |
904 | rend_t rend = SET_FONT (rstyle, |
|
|
905 | c > 0x7f || bold || c < 0x20 |
|
|
906 | ? TermWin.fontset->find_font (c, bold) |
|
|
907 | : TermWin.ascii_map [c - 0x20]); |
904 | |
908 | |
905 | do |
909 | do |
906 | { |
910 | { |
907 | stp[screen.cur.col] = c; |
911 | stp[screen.cur.col] = c; |
908 | srp[screen.cur.col] = rend; |
912 | srp[screen.cur.col] = rend; |
… | |
… | |
1289 | break; |
1293 | break; |
1290 | default: |
1294 | default: |
1291 | return; |
1295 | return; |
1292 | } |
1296 | } |
1293 | |
1297 | |
1294 | refresh_type |= REFRESH_BOUNDS; |
|
|
1295 | |
|
|
1296 | if (selection.op && current_screen == selection.screen |
1298 | if (selection.op && current_screen == selection.screen |
1297 | && ((selection.beg.row >= row && selection.beg.row <= row + num) |
1299 | && ((selection.beg.row >= row && selection.beg.row <= row + num) |
1298 | || (selection.end.row >= row |
1300 | || (selection.end.row >= row |
1299 | && selection.end.row <= row + num))) |
1301 | && selection.end.row <= row + num))) |
1300 | CLEAR_SELECTION (); |
1302 | CLEAR_SELECTION (); |
… | |
… | |
1747 | row_col_t rc[RC_COUNT]; |
1749 | row_col_t rc[RC_COUNT]; |
1748 | |
1750 | |
1749 | if (drawn_text == NULL) /* sanity check */ |
1751 | if (drawn_text == NULL) /* sanity check */ |
1750 | return; |
1752 | return; |
1751 | |
1753 | |
|
|
1754 | #ifndef NO_SLOW_LINK_SUPPORT |
|
|
1755 | if (refresh_type == FAST_REFRESH && !display->is_local) |
|
|
1756 | { |
|
|
1757 | y = 0; |
|
|
1758 | height = TermWin.height; |
|
|
1759 | } |
|
|
1760 | #endif |
|
|
1761 | |
1752 | #ifdef DEBUG_STRICT |
1762 | #ifdef DEBUG_STRICT |
1753 | x = max (x, 0); |
1763 | x = max (x, 0); |
1754 | x = min (x, (int)TermWin.width); |
1764 | x = min (x, (int)TermWin.width); |
1755 | y = max (y, 0); |
1765 | y = max (y, 0); |
1756 | y = min (y, (int)TermWin.height); |
1766 | y = min (y, (int)TermWin.height); |
… | |
… | |
1774 | |
1784 | |
1775 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1785 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1776 | fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); |
1786 | fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); |
1777 | |
1787 | |
1778 | if (refresh) |
1788 | if (refresh) |
1779 | scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); |
1789 | scr_refresh (SLOW_REFRESH); |
1780 | } |
1790 | } |
1781 | |
1791 | |
1782 | /* ------------------------------------------------------------------------- */ |
1792 | /* ------------------------------------------------------------------------- */ |
1783 | /* |
1793 | /* |
1784 | * Refresh the entire screen |
1794 | * Refresh the entire screen |
… | |
… | |
1819 | * direction should be UP or DN |
1829 | * direction should be UP or DN |
1820 | */ |
1830 | */ |
1821 | int |
1831 | int |
1822 | rxvt_term::scr_page (enum page_dirn direction, int nlines) |
1832 | rxvt_term::scr_page (enum page_dirn direction, int nlines) |
1823 | { |
1833 | { |
1824 | int n; |
1834 | int n; |
1825 | uint16_t oldviewstart; |
1835 | uint16_t oldviewstart; |
1826 | |
1836 | |
1827 | D_SCREEN ((stderr, "rxvt_scr_page (%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); |
1837 | D_SCREEN ((stderr, "rxvt_scr_page (%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); |
1828 | #ifdef DEBUG_STRICT |
1838 | #ifdef DEBUG_STRICT |
1829 | assert ((nlines >= 0) && (nlines <= TermWin.nrow)); |
1839 | assert ((nlines >= 0) && (nlines <= TermWin.nrow)); |
1830 | #endif |
1840 | #endif |
… | |
… | |
1926 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1936 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1927 | |
1937 | |
1928 | void |
1938 | void |
1929 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1939 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1930 | { |
1940 | { |
1931 | unsigned char clearfirst, /* first character writes before cell */ |
|
|
1932 | clearlast, /* last character writes beyond cell */ |
|
|
1933 | must_clear, /* use draw_string not draw_image_string */ |
1941 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1934 | rvid, /* reverse video this position */ |
1942 | rvid, /* reverse video this position */ |
1935 | showcursor; /* show the cursor */ |
1943 | showcursor; /* show the cursor */ |
1936 | int16_t col, row, /* column/row we're processing */ |
1944 | int16_t col, row, /* column/row we're processing */ |
1937 | ocrow; /* old cursor row */ |
1945 | ocrow; /* old cursor row */ |
1938 | int i, /* tmp */ |
1946 | int i, /* tmp */ |
… | |
… | |
1947 | return; |
1955 | return; |
1948 | |
1956 | |
1949 | /* |
1957 | /* |
1950 | * A: set up vars |
1958 | * A: set up vars |
1951 | */ |
1959 | */ |
1952 | clearfirst = clearlast = must_clear = 0; |
1960 | must_clear = 0; |
1953 | |
1961 | |
1954 | refresh_count = 0; |
1962 | refresh_count = 0; |
1955 | |
1963 | |
1956 | row_offset = TermWin.saveLines - TermWin.view_start; |
1964 | row_offset = TermWin.saveLines - TermWin.view_start; |
1957 | |
|
|
1958 | if ((refresh_type & REFRESH_BOUNDS)) |
|
|
1959 | { |
|
|
1960 | clearfirst = clearlast = 1; |
|
|
1961 | refresh_type &= ~REFRESH_BOUNDS; |
|
|
1962 | } |
|
|
1963 | |
1965 | |
1964 | #ifdef XPM_BACKGROUND |
1966 | #ifdef XPM_BACKGROUND |
1965 | must_clear |= (bgPixmap.pixmap != None); |
1967 | must_clear |= (bgPixmap.pixmap != None); |
1966 | #endif |
1968 | #endif |
1967 | #ifdef TRANSPARENT |
1969 | #ifdef TRANSPARENT |
… | |
… | |
2055 | /* |
2057 | /* |
2056 | * D: CopyArea pass - very useful for slower links |
2058 | * D: CopyArea pass - very useful for slower links |
2057 | * This has been deliberately kept simple. |
2059 | * This has been deliberately kept simple. |
2058 | */ |
2060 | */ |
2059 | i = num_scr; |
2061 | i = num_scr; |
|
|
2062 | if (!display->is_local |
2060 | if (refresh_type == FAST_REFRESH && num_scr_allow && i |
2063 | && refresh_type == FAST_REFRESH && num_scr_allow && i |
2061 | && abs (i) < TermWin.nrow && !must_clear) |
2064 | && abs (i) < TermWin.nrow && !must_clear) |
2062 | { |
2065 | { |
2063 | int16_t nits; |
2066 | int16_t nits; |
2064 | int j; |
2067 | int j; |
2065 | rend_t *drp2; |
2068 | rend_t *drp2; |
… | |
… | |
2235 | back = Color_RV; |
2238 | back = Color_RV; |
2236 | #endif |
2239 | #endif |
2237 | } |
2240 | } |
2238 | |
2241 | |
2239 | #ifdef TEXT_BLINK |
2242 | #ifdef TEXT_BLINK |
2240 | if (rend & RS_Blink && back == Color_bg) |
2243 | if (rend & RS_Blink && (back == Color_bg || fore == Color_bg)) |
2241 | { |
2244 | { |
2242 | if (!text_blink_ev.active) |
2245 | if (!text_blink_ev.active) |
2243 | { |
2246 | { |
2244 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
2247 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
2245 | hidden_text = 0; |
2248 | hidden_text = 0; |
… | |
… | |
2275 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2278 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2276 | } |
2279 | } |
2277 | else |
2280 | else |
2278 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2281 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2279 | |
2282 | |
2280 | if ((rend & RS_Uline) && (font->descent > 1)) |
2283 | if (rend & RS_Uline && font->descent > 1 && fore != back) |
2281 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2284 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2282 | xpixel, ypixel + font->ascent + 1, |
2285 | xpixel, ypixel + font->ascent + 1, |
2283 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2286 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2284 | } /* for (col....) */ |
2287 | } /* for (col....) */ |
2285 | } /* for (row....) */ |
2288 | } /* for (row....) */ |
… | |
… | |
2320 | /* |
2323 | /* |
2321 | * H: cleanup selection |
2324 | * H: cleanup selection |
2322 | */ |
2325 | */ |
2323 | scr_reverse_selection (); |
2326 | scr_reverse_selection (); |
2324 | |
2327 | |
2325 | /* |
|
|
2326 | * I: other general cleanup |
|
|
2327 | */ |
|
|
2328 | #if 0 |
|
|
2329 | if (clearfirst && TermWin.int_bwidth) |
|
|
2330 | /* |
|
|
2331 | * clear the whole screen height, note that width == 0 is treated |
|
|
2332 | * specially by XClearArea |
|
|
2333 | */ |
|
|
2334 | XClearArea (display->display, TermWin.vt, 0, 0, |
|
|
2335 | (unsigned int)TermWin.int_bwidth, |
|
|
2336 | (unsigned int)TermWin_TotalHeight (), False); |
|
|
2337 | |
|
|
2338 | if (clearlast && TermWin.int_bwidth) |
|
|
2339 | /* |
|
|
2340 | * clear the whole screen height, note that width == 0 is treated |
|
|
2341 | * specially by XClearArea |
|
|
2342 | */ |
|
|
2343 | XClearArea (display->display, TermWin.vt, |
|
|
2344 | TermWin.width + TermWin.int_bwidth, 0, |
|
|
2345 | (unsigned int)TermWin.int_bwidth, |
|
|
2346 | (unsigned int)TermWin_TotalHeight (), False); |
|
|
2347 | #endif |
|
|
2348 | |
|
|
2349 | if (refresh_type & SMOOTH_REFRESH) |
2328 | if (refresh_type & SMOOTH_REFRESH) |
2350 | XSync (display->display, False); |
2329 | XFlush (display->display); |
2351 | |
2330 | |
2352 | num_scr = 0; |
2331 | num_scr = 0; |
2353 | num_scr_allow = 1; |
2332 | num_scr_allow = 1; |
2354 | want_refresh = 0; /* screen is current */ |
2333 | want_refresh = 0; /* screen is current */ |
2355 | } |
2334 | } |
… | |
… | |
2588 | if (ct.encoding == 0) |
2567 | if (ct.encoding == 0) |
2589 | { |
2568 | { |
2590 | D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); |
2569 | D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); |
2591 | break; |
2570 | break; |
2592 | } |
2571 | } |
|
|
2572 | else if (ct.encoding == xa[XA_INCR]) |
|
|
2573 | { |
|
|
2574 | // INCR selection, start handshake |
|
|
2575 | XDeleteProperty (display->display, win, prop); |
|
|
2576 | selection_wait = Sel_incr; |
|
|
2577 | incr_ev.start (NOW + 10); |
|
|
2578 | break; |
|
|
2579 | } |
2593 | |
2580 | |
2594 | if (ct.value == NULL) |
2581 | if (ct.value == NULL) |
2595 | { |
2582 | { |
2596 | D_SELECT ((stderr, "rxvt_selection_paste: property shooting blanks!")); |
2583 | D_SELECT ((stderr, "rxvt_selection_paste: property shooting blanks!")); |
2597 | continue; |
2584 | continue; |
… | |
… | |
2658 | * INCR support originally provided by Paul Sheer <psheer@obsidian.co.za> |
2645 | * INCR support originally provided by Paul Sheer <psheer@obsidian.co.za> |
2659 | */ |
2646 | */ |
2660 | void |
2647 | void |
2661 | rxvt_term::selection_property (Window win, Atom prop) |
2648 | rxvt_term::selection_property (Window win, Atom prop) |
2662 | { |
2649 | { |
2663 | int reget_time = 0; |
2650 | if (prop == None || selection_wait != Sel_incr) |
2664 | |
|
|
2665 | if (prop == None) |
|
|
2666 | return; |
2651 | return; |
2667 | |
2652 | |
2668 | D_SELECT ((stderr, "rxvt_selection_property (%08lx, %lu)", win, (unsigned long)prop)); |
|
|
2669 | if (selection_wait == Sel_normal) |
|
|
2670 | { |
|
|
2671 | int a, afmt; |
|
|
2672 | Atom atype; |
|
|
2673 | unsigned long bytes_after, nitems; |
|
|
2674 | unsigned char *s = NULL; |
|
|
2675 | |
|
|
2676 | a = XGetWindowProperty (display->display, win, prop, 0L, 1L, False, |
|
|
2677 | xa[XA_INCR], &atype, &afmt, &nitems, |
|
|
2678 | &bytes_after, &s); |
|
|
2679 | if (s) |
|
|
2680 | XFree (s); |
|
|
2681 | if (a != Success) |
|
|
2682 | return; |
|
|
2683 | |
|
|
2684 | #ifndef __CYGWIN32__ |
|
|
2685 | if (atype == xa[XA_INCR]) |
|
|
2686 | { /* start an INCR transfer */ |
|
|
2687 | D_SELECT ((stderr, "rxvt_selection_property: INCR: starting transfer")); |
|
|
2688 | XDeleteProperty (display->display, win, prop); |
|
|
2689 | XFlush (display->display); |
|
|
2690 | reget_time = 1; |
|
|
2691 | selection_wait = Sel_incr; |
|
|
2692 | } |
|
|
2693 | #endif |
|
|
2694 | |
|
|
2695 | } |
|
|
2696 | else if (selection_wait == Sel_incr) |
|
|
2697 | { |
|
|
2698 | reget_time = 1; |
|
|
2699 | |
|
|
2700 | if (selection_paste (win, prop, True) == -1) |
2653 | if (selection_paste (win, prop, 1) > 0) |
2701 | { |
|
|
2702 | D_SELECT ((stderr, "rxvt_selection_property: INCR: clean end")); |
|
|
2703 | selection_wait = Sel_none; |
|
|
2704 | incr_ev.stop (); |
|
|
2705 | } |
|
|
2706 | } |
|
|
2707 | if (reget_time) /* received more data so reget time */ |
|
|
2708 | incr_ev.start (NOW + 10); |
2654 | incr_ev.start (NOW + 10); |
|
|
2655 | else |
|
|
2656 | { |
|
|
2657 | selection_wait = Sel_none; |
|
|
2658 | incr_ev.stop (); |
|
|
2659 | } |
2709 | } |
2660 | } |
2710 | |
2661 | |
2711 | /* ------------------------------------------------------------------------- */ |
2662 | /* ------------------------------------------------------------------------- */ |
2712 | /* |
2663 | /* |
2713 | * Request the current selection: |
2664 | * Request the current selection: |
… | |
… | |
3418 | (8 * sizeof (target_list[0])), PropModeReplace, |
3369 | (8 * sizeof (target_list[0])), PropModeReplace, |
3419 | (unsigned char *)target_list, |
3370 | (unsigned char *)target_list, |
3420 | target - target_list); |
3371 | target - target_list); |
3421 | ev.property = rq.property; |
3372 | ev.property = rq.property; |
3422 | } |
3373 | } |
|
|
3374 | #if TODO // TODO |
3423 | else if (rq.target == xa[XA_MULTIPLE]) |
3375 | else if (rq.target == xa[XA_MULTIPLE]) |
3424 | { |
3376 | { |
3425 | /* TODO: Handle MULTIPLE */ |
3377 | /* TODO: Handle MULTIPLE */ |
3426 | } |
3378 | } |
|
|
3379 | #endif |
3427 | else if (rq.target == xa[XA_TIMESTAMP] && selection.text) |
3380 | else if (rq.target == xa[XA_TIMESTAMP] && selection.text) |
3428 | { |
3381 | { |
3429 | XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER, |
3382 | XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER, |
3430 | (8 * sizeof (Time)), PropModeReplace, |
3383 | (8 * sizeof (Time)), PropModeReplace, |
3431 | (unsigned char *)&selection_time, 1); |
3384 | (unsigned char *)&selection_time, 1); |