From 2df1731a4dbcb999ed976c3843d34fa700e8f2d5 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sat, 25 Feb 2006 21:34:45 +0000 Subject: [PATCH] Musn't mess with the original window data. --- x11/pdcx11.c | 24 +++++++++++++----------- x11/process/x11.c | 8 ++++---- x11/process/x11.h | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/x11/pdcx11.c b/x11/pdcx11.c index 5bf0b4e8..bd6e6858 100644 --- a/x11/pdcx11.c +++ b/x11/pdcx11.c @@ -10,7 +10,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCx11 = - "$Id: pdcx11.c,v 1.53 2006/02/25 21:21:16 wmcbrine Exp $"; + "$Id: pdcx11.c,v 1.54 2006/02/25 21:34:45 wmcbrine Exp $"; #endif AppData app_data; @@ -1026,7 +1026,7 @@ static int XCursesNewPacket(chtype attr, bool rev, int len, return OK; } -int XCursesDisplayText(chtype *ch, int row, int col, int num_cols, +int XCursesDisplayText(const chtype *ch, int row, int col, int num_cols, bool highlight) { char text[513]; @@ -1043,15 +1043,17 @@ int XCursesDisplayText(chtype *ch, int row, int col, int num_cols, for (i = 0, j = 0; j < num_cols; j++) { + chtype curr = ch[j]; + /* Special handling for ACS_BLOCK */ - if (!(ch[j] & A_CHARTEXT)) + if (!(curr & A_CHARTEXT)) { - ch[j] |= ' '; - ch[j] ^= A_REVERSE; + curr |= ' '; + curr ^= A_REVERSE; } - attr = ch[j] & A_ATTRIBUTES; + attr = curr & A_ATTRIBUTES; if (attr != old_attr) { @@ -1064,7 +1066,7 @@ int XCursesDisplayText(chtype *ch, int row, int col, int num_cols, i = 0; } - text[i++] = ch[j] & A_CHARTEXT; + text[i++] = curr & A_CHARTEXT; } return XCursesNewPacket(old_attr, highlight, i, col, row, text); @@ -1901,9 +1903,9 @@ void ShowSelection(int start_x, int start_y, int end_x, int end_y, *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; - XCursesDisplayText((chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + - (start_col * sizeof(chtype))), row, start_col, - num_cols, highlight); + XCursesDisplayText((const chtype *)(Xcurscr + + XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))), + row, start_col, num_cols, highlight); *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; } @@ -2157,7 +2159,7 @@ void XCursesDisplayCursor(int old_row, int old_x, int new_row, int new_x) PDC_LOG(("%s:XCursesDisplayCursor() - draw char at row: %d col %d\n", XCLOGMSG, old_row, old_x)); - XCursesDisplayText((chtype *)(Xcurscr + (XCURSCR_Y_OFF(old_row) + XCursesDisplayText((const chtype *)(Xcurscr + (XCURSCR_Y_OFF(old_row) + (old_x * sizeof(chtype)))), old_row, old_x, 1, FALSE); /* display the cursor at the new cursor position */ diff --git a/x11/process/x11.c b/x11/process/x11.c index 5c256c05..7e85346b 100644 --- a/x11/process/x11.c +++ b/x11/process/x11.c @@ -9,7 +9,7 @@ #ifdef PDCDEBUG const char rcsid_x11 = - "$Id: x11.c,v 1.39 2006/02/23 01:46:53 wmcbrine Exp $"; + "$Id: x11.c,v 1.40 2006/02/25 21:34:45 wmcbrine Exp $"; #endif extern AppData app_data; @@ -65,8 +65,8 @@ void XCursesDisplayScreen(bool highlight) *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; - XCursesDisplayText((chtype *)(Xcurscr + XCURSCR_Y_OFF(row)), - row, 0, COLS, highlight); + XCursesDisplayText((const chtype *)(Xcurscr + + XCURSCR_Y_OFF(row)), row, 0, COLS, highlight); *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; } @@ -104,7 +104,7 @@ int XCursesRefreshScreen(void) start_col = (int)*(Xcurscr + XCURSCR_START_OFF + row); - XCursesDisplayText((chtype *)(Xcurscr + + XCursesDisplayText((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))), row, start_col, num_cols, FALSE); diff --git a/x11/process/x11.h b/x11/process/x11.h index cd21bb51..95e28c9f 100644 --- a/x11/process/x11.h +++ b/x11/process/x11.h @@ -5,7 +5,7 @@ int get_colors(void); void start_event_handler(void); int XCursesTransformLine(int, int, chtype, int, int, int, char *); -int XCursesDisplayText(chtype *, int, int, int, bool); +int XCursesDisplayText(const chtype *, int, int, int, bool); void XCursesDisplayScreen(bool); void XCursesDisplayCursor(int, int, int, int); void XCursesStructureNotify(Widget, XtPointer, XEvent *, Boolean *);