ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.10 by pcg, Thu Dec 18 08:06:46 2003 UTC vs.
Revision 1.11 by pcg, Thu Dec 18 13:33:03 2003 UTC

1/*--------------------------------*-C-*--------------------------------------* 1/*--------------------------------*-C-*--------------------------------------*
2 * File: screen.c 2 * File: screen.c
3 *---------------------------------------------------------------------------* 3 *---------------------------------------------------------------------------*
4 * $Id: screen.C,v 1.10 2003/12/18 08:06:46 pcg Exp $ 4 * $Id: screen.C,v 1.11 2003/12/18 13:33:03 pcg Exp $
5 * 5 *
6 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 6 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
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
89/* 89/*
90 * CLEAR_ROWS : clear <num> rows starting from row <row> 90 * CLEAR_ROWS : clear <num> rows starting from row <row>
91 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> 91 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
92 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour 92 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
93 */ 93 */
94#define drawBuffer (R->TermWin.vt) 94#define drawBuffer TermWin.vt
95 95
96#define CLEAR_ROWS(row, num) \ 96#define CLEAR_ROWS(row, num) \
97 if (R->TermWin.mapped) \ 97 if (TermWin.mapped) \
98 XClearArea(R->Xdisplay, drawBuffer, R->TermWin.int_bwidth, \ 98 XClearArea (Xdisplay, drawBuffer, TermWin.int_bwidth, \
99 Row2Pixel(row), (unsigned int)R->TermWin.width, \ 99 Row2Pixel(row), (unsigned int)TermWin.width, \
100 (unsigned int)Height2Pixel(num), False) 100 (unsigned int)Height2Pixel(num), False)
101 101
102#define CLEAR_CHARS(x, y, num) \ 102#define CLEAR_CHARS(x, y, num) \
103 if (R->TermWin.mapped) \ 103 if (TermWin.mapped) \
104 XClearArea(R->Xdisplay, drawBuffer, x, y, \ 104 XClearArea (Xdisplay, drawBuffer, x, y, \
105 (unsigned int)Width2Pixel(num), \ 105 (unsigned int)Width2Pixel(num), \
106 (unsigned int)Height2Pixel(1), False) 106 (unsigned int)Height2Pixel(1), False)
107 107
108#define ERASE_ROWS(row, num) \ 108#define ERASE_ROWS(row, num) \
109 XFillRectangle(R->Xdisplay, drawBuffer, R->TermWin.gc, \ 109 XFillRectangle (Xdisplay, drawBuffer, TermWin.gc, \
110 R->TermWin.int_bwidth, Row2Pixel(row), \ 110 TermWin.int_bwidth, Row2Pixel(row), \
111 (unsigned int)R->TermWin.width, \ 111 (unsigned int)TermWin.width, \
112 (unsigned int)Height2Pixel(num)) 112 (unsigned int)Height2Pixel(num))
113 113
114/* ------------------------------------------------------------------------- * 114/* ------------------------------------------------------------------------- *
115 * SCREEN `COMMON' ROUTINES * 115 * SCREEN `COMMON' ROUTINES *
116 * ------------------------------------------------------------------------- */ 116 * ------------------------------------------------------------------------- */
117/* Fill part/all of a line with blanks. */ 117/* Fill part/all of a line with blanks. */
485 485
486 R->scr_release (); 486 R->scr_release ();
487 R->prev_nrow = R->prev_ncol = 0; 487 R->prev_nrow = R->prev_ncol = 0;
488 R->scr_reset (); 488 R->scr_reset ();
489 489
490 rxvt_scr_clear (aR); 490 R->scr_clear ();
491 rxvt_scr_refresh (aR_ SLOW_REFRESH); 491 R->scr_refresh (SLOW_REFRESH);
492#ifdef RXVT_GRAPHICS 492#ifdef RXVT_GRAPHICS
493 rxvt_Gr_reset (aR); 493 rxvt_Gr_reset (aR);
494#endif 494#endif
495} 495}
496 496
1211 * Erase part of whole of the screen 1211 * Erase part of whole of the screen
1212 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J 1212 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J
1213 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J 1213 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J
1214 * XTERM_SEQ: Clear whole screen : ESC [ 2 J 1214 * XTERM_SEQ: Clear whole screen : ESC [ 2 J
1215 */ 1215 */
1216/* EXTPROTO */
1217void 1216void
1218rxvt_scr_erase_screen(pR_ int mode) 1217rxvt_term::scr_erase_screen (int mode)
1219{ 1218{
1220 int num; 1219 int num;
1221 int32_t row, row_offset; 1220 int32_t row, row_offset;
1222 rend_t ren; 1221 rend_t ren;
1223 XGCValues gcvalue; 1222 XGCValues gcvalue;
1224 1223
1225 R->want_refresh = 1; 1224 want_refresh = 1;
1226 D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, R->screen.cur.row)); 1225 D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, screen.cur.row));
1227 ZERO_SCROLLBACK(R); 1226 ZERO_SCROLLBACK(this);
1228 row_offset = (int32_t)R->TermWin.saveLines; 1227 row_offset = (int32_t)TermWin.saveLines;
1229 1228
1230 switch (mode) { 1229 switch (mode) {
1231 case 0: /* erase to end of screen */ 1230 case 0: /* erase to end of screen */
1232 rxvt_selection_check(aR_ 1); 1231 rxvt_selection_check(this,1);
1233 rxvt_scr_erase_line(aR_ 0); 1232 rxvt_scr_erase_line(this,0);
1234 row = R->screen.cur.row + 1; /* possible OOB */ 1233 row = screen.cur.row + 1; /* possible OOB */
1235 num = R->TermWin.nrow - row; 1234 num = TermWin.nrow - row;
1236 break; 1235 break;
1237 case 1: /* erase to beginning of screen */ 1236 case 1: /* erase to beginning of screen */
1238 rxvt_selection_check(aR_ 3); 1237 rxvt_selection_check(this,3);
1239 rxvt_scr_erase_line(aR_ 1); 1238 rxvt_scr_erase_line(this,1);
1240 row = 0; 1239 row = 0;
1241 num = R->screen.cur.row; 1240 num = screen.cur.row;
1242 break; 1241 break;
1243 case 2: /* erase whole screen */ 1242 case 2: /* erase whole screen */
1244 rxvt_selection_check(aR_ 3); 1243 rxvt_selection_check (this, 3);
1245#ifdef RXVT_GRAPHICS 1244#ifdef RXVT_GRAPHICS
1246 rxvt_Gr_ClearScreen(aR); 1245 rxvt_Gr_ClearScreen (this);
1247#endif 1246#endif
1248 row = 0; 1247 row = 0;
1249 num = R->TermWin.nrow; 1248 num = TermWin.nrow;
1250 break; 1249 break;
1251 default: 1250 default:
1252 return; 1251 return;
1253 } 1252 }
1254 R->refresh_type |= REFRESH_BOUNDS; 1253 refresh_type |= REFRESH_BOUNDS;
1255 if (R->selection.op && R->current_screen == R->selection.screen 1254 if (selection.op && current_screen == selection.screen
1256 && ((R->selection.beg.row >= row && R->selection.beg.row <= row + num) 1255 && ((selection.beg.row >= row && selection.beg.row <= row + num)
1257 || (R->selection.end.row >= row 1256 || (selection.end.row >= row
1258 && R->selection.end.row <= row + num))) 1257 && selection.end.row <= row + num)))
1259 CLEAR_SELECTION(R); 1258 CLEAR_SELECTION (this);
1260 if (row >= R->TermWin.nrow) /* Out Of Bounds */ 1259 if (row >= TermWin.nrow) /* Out Of Bounds */
1261 return; 1260 return;
1262 MIN_IT(num, (R->TermWin.nrow - row)); 1261 MIN_IT(num, (TermWin.nrow - row));
1263 if (R->rstyle & (RS_RVid | RS_Uline)) 1262 if (rstyle & (RS_RVid | RS_Uline))
1264 ren = (rend_t) ~RS_None; 1263 ren = (rend_t) ~RS_None;
1265 else if (GET_BASEBG(R->rstyle) == Color_bg) { 1264 else if (GET_BASEBG(rstyle) == Color_bg) {
1266 ren = DEFAULT_RSTYLE; 1265 ren = DEFAULT_RSTYLE;
1267 CLEAR_ROWS(row, num); 1266 CLEAR_ROWS(row, num);
1268 } else { 1267 } else {
1269 ren = (R->rstyle & (RS_fgMask | RS_bgMask)); 1268 ren = (rstyle & (RS_fgMask | RS_bgMask));
1270 gcvalue.foreground = R->PixColors[GET_BGCOLOR(R->rstyle)]; 1269 gcvalue.foreground = PixColors[GET_BGCOLOR(rstyle)];
1271 XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue); 1270 XChangeGC(Xdisplay, TermWin.gc, GCForeground, &gcvalue);
1272 ERASE_ROWS(row, num); 1271 ERASE_ROWS(row, num);
1273 gcvalue.foreground = R->PixColors[Color_fg]; 1272 gcvalue.foreground = PixColors[Color_fg];
1274 XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue); 1273 XChangeGC(Xdisplay, TermWin.gc, GCForeground, &gcvalue);
1275 } 1274 }
1276 for (; num--; row++) { 1275 for (; num--; row++) {
1277 R->scr_blank_screen_mem (R->screen.text, R->screen.rend, 1276 scr_blank_screen_mem (screen.text, screen.rend,
1278 (unsigned int)(row + row_offset), R->rstyle); 1277 (unsigned int)(row + row_offset), rstyle);
1279 R->screen.tlen[row + row_offset] = 0; 1278 screen.tlen[row + row_offset] = 0;
1280 R->scr_blank_line (R->drawn_text[row], R->drawn_rend[row], 1279 scr_blank_line (drawn_text[row], drawn_rend[row],
1281 (unsigned int)R->TermWin.ncol, ren); 1280 (unsigned int)TermWin.ncol, ren);
1282 } 1281 }
1283} 1282}
1284 1283
1285/* ------------------------------------------------------------------------- */ 1284/* ------------------------------------------------------------------------- */
1286/* 1285/*
1570 1569
1571 gcvalue.foreground = R->PixColors[Color_fg]; 1570 gcvalue.foreground = R->PixColors[Color_fg];
1572 gcvalue.background = R->PixColors[Color_bg]; 1571 gcvalue.background = R->PixColors[Color_bg];
1573 XChangeGC(R->Xdisplay, R->TermWin.gc, GCBackground | GCForeground, 1572 XChangeGC(R->Xdisplay, R->TermWin.gc, GCBackground | GCForeground,
1574 &gcvalue); 1573 &gcvalue);
1575 rxvt_scr_clear(aR); 1574 R->scr_clear ();
1576 rxvt_scr_touch(aR_ True); 1575 R->scr_touch (true);
1577 } 1576 }
1578} 1577}
1579 1578
1580/* ------------------------------------------------------------------------- */ 1579/* ------------------------------------------------------------------------- */
1581/* 1580/*
1684 PART_BEG = 0, 1683 PART_BEG = 0,
1685 PART_END, 1684 PART_END,
1686 RC_COUNT 1685 RC_COUNT
1687}; 1686};
1688 1687
1689/* EXTPROTO */
1690void 1688void
1691rxvt_scr_expose(pR_ int x, int y, int width, int height, Bool refresh) 1689rxvt_term::scr_expose (int x, int y, int width, int height, bool refresh)
1692{ 1690{
1693 int i; 1691 int i;
1694 row_col_t rc[RC_COUNT]; 1692 row_col_t rc[RC_COUNT];
1695 1693
1696 if (R->drawn_text == NULL) /* sanity check */ 1694 if (drawn_text == NULL) /* sanity check */
1697 return; 1695 return;
1698 1696
1699#ifdef DEBUG_STRICT 1697#ifdef DEBUG_STRICT
1700 x = max(x, (int)R->TermWin.int_bwidth); 1698 x = max(x, (int)TermWin.int_bwidth);
1701 x = min(x, (int)R->TermWin.width); 1699 x = min(x, (int)TermWin.width);
1702 y = max(y, (int)R->TermWin.int_bwidth); 1700 y = max(y, (int)TermWin.int_bwidth);
1703 y = min(y, (int)R->TermWin.height); 1701 y = min(y, (int)TermWin.height);
1704#endif 1702#endif
1705 1703
1706/* round down */ 1704/* round down */
1707 rc[PART_BEG].col = Pixel2Col(x); 1705 rc[PART_BEG].col = Pixel2Col(x);
1708 rc[PART_BEG].row = Pixel2Row(y); 1706 rc[PART_BEG].row = Pixel2Row(y);
1709/* round up */ 1707/* round up */
1710 rc[PART_END].col = Pixel2Width(x + width + R->TermWin.fwidth - 1); 1708 rc[PART_END].col = Pixel2Width(x + width + TermWin.fwidth - 1);
1711 rc[PART_END].row = Pixel2Row(y + height + R->TermWin.fheight - 1); 1709 rc[PART_END].row = Pixel2Row(y + height + TermWin.fheight - 1);
1712 1710
1713/* sanity checks */ 1711/* sanity checks */
1714 for (i = PART_BEG; i < RC_COUNT; i++) { 1712 for (i = PART_BEG; i < RC_COUNT; i++)
1713 {
1715 MIN_IT(rc[i].col, R->TermWin.ncol - 1); 1714 MIN_IT(rc[i].col, TermWin.ncol - 1);
1716 MIN_IT(rc[i].row, R->TermWin.nrow - 1); 1715 MIN_IT(rc[i].row, TermWin.nrow - 1);
1717 } 1716 }
1718 1717
1719 D_SCREEN((stderr, "rxvt_scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); 1718 D_SCREEN((stderr, "rxvt_scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row));
1720 1719
1721 for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) 1720 for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++)
1722 fill_text (&(R->drawn_text[i][rc[PART_BEG].col]), 0, 1721 fill_text (&(drawn_text[i][rc[PART_BEG].col]), 0,
1723 (rc[PART_END].col - rc[PART_BEG].col + 1)); 1722 (rc[PART_END].col - rc[PART_BEG].col + 1));
1724 1723
1725 if (refresh) 1724 if (refresh)
1726 rxvt_scr_refresh(aR_ SLOW_REFRESH | REFRESH_BOUNDS); 1725 scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS);
1727} 1726}
1728 1727
1729/* ------------------------------------------------------------------------- */ 1728/* ------------------------------------------------------------------------- */
1730/* 1729/*
1731 * Refresh the entire screen 1730 * Refresh the entire screen
1732 */ 1731 */
1733/* EXTPROTO */
1734void 1732void
1735rxvt_scr_touch(pR_ Bool refresh) 1733rxvt_term::scr_touch (bool refresh)
1736{ 1734{
1737 rxvt_scr_expose(aR_ 0, 0, R->TermWin.width, R->TermWin.height, refresh); 1735 scr_expose (0, 0, TermWin.width, TermWin.height, refresh);
1738} 1736}
1739 1737
1740/* ------------------------------------------------------------------------- */ 1738/* ------------------------------------------------------------------------- */
1741/* 1739/*
1742 * Move the display so that the line represented by scrollbar value Y is at 1740 * Move the display so that the line represented by scrollbar value Y is at
1879#define FONT_LBEAR(X, Y) \ 1877#define FONT_LBEAR(X, Y) \
1880 (X)->per_char[(Y) - (X)->min_char_or_byte2].lbearing 1878 (X)->per_char[(Y) - (X)->min_char_or_byte2].lbearing
1881#define IS_FONT_CHAR(X, Y) \ 1879#define IS_FONT_CHAR(X, Y) \
1882 ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) 1880 ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2)
1883 1881
1884/* EXTPROTO */
1885void 1882void
1886rxvt_scr_refresh(pR_ unsigned char refresh_type) 1883rxvt_term::scr_refresh (unsigned char refresh_type)
1887{ 1884{
1888 unsigned char clearfirst, /* first character writes before cell */ 1885 unsigned char clearfirst, /* first character writes before cell */
1889 clearlast, /* last character writes beyond cell */ 1886 clearlast, /* last character writes beyond cell */
1890 must_clear, /* use draw_string not draw_image_string */ 1887 must_clear, /* use draw_string not draw_image_string */
1891#ifndef NO_BOLDFONT 1888#ifndef NO_BOLDFONT
1904 rend_t cc1; /* store colours at cursor position(s) */ 1901 rend_t cc1; /* store colours at cursor position(s) */
1905 rend_t cc2; /* store colours at cursor position(s) */ 1902 rend_t cc2; /* store colours at cursor position(s) */
1906#endif 1903#endif
1907 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ 1904 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */
1908 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ 1905 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */
1909 char *buffer; /* local copy of R->buffer */ 1906 char *buffer; /* local copy of buffer */
1910 1907
1911 if (refresh_type == NO_REFRESH || !R->TermWin.mapped) 1908 if (refresh_type == NO_REFRESH || !TermWin.mapped)
1912 return; 1909 return;
1913 1910
1914 /* 1911 /*
1915 * A: set up vars 1912 * A: set up vars
1916 */ 1913 */
1917 clearfirst = clearlast = must_clear = wbyte = 0; 1914 clearfirst = clearlast = must_clear = wbyte = 0;
1918#ifndef NO_BOLDFONT 1915#ifndef NO_BOLDFONT
1919 bfont = 0; 1916 bfont = 0;
1920#endif 1917#endif
1921 1918
1922 if (R->currmaxcol < R->TermWin.ncol) 1919 if (currmaxcol < TermWin.ncol)
1923 { 1920 {
1924 R->currmaxcol = R->TermWin.ncol; 1921 currmaxcol = TermWin.ncol;
1925 R->buffer = (char *)rxvt_realloc (R->buffer, 1922 buffer = (char *)rxvt_realloc (buffer,
1926 sizeof(char) * (R->currmaxcol + 1) * MB_CUR_MAX); 1923 sizeof(char) * (currmaxcol + 1) * MB_CUR_MAX);
1927 } 1924 }
1928 1925
1929 buffer = R->buffer; 1926 buffer = buffer;
1930 R->refresh_count = 0; 1927 refresh_count = 0;
1931 1928
1932 row_offset = R->TermWin.saveLines - R->TermWin.view_start; 1929 row_offset = TermWin.saveLines - TermWin.view_start;
1933 1930
1934 if ((refresh_type & REFRESH_BOUNDS)) 1931 if ((refresh_type & REFRESH_BOUNDS))
1935 { 1932 {
1936 clearfirst = clearlast = 1; 1933 clearfirst = clearlast = 1;
1937 R->refresh_type &= ~REFRESH_BOUNDS; 1934 refresh_type &= ~REFRESH_BOUNDS;
1938 } 1935 }
1939 1936
1940#if defined(XPM_BACKGROUND) 1937#if defined(XPM_BACKGROUND)
1941 must_clear |= (R->bgPixmap.pixmap != None); 1938 must_clear |= (bgPixmap.pixmap != None);
1942#endif 1939#endif
1943#if defined(TRANSPARENT) 1940#if defined(TRANSPARENT)
1944 must_clear |= ((R->Options & Opt_transparent) && R->am_transparent); 1941 must_clear |= ((Options & Opt_transparent) && am_transparent);
1945#endif 1942#endif
1946 ocrow = R->oldcursor.row; /* is there an old outline cursor on screen? */ 1943 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
1947 1944
1948/* 1945/*
1949 * B: reverse any characters which are selected 1946 * B: reverse any characters which are selected
1950 */ 1947 */
1951 rxvt_scr_reverse_selection(aR); 1948 rxvt_scr_reverse_selection (this);
1952 1949
1953/* 1950/*
1954 * C: set the cursor character(s) 1951 * C: set the cursor character(s)
1955 */ 1952 */
1956 { 1953 {
1957 unsigned char setoldcursor; 1954 unsigned char setoldcursor;
1958 rend_t ccol1, /* Cursor colour */ 1955 rend_t ccol1, /* Cursor colour */
1959 ccol2; /* Cursor colour2 */ 1956 ccol2; /* Cursor colour2 */
1960 1957
1961 showcursor = (R->screen.flags & Screen_VisibleCursor); 1958 showcursor = (screen.flags & Screen_VisibleCursor);
1962 cursorwidth = 0; 1959 cursorwidth = 0;
1963#ifdef CURSOR_BLINK 1960#ifdef CURSOR_BLINK
1964 if (R->hidden_cursor) 1961 if (hidden_cursor)
1965 showcursor = 0; 1962 showcursor = 0;
1966#endif 1963#endif
1967 1964
1968 cursorwidth = 0; 1965 cursorwidth = 0;
1969 1966
1970 if (showcursor) 1967 if (showcursor)
1971 { 1968 {
1972 cursorwidth++; 1969 cursorwidth++;
1973 1970
1974 srp = &(R->screen.rend[R->screen.cur.row + R->TermWin.saveLines] 1971 srp = &(screen.rend[screen.cur.row + TermWin.saveLines]
1975 [R->screen.cur.col]); 1972 [screen.cur.col]);
1976 1973
1977 if (showcursor && R->TermWin.focus) 1974 if (showcursor && TermWin.focus)
1978 { 1975 {
1979 *srp ^= RS_RVid; 1976 *srp ^= RS_RVid;
1980#ifndef NO_CURSORCOLOR 1977#ifndef NO_CURSORCOLOR
1981 cc1 = *srp & (RS_fgMask | RS_bgMask); 1978 cc1 = *srp & (RS_fgMask | RS_bgMask);
1982 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor)) 1979 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_cursor))
1983 ccol1 = Color_cursor; 1980 ccol1 = Color_cursor;
1984 else 1981 else
1985#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 1982#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1986 ccol1 = GET_FGCOLOR(R->rstyle); 1983 ccol1 = GET_FGCOLOR(rstyle);
1987#else 1984#else
1988 ccol1 = Color_fg; 1985 ccol1 = Color_fg;
1989#endif 1986#endif
1990 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor2)) 1987 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_cursor2))
1991 ccol2 = Color_cursor2; 1988 ccol2 = Color_cursor2;
1992 else 1989 else
1993#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 1990#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1994 ccol2 = GET_BGCOLOR(R->rstyle); 1991 ccol2 = GET_BGCOLOR(rstyle);
1995#else 1992#else
1996 ccol2 = Color_bg; 1993 ccol2 = Color_bg;
1997#endif 1994#endif
1998 *srp = SET_FGCOLOR(*srp, ccol1); 1995 *srp = SET_FGCOLOR(*srp, ccol1);
1999 *srp = SET_BGCOLOR(*srp, ccol2); 1996 *srp = SET_BGCOLOR(*srp, ccol2);
2005 } 2002 }
2006 2003
2007 /* make sure no outline cursor is left around */ 2004 /* make sure no outline cursor is left around */
2008 setoldcursor = 0; 2005 setoldcursor = 0;
2009 if (ocrow != -1) { 2006 if (ocrow != -1) {
2010 if (R->screen.cur.row + R->TermWin.view_start != ocrow 2007 if (screen.cur.row + TermWin.view_start != ocrow
2011 || R->screen.cur.col != R->oldcursor.col) { 2008 || screen.cur.col != oldcursor.col) {
2012 if (ocrow < R->TermWin.nrow 2009 if (ocrow < TermWin.nrow
2013 && R->oldcursor.col < R->TermWin.ncol) { 2010 && oldcursor.col < TermWin.ncol) {
2014 R->drawn_rend[ocrow][R->oldcursor.col] ^= (RS_RVid | RS_Uline); 2011 drawn_rend[ocrow][oldcursor.col] ^= (RS_RVid | RS_Uline);
2015 } 2012 }
2016 if (R->TermWin.focus || !showcursor) 2013 if (TermWin.focus || !showcursor)
2017 R->oldcursor.row = -1; 2014 oldcursor.row = -1;
2018 else 2015 else
2019 setoldcursor = 1; 2016 setoldcursor = 1;
2020 } 2017 }
2021 } else if (!R->TermWin.focus) 2018 } else if (!TermWin.focus)
2022 setoldcursor = 1; 2019 setoldcursor = 1;
2023 if (setoldcursor) { 2020 if (setoldcursor) {
2024 if (R->screen.cur.row + R->TermWin.view_start >= R->TermWin.nrow) 2021 if (screen.cur.row + TermWin.view_start >= TermWin.nrow)
2025 R->oldcursor.row = -1; 2022 oldcursor.row = -1;
2026 else { 2023 else {
2027 R->oldcursor.row = R->screen.cur.row + R->TermWin.view_start; 2024 oldcursor.row = screen.cur.row + TermWin.view_start;
2028 R->oldcursor.col = R->screen.cur.col; 2025 oldcursor.col = screen.cur.col;
2029 } 2026 }
2030 } 2027 }
2031 } 2028 }
2032 2029
2033#ifndef NO_SLOW_LINK_SUPPORT 2030#ifndef NO_SLOW_LINK_SUPPORT
2034/* 2031/*
2035 * D: CopyArea pass - very useful for slower links 2032 * D: CopyArea pass - very useful for slower links
2036 * This has been deliberately kept simple. 2033 * This has been deliberately kept simple.
2037 */ 2034 */
2038 i = R->num_scr; 2035 i = num_scr;
2039 if (refresh_type == FAST_REFRESH && R->num_scr_allow && i 2036 if (refresh_type == FAST_REFRESH && num_scr_allow && i
2040 && abs(i) < R->TermWin.nrow && !must_clear) 2037 && abs(i) < TermWin.nrow && !must_clear)
2041 { 2038 {
2042 int16_t nits; 2039 int16_t nits;
2043 int j; 2040 int j;
2044 rend_t *drp2; 2041 rend_t *drp2;
2045 text_t *dtp2; 2042 text_t *dtp2;
2046 int len, wlen; 2043 int len, wlen;
2047 2044
2048 j = R->TermWin.nrow; 2045 j = TermWin.nrow;
2049 wlen = len = -1; 2046 wlen = len = -1;
2050 row = i > 0 ? 0 : j - 1; 2047 row = i > 0 ? 0 : j - 1;
2051 for (; j-- >= 0; row += (i > 0 ? 1 : -1)) 2048 for (; j-- >= 0; row += (i > 0 ? 1 : -1))
2052 { 2049 {
2053 if (row + i >= 0 && row + i < R->TermWin.nrow && row + i != ocrow) 2050 if (row + i >= 0 && row + i < TermWin.nrow && row + i != ocrow)
2054 { 2051 {
2055 stp = R->screen.text[row + row_offset]; 2052 stp = screen.text[row + row_offset];
2056 srp = R->screen.rend[row + row_offset]; 2053 srp = screen.rend[row + row_offset];
2057 dtp = R->drawn_text[row]; 2054 dtp = drawn_text[row];
2058 dtp2 = R->drawn_text[row + i]; 2055 dtp2 = drawn_text[row + i];
2059 drp = R->drawn_rend[row]; 2056 drp = drawn_rend[row];
2060 drp2 = R->drawn_rend[row + i]; 2057 drp2 = drawn_rend[row + i];
2061 2058
2062 for (nits = 0, col = R->TermWin.ncol; col--; ) 2059 for (nits = 0, col = TermWin.ncol; col--; )
2063 if (stp[col] != dtp2[col] || srp[col] != drp2[col]) 2060 if (stp[col] != dtp2[col] || srp[col] != drp2[col])
2064 nits--; 2061 nits--;
2065 else if (stp[col] != dtp[col] || srp[col] != drp[col]) 2062 else if (stp[col] != dtp[col] || srp[col] != drp[col])
2066 nits++; 2063 nits++;
2067 2064
2068 if (nits > 8) /* XXX: arbitrary choice */ 2065 if (nits > 8) /* XXX: arbitrary choice */
2069 { 2066 {
2070 for (col = R->TermWin.ncol; col--; ) 2067 for (col = TermWin.ncol; col--; )
2071 { 2068 {
2072 *dtp++ = *dtp2++; 2069 *dtp++ = *dtp2++;
2073 *drp++ = *drp2++; 2070 *drp++ = *drp2++;
2074 } 2071 }
2075 2072
2084 if (len != -1) 2081 if (len != -1)
2085 { 2082 {
2086 /* also comes here at end if needed because of >= above */ 2083 /* also comes here at end if needed because of >= above */
2087 if (wlen < len) 2084 if (wlen < len)
2088 SWAP_IT(wlen, len, int); 2085 SWAP_IT(wlen, len, int);
2086
2089 D_SCREEN((stderr, "rxvt_scr_refresh(): XCopyArea: %d -> %d (height: %d)", len + i, len, wlen - len + 1)); 2087 D_SCREEN((stderr, "rxvt_scr_refresh(): XCopyArea: %d -> %d (height: %d)", len + i, len, wlen - len + 1));
2090 XCopyArea(R->Xdisplay, R->TermWin.vt, R->TermWin.vt, 2088 XCopyArea (Xdisplay, TermWin.vt, TermWin.vt,
2091 R->TermWin.gc, 0, Row2Pixel(len + i), 2089 TermWin.gc, 0, Row2Pixel (len + i),
2092 (unsigned int)TermWin_TotalWidth(), 2090 (unsigned int)TermWin_TotalWidth (),
2093 (unsigned int)Height2Pixel(wlen - len + 1), 2091 (unsigned int)Height2Pixel (wlen - len + 1),
2094 0, Row2Pixel(len)); 2092 0, Row2Pixel (len));
2095 len = -1; 2093 len = -1;
2096 } 2094 }
2097 } 2095 }
2098 } 2096 }
2099#endif 2097#endif
2100 2098
2101/* 2099/*
2102 * E: main pass across every character 2100 * E: main pass across every character
2103 */ 2101 */
2104 for (row = 0; row < R->TermWin.nrow; row++) 2102 for (row = 0; row < TermWin.nrow; row++)
2105 { 2103 {
2106 stp = R->screen.text[row + row_offset]; 2104 stp = screen.text[row + row_offset];
2107 srp = R->screen.rend[row + row_offset]; 2105 srp = screen.rend[row + row_offset];
2108 dtp = R->drawn_text[row]; 2106 dtp = drawn_text[row];
2109 drp = R->drawn_rend[row]; 2107 drp = drawn_rend[row];
2110 2108
2111/* 2109/*
2112 * E2: OK, now the real pass 2110 * E2: OK, now the real pass
2113 */ 2111 */
2114 int ypixel = (int)Row2Pixel(row); 2112 int ypixel = (int)Row2Pixel(row);
2115 2113
2116 for (col = 0; col < R->TermWin.ncol; col++) 2114 for (col = 0; col < TermWin.ncol; col++)
2117 { 2115 {
2118 /* compare new text with old - if exactly the same then continue */ 2116 /* compare new text with old - if exactly the same then continue */
2119 rend_t rend = srp[col]; /* screen rendition (target rendtion) */ 2117 rend_t rend = srp[col]; /* screen rendition (target rendtion) */
2120 2118
2121 if (stp[col] == dtp[col] /* Must match characters to skip. */ 2119 if (stp[col] == dtp[col] /* Must match characters to skip. */
2137 2135
2138 int xpixel = Col2Pixel(col); 2136 int xpixel = Col2Pixel(col);
2139 2137
2140 // this loop looks very messy, it can probably be optimized 2138 // this loop looks very messy, it can probably be optimized
2141 // and cleaned a bit by you? 2139 // and cleaned a bit by you?
2142 for (i = 0; ++col < R->TermWin.ncol; ) 2140 for (i = 0; ++col < TermWin.ncol; )
2143 { 2141 {
2144 if (stp[col] == NOCHAR) 2142 if (stp[col] == NOCHAR)
2145 { 2143 {
2146 dtp[col] = stp[col]; 2144 dtp[col] = stp[col];
2147 drp[col] = rend; 2145 drp[col] = rend;
2185 2183
2186 rvid = (rend & RS_RVid) ? 1 : 0; 2184 rvid = (rend & RS_RVid) ? 1 : 0;
2187#ifdef OPTION_HC 2185#ifdef OPTION_HC
2188 if (!rvid && (rend & RS_Blink)) 2186 if (!rvid && (rend & RS_Blink))
2189 { 2187 {
2190 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_HC)) 2188 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_HC))
2191 back = Color_HC; 2189 back = Color_HC;
2192 else 2190 else
2193 rvid = !rvid; /* fall back */ 2191 rvid = !rvid; /* fall back */
2194 } 2192 }
2195#endif 2193#endif
2196 if (rvid) 2194 if (rvid)
2197 { 2195 {
2198 SWAP_IT(fore, back, int); 2196 SWAP_IT(fore, back, int);
2199 2197
2200#ifndef NO_BOLD_UNDERLINE_REVERSE 2198#ifndef NO_BOLD_UNDERLINE_REVERSE
2201 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_RV) 2199 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_RV)
2202# ifndef NO_CURSORCOLOR 2200# ifndef NO_CURSORCOLOR
2203 && !ISSET_PIXCOLOR(R, Color_cursor) 2201 && !ISSET_PIXCOLOR (this, Color_cursor)
2204# endif 2202# endif
2205 ) 2203 )
2206 back = Color_RV; 2204 back = Color_RV;
2207#endif 2205#endif
2208 } 2206 }
2209#ifndef NO_BOLD_UNDERLINE_REVERSE 2207#ifndef NO_BOLD_UNDERLINE_REVERSE
2210 else if (rend & RS_Bold) 2208 else if (rend & RS_Bold)
2211 { 2209 {
2212 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_BD)) 2210 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_BD))
2213 { 2211 {
2214 fore = Color_BD; 2212 fore = Color_BD;
2215# ifndef VERYBOLD 2213# ifndef VERYBOLD
2216 rend &= ~RS_Bold; /* we've taken care of it */ 2214 rend &= ~RS_Bold; /* we've taken care of it */
2217# endif 2215# endif
2218 } 2216 }
2219 } 2217 }
2220 else if (rend & RS_Uline) 2218 else if (rend & RS_Uline)
2221 { 2219 {
2222 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_UL)) 2220 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_UL))
2223 { 2221 {
2224 fore = Color_UL; 2222 fore = Color_UL;
2225 rend &= ~RS_Uline; /* we've taken care of it */ 2223 rend &= ~RS_Uline; /* we've taken care of it */
2226 } 2224 }
2227 } 2225 }
2228#endif 2226#endif
2229 2227
2230/* 2228/*
2231 * Actually do the drawing of the string here 2229 * Actually do the drawing of the string here
2232 */ 2230 */
2233 rxvt_font *font = (*R->TermWin.fontset)[fid]; 2231 rxvt_font *font = (*TermWin.fontset)[fid];
2234 2232
2235 if (back == Color_bg) 2233 if (back == Color_bg)
2236 { 2234 {
2237 if (must_clear) 2235 if (must_clear)
2238 { 2236 {
2241 { 2239 {
2242 font->draw (xpixel, ypixel, text, count, fore, -1); 2240 font->draw (xpixel, ypixel, text, count, fore, -1);
2243 goto nodraw; 2241 goto nodraw;
2244 } 2242 }
2245 2243
2246 CLEAR_CHARS(xpixel, ypixel, count); 2244 CLEAR_CHARS (xpixel, ypixel, count);
2247nodraw: ; 2245nodraw: ;
2248 } 2246 }
2249 else 2247 else
2250 font->draw (xpixel, ypixel, text, count, fore, Color_bg); 2248 font->draw (xpixel, ypixel, text, count, fore, Color_bg);
2251 } 2249 }
2252 else 2250 else
2253 font->draw (xpixel, ypixel, text, count, fore, back); 2251 font->draw (xpixel, ypixel, text, count, fore, back);
2254 2252
2255 if ((rend & RS_Uline) && (font->descent > 1)) 2253 if ((rend & RS_Uline) && (font->descent > 1))
2256 XDrawLine(R->Xdisplay, drawBuffer, R->TermWin.gc, 2254 XDrawLine(Xdisplay, drawBuffer, TermWin.gc,
2257 xpixel, ypixel + font->ascent + 1, 2255 xpixel, ypixel + font->ascent + 1,
2258 xpixel + Width2Pixel(count) - 1, ypixel + font->ascent + 1); 2256 xpixel + Width2Pixel(count) - 1, ypixel + font->ascent + 1);
2259 } /* for (col....) */ 2257 } /* for (col....) */
2260 } /* for (row....) */ 2258 } /* for (row....) */
2261 2259
2262/* 2260/*
2263 * G: cleanup cursor and display outline cursor if necessary 2261 * G: cleanup cursor and display outline cursor if necessary
2264 */ 2262 */
2265 if (showcursor) { 2263 if (showcursor) {
2266 if (R->TermWin.focus) { 2264 if (TermWin.focus) {
2267 srp = &(R->screen.rend[R->screen.cur.row + R->TermWin.saveLines] 2265 srp = &(screen.rend[screen.cur.row + TermWin.saveLines]
2268 [R->screen.cur.col]); 2266 [screen.cur.col]);
2269 *srp ^= RS_RVid; 2267 *srp ^= RS_RVid;
2270#ifndef NO_CURSORCOLOR 2268#ifndef NO_CURSORCOLOR
2271 *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1; 2269 *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1;
2272#endif 2270#endif
2273 } else if (R->oldcursor.row >= 0) { 2271 } else if (oldcursor.row >= 0) {
2274#ifndef NO_CURSORCOLOR 2272#ifndef NO_CURSORCOLOR
2275 unsigned long gcmask; /* Graphics Context mask */ 2273 unsigned long gcmask; /* Graphics Context mask */
2276 2274
2277 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor)) { 2275 if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_cursor))
2278 XSetForeground (R->Xdisplay, R->TermWin.gc, R->PixColors[Color_cursor]); 2276 XSetForeground (Xdisplay, TermWin.gc, PixColors[Color_cursor]);
2279 }
2280#endif 2277#endif
2281 XDrawRectangle(R->Xdisplay, drawBuffer, R->TermWin.gc, 2278 XDrawRectangle(Xdisplay, drawBuffer, TermWin.gc,
2282 Col2Pixel(R->oldcursor.col), 2279 Col2Pixel(oldcursor.col),
2283 Row2Pixel(R->oldcursor.row), 2280 Row2Pixel(oldcursor.row),
2284 (unsigned int)(Width2Pixel(cursorwidth) - 1), 2281 (unsigned int)(Width2Pixel(cursorwidth) - 1),
2285 (unsigned int)(Height2Pixel(1) - R->TermWin.lineSpace - 1)); 2282 (unsigned int)(Height2Pixel(1) - TermWin.lineSpace - 1));
2286 } 2283 }
2287 } 2284 }
2288/* 2285/*
2289 * H: cleanup selection 2286 * H: cleanup selection
2290 */ 2287 */
2291 rxvt_scr_reverse_selection(aR); 2288 rxvt_scr_reverse_selection (this);
2292 2289
2293/* 2290/*
2294 * I: other general cleanup 2291 * I: other general cleanup
2295 */ 2292 */
2296 if (clearfirst && R->TermWin.int_bwidth) 2293 if (clearfirst && TermWin.int_bwidth)
2297 /* 2294 /*
2298 * clear the whole screen height, note that width == 0 is treated 2295 * clear the whole screen height, note that width == 0 is treated
2299 * specially by XClearArea 2296 * specially by XClearArea
2300 */ 2297 */
2301 XClearArea(R->Xdisplay, R->TermWin.vt, 0, 0, 2298 XClearArea(Xdisplay, TermWin.vt, 0, 0,
2302 (unsigned int)R->TermWin.int_bwidth, 2299 (unsigned int)TermWin.int_bwidth,
2303 (unsigned int)TermWin_TotalHeight(), False); 2300 (unsigned int)TermWin_TotalHeight(), False);
2304 if (clearlast && R->TermWin.int_bwidth) 2301 if (clearlast && TermWin.int_bwidth)
2305 /* 2302 /*
2306 * clear the whole screen height, note that width == 0 is treated 2303 * clear the whole screen height, note that width == 0 is treated
2307 * specially by XClearArea 2304 * specially by XClearArea
2308 */ 2305 */
2309 XClearArea(R->Xdisplay, R->TermWin.vt, 2306 XClearArea(Xdisplay, TermWin.vt,
2310 R->TermWin.width + R->TermWin.int_bwidth, 0, 2307 TermWin.width + TermWin.int_bwidth, 0,
2311 (unsigned int)R->TermWin.int_bwidth, 2308 (unsigned int)TermWin.int_bwidth,
2312 (unsigned int)TermWin_TotalHeight(), False); 2309 (unsigned int)TermWin_TotalHeight(), False);
2313 if (refresh_type & SMOOTH_REFRESH) 2310 if (refresh_type & SMOOTH_REFRESH)
2314 XSync(R->Xdisplay, False); 2311 XSync(Xdisplay, False);
2315 2312
2316 R->num_scr = 0; 2313 num_scr = 0;
2317 R->num_scr_allow = 1; 2314 num_scr_allow = 1;
2318 R->want_refresh = 0; /* screen is current */ 2315 want_refresh = 0; /* screen is current */
2319} 2316}
2320/* ------------------------------------------------------------------------- */
2321 2317
2322/* EXTPROTO */ 2318/* ------------------------------------------------------------------------- */
2323void 2319void
2324rxvt_scr_clear(pR) 2320rxvt_term::scr_clear()
2325{ 2321{
2326 if (!R->TermWin.mapped) 2322 if (!TermWin.mapped)
2327 return; 2323 return;
2324
2328 R->num_scr_allow = 0; 2325 num_scr_allow = 0;
2329 R->want_refresh = 1; 2326 want_refresh = 1;
2330#ifdef TRANSPARENT 2327#ifdef TRANSPARENT
2331 if ((R->Options & Opt_transparent) && (R->am_pixmap_trans == 0)) { 2328 if ((Options & Opt_transparent) && (am_pixmap_trans == 0))
2332 int i; 2329 {
2330 int i;
2333 2331
2334 if (!(R->Options & Opt_transparent_all)) 2332 if (!(Options & Opt_transparent_all))
2335 i = 0; 2333 i = 0;
2336 else 2334 else
2337 i = (int)(sizeof(R->TermWin.parent) / sizeof(Window)); 2335 i = (int)(sizeof(TermWin.parent) / sizeof(Window));
2338 for (; i--;) 2336
2337 while (i--)
2339 if (R->TermWin.parent[i] != None) 2338 if (TermWin.parent[i] != None)
2340 XClearWindow(R->Xdisplay, R->TermWin.parent[i]); 2339 XClearWindow(Xdisplay, TermWin.parent[i]);
2341 } 2340 }
2342#endif 2341#endif
2342
2343 XClearWindow(R->Xdisplay, R->TermWin.vt); 2343 XClearWindow (Xdisplay, TermWin.vt);
2344} 2344}
2345 2345
2346/* ------------------------------------------------------------------------- */ 2346/* ------------------------------------------------------------------------- */
2347/* INTPROTO */ 2347/* INTPROTO */
2348void 2348void
2822/* ------------------------------------------------------------------------- */ 2822/* ------------------------------------------------------------------------- */
2823/* 2823/*
2824 * Mark or select text based upon number of clicks: 1, 2, or 3 2824 * Mark or select text based upon number of clicks: 1, 2, or 3
2825 * EXT: button 1 press 2825 * EXT: button 1 press
2826 */ 2826 */
2827/* EXTPROTO */
2828void 2827void
2829rxvt_selection_click(pR_ int clicks, int x, int y) 2828rxvt_term::selection_click (int clicks, int x, int y)
2830{ 2829{
2831 D_SELECT((stderr, "rxvt_selection_click(%d, %d, %d)", clicks, x, y)); 2830 D_SELECT((stderr, "rxvt_selection_click(%d, %d, %d)", clicks, x, y));
2832 2831
2833 clicks = ((clicks - 1) % 3) + 1; 2832 clicks = ((clicks - 1) % 3) + 1;
2834 R->selection.clicks = clicks; /* save clicks so extend will work */ 2833 selection.clicks = clicks; /* save clicks so extend will work */
2835 2834
2836 rxvt_selection_start_colrow(aR_ Pixel2Col(x), Pixel2Row(y)); 2835 rxvt_selection_start_colrow (this, Pixel2Col(x), Pixel2Row(y));
2836
2837 if (clicks == 2 || clicks == 3) 2837 if (clicks == 2 || clicks == 3)
2838 rxvt_selection_extend_colrow(aR_ R->selection.mark.col, 2838 rxvt_selection_extend_colrow (this, selection.mark.col,
2839 R->selection.mark.row
2840 + R->TermWin.view_start, 2839 selection.mark.row + TermWin.view_start,
2841 0, /* button 3 */ 2840 0, /* button 3 */
2842 1, /* button press */ 2841 1, /* button press */
2843 0); /* click change */ 2842 0); /* click change */
2844} 2843}
2845 2844
2846/* ------------------------------------------------------------------------- */ 2845/* ------------------------------------------------------------------------- */
2847/* 2846/*
2848 * Mark a selection at the specified col/row 2847 * Mark a selection at the specified col/row
2958 * EXT: button 3 press; button 1 or 3 drag 2957 * EXT: button 3 press; button 1 or 3 drag
2959 * flag == 0 ==> button 1 2958 * flag == 0 ==> button 1
2960 * flag == 1 ==> button 3 press 2959 * flag == 1 ==> button 3 press
2961 * flag == 2 ==> button 3 motion 2960 * flag == 2 ==> button 3 motion
2962 */ 2961 */
2963/* EXTPROTO */
2964void 2962void
2965rxvt_selection_extend(pR_ int x, int y, int flag) 2963rxvt_term::selection_extend (int x, int y, int flag)
2966{ 2964{
2967 int col, row; 2965 int col, row;
2968 2966
2969 col = Pixel2Col(x); 2967 col = Pixel2Col(x);
2970 row = Pixel2Row(y); 2968 row = Pixel2Row(y);
2971 MAX_IT(row, 0); 2969 MAX_IT(row, 0);
2972 MIN_IT(row, (int)R->TermWin.nrow - 1); 2970 MIN_IT(row, (int)TermWin.nrow - 1);
2973 MAX_IT(col, 0); 2971 MAX_IT(col, 0);
2974 MIN_IT(col, (int)R->TermWin.ncol); 2972 MIN_IT(col, (int)TermWin.ncol);
2973
2975#ifndef NO_NEW_SELECTION 2974#ifndef NO_NEW_SELECTION
2976/* 2975 /*
2977 * If we're selecting characters (single click) then we must check first 2976 * If we're selecting characters (single click) then we must check first
2978 * if we are at the same place as the original mark. If we are then 2977 * if we are at the same place as the original mark. If we are then
2979 * select nothing. Otherwise, if we're to the right of the mark, you have to 2978 * select nothing. Otherwise, if we're to the right of the mark, you have to
2980 * be _past_ a character for it to be selected. 2979 * be _past_ a character for it to be selected.
2981 */ 2980 */
2982 if (R->selection_style != OLD_SELECT) { 2981 if (selection_style != OLD_SELECT)
2982 {
2983 if (((R->selection.clicks % 3) == 1) && !flag 2983 if (((selection.clicks % 3) == 1) && !flag
2984 && (col == R->selection.mark.col 2984 && (col == selection.mark.col
2985 && (row == R->selection.mark.row + R->TermWin.view_start))) { 2985 && (row == selection.mark.row + TermWin.view_start)))
2986 {
2986 /* select nothing */ 2987 /* select nothing */
2987 R->selection.beg.row = R->selection.end.row = 0; 2988 selection.beg.row = selection.end.row = 0;
2988 R->selection.beg.col = R->selection.end.col = 0; 2989 selection.beg.col = selection.end.col = 0;
2989 R->selection.clicks = 4; 2990 selection.clicks = 4;
2990 R->want_refresh = 1; 2991 want_refresh = 1;
2991 D_SELECT((stderr, "rxvt_selection_extend() R->selection.clicks = 4")); 2992 D_SELECT((stderr, "rxvt_selection_extend() selection.clicks = 4"));
2992 return; 2993 return;
2993 } 2994 }
2994 } 2995 }
2995#endif 2996#endif
2996 if (R->selection.clicks == 4) 2997 if (selection.clicks == 4)
2997 R->selection.clicks = 1; 2998 selection.clicks = 1;
2999
2998 rxvt_selection_extend_colrow(aR_ col, row, !!flag, /* ? button 3 */ 3000 rxvt_selection_extend_colrow (this, col, row, !!flag, /* ? button 3 */
2999 flag == 1 ? 1 : 0, /* ? button press */ 3001 flag == 1 ? 1 : 0, /* ? button press */
3000 0); /* no click change */ 3002 0); /* no click change */
3001} 3003}
3002 3004
3003/* ------------------------------------------------------------------------- */ 3005/* ------------------------------------------------------------------------- */
3004/* 3006/*
3005 * Extend the selection to the specified col/row 3007 * Extend the selection to the specified col/row
3259/* ------------------------------------------------------------------------- */ 3261/* ------------------------------------------------------------------------- */
3260/* 3262/*
3261 * Double click on button 3 when already selected 3263 * Double click on button 3 when already selected
3262 * EXT: button 3 double click 3264 * EXT: button 3 double click
3263 */ 3265 */
3264/* EXTPROTO */
3265void 3266void
3266rxvt_selection_rotate(pR_ int x, int y) 3267rxvt_term::selection_rotate (int x, int y)
3267{ 3268{
3268 R->selection.clicks = R->selection.clicks % 3 + 1; 3269 selection.clicks = selection.clicks % 3 + 1;
3269 rxvt_selection_extend_colrow(aR_ Pixel2Col(x), Pixel2Row(y), 1, 0, 1); 3270 rxvt_selection_extend_colrow (this, Pixel2Col(x), Pixel2Row(y), 1, 0, 1);
3270} 3271}
3271 3272
3272/* ------------------------------------------------------------------------- */ 3273/* ------------------------------------------------------------------------- */
3273/* 3274/*
3274 * On some systems, the Atom typedef is 64 bits wide. We need to have a type 3275 * On some systems, the Atom typedef is 64 bits wide. We need to have a type
3378 * ------------------------------------------------------------------------- */ 3379 * ------------------------------------------------------------------------- */
3379 3380
3380/* 3381/*
3381 * return col/row values corresponding to x/y pixel values 3382 * return col/row values corresponding to x/y pixel values
3382 */ 3383 */
3383/* EXTPROTO */
3384void 3384void
3385rxvt_pixel_position(pR_ int *x, int *y) 3385rxvt_term::pixel_position (int *x, int *y)
3386{ 3386{
3387 *x = Pixel2Col(*x); 3387 *x = Pixel2Col(*x);
3388/* MAX_IT(*x, 0); MIN_IT(*x, (int)R->TermWin.ncol - 1); */ 3388 /* MAX_IT(*x, 0); MIN_IT(*x, (int)R->TermWin.ncol - 1); */
3389 *y = Pixel2Row(*y); 3389 *y = Pixel2Row(*y);
3390/* MAX_IT(*y, 0); MIN_IT(*y, (int)R->TermWin.nrow - 1); */ 3390 /* MAX_IT(*y, 0); MIN_IT(*y, (int)R->TermWin.nrow - 1); */
3391} 3391}
3392
3392/* ------------------------------------------------------------------------- */ 3393/* ------------------------------------------------------------------------- */
3393#ifdef USE_XIM 3394#ifdef USE_XIM
3394/* EXTPROTO */
3395void 3395void
3396rxvt_setPosition(pR_ XPoint *pos) 3396rxvt_term::set_position (XPoint *pos)
3397{ 3397{
3398 XWindowAttributes xwa; 3398 XWindowAttributes xwa;
3399 3399
3400 XGetWindowAttributes(R->Xdisplay, R->TermWin.vt, &xwa); 3400 XGetWindowAttributes (Xdisplay, TermWin.vt, &xwa);
3401 pos->x = Col2Pixel(R->screen.cur.col) + xwa.x; 3401 pos->x = Col2Pixel (screen.cur.col) + xwa.x;
3402 pos->y = Height2Pixel((R->screen.cur.row + 1)) + xwa.y 3402 pos->y = Height2Pixel ((screen.cur.row + 1)) + xwa.y - TermWin.lineSpace;
3403 - R->TermWin.lineSpace;
3404} 3403}
3404
3405#endif 3405#endif
3406/* ------------------------------------------------------------------------- */ 3406/* ------------------------------------------------------------------------- */
3407 3407
3408/* ------------------------------------------------------------------------- * 3408/* ------------------------------------------------------------------------- *
3409 * DEBUG ROUTINES * 3409 * DEBUG ROUTINES *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines