XCursesLINES and XCursesCOLS aren't really needed.

This commit is contained in:
William McBrine
2019-08-30 21:04:32 -04:00
parent 24acd29916
commit be92ff7cf5
6 changed files with 18 additions and 32 deletions

View File

@@ -97,8 +97,8 @@ static void _display_cursor(int old_row, int old_x, int new_row, int new_x)
/* if the cursor position is outside the boundary of the screen,
ignore the request */
if (old_row >= XCursesLINES || old_x >= COLS ||
new_row >= XCursesLINES || new_x >= COLS)
if (old_row >= SP->lines || old_x >= COLS ||
new_row >= SP->lines || new_x >= COLS)
return;
/* display the character at the current cursor position */
@@ -180,7 +180,7 @@ void XC_blink_text(XtPointer unused, XtIntervalId *id)
/* Redraw changed lines on the screen to match the blink state */
for (row = 0; row < XCursesLINES; row++)
for (row = 0; row < SP->lines; row++)
{
ch = curscr->_y[row];

View File

@@ -8,7 +8,7 @@ int PDC_get_columns(void)
{
PDC_LOG(("PDC_get_columns() - called\n"));
return XCursesCOLS;
return SP->cols;
}
/* get the cursor size/shape */
@@ -24,5 +24,5 @@ int PDC_get_rows(void)
{
PDC_LOG(("PDC_get_rows() - called\n"));
return XCursesLINES;
return SP->lines;
}

View File

@@ -451,8 +451,8 @@ static unsigned long _process_mouse_event(XEvent *event)
/* If we are ignoring the event, or the mouse position is outside
the bounds of the screen, return here */
if (SP->mouse_status.x < 0 || SP->mouse_status.x >= XCursesCOLS ||
SP->mouse_status.y < 0 || SP->mouse_status.y >= XCursesLINES)
if (SP->mouse_status.x < 0 || SP->mouse_status.x >= SP->cols ||
SP->mouse_status.y < 0 || SP->mouse_status.y >= SP->lines)
return -1;
/* Send the KEY_MOUSE to curses program */

View File

@@ -97,19 +97,16 @@ int PDC_resize_screen(int nlines, int ncols)
if (nlines || ncols || !SP->resized)
return ERR;
SP->lines = XCursesLINES = resize_window_height / font_height;
SP->lines = resize_window_height / font_height;
LINES = XCursesLINES - SP->linesrippedoff - SP->slklines;
LINES = SP->lines - SP->linesrippedoff - SP->slklines;
SP->cols = COLS = XCursesCOLS = resize_window_width / font_width;
SP->cols = COLS = resize_window_width / font_width;
window_width = resize_window_width;
window_height = resize_window_height;
visible_cursor = TRUE;
XCursesLINES = SP->lines;
XCursesCOLS = SP->cols;
SP->resized = FALSE;
return OK;

View File

@@ -80,8 +80,6 @@ extern Widget topLevel, drawing;
extern Pixel colors[PDC_MAXCOL];
extern GC normal_gc, rect_cursor_gc, italic_gc, bold_gc;
extern int XCursesLINES;
extern int XCursesCOLS;
extern int font_height, font_width, font_ascent, font_descent;
extern int window_width, window_height;
extern int resize_window_width, resize_window_height;

View File

@@ -37,8 +37,6 @@ static bool exposed = FALSE;
bool blinked_off;
int XCursesLINES = 24;
int XCursesCOLS = 80;
int font_height, font_width, font_ascent, font_descent;
bool xc_resize_now = FALSE;
@@ -273,7 +271,7 @@ static void _display_screen(void)
if (!curscr)
return;
for (row = 0; row < XCursesLINES; row++)
for (row = 0; row < SP->lines; row++)
PDC_transform_line(row, 0, COLS, curscr->_y[row]);
XC_redraw_cursor();
@@ -476,11 +474,11 @@ int XCursesInitscr(int argc, char *argv[])
/* Calculate size of display window */
XCursesCOLS = xc_app_data.cols;
XCursesLINES = xc_app_data.lines;
COLS = xc_app_data.cols;
LINES = xc_app_data.lines;
window_width = font_width * XCursesCOLS;
window_height = font_height * XCursesLINES;
window_width = font_width * COLS;
window_height = font_height * LINES;
minwidth = font_width * 2;
minheight = font_height * 2;
@@ -511,15 +509,10 @@ int XCursesInitscr(int argc, char *argv[])
if (!strcmp(xc_app_data.textCursor, "vertical"))
vertical_cursor = TRUE;
/* Now have LINES and COLS. */
LINES = XCursesLINES;
COLS = XCursesCOLS;
SP = calloc(1, sizeof(SCREEN));
SP->lines = XCursesLINES;
SP->cols = XCursesCOLS;
SP->lines = LINES;
SP->cols = COLS;
SP->mouse_wait = xc_app_data.clickPeriod;
SP->audible = TRUE;
@@ -584,9 +577,7 @@ int XCursesInitscr(int argc, char *argv[])
XtDispatchEvent(&event);
}
XCursesLINES = SP->lines;
LINES = XCursesLINES - SP->linesrippedoff - SP->slklines;
XCursesCOLS = COLS = SP->cols;
LINES = LINES - SP->linesrippedoff - SP->slklines;
atexit(XCursesExit);