From 61b5c857a47cd0ec20dfa62775953bdc91ea0496 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Mon, 27 Mar 2006 04:35:41 +0000 Subject: [PATCH] Made "direct_video" DOS-only. --- curses.h | 10 +++++----- os2/pdcdisp.c | 36 ++++++++++++------------------------ os2/pdcscrn.c | 3 +-- pdcurses/termattr.c | 6 +++++- win32/pdcscrn.c | 3 +-- x11/pdcscrn.c | 3 +-- 6 files changed, 25 insertions(+), 36 deletions(-) diff --git a/curses.h b/curses.h index fa586d3e..adafc909 100644 --- a/curses.h +++ b/curses.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curses.h,v 1.153 2006/03/26 01:17:01 wmcbrine Exp $ */ +/* $Id: curses.h,v 1.154 2006/03/27 04:35:41 wmcbrine Exp $ */ /*----------------------------------------------------------------------* * PDCurses * @@ -613,7 +613,6 @@ typedef struct bool orgcbr; /* original MSDOS ^-BREAK setting */ bool visible_cursor; /* TRUE if cursor is visible */ bool audible; /* FALSE if the bell is visual */ - bool direct_video; /* Allow Direct Screen Memory writes */ bool mono; /* TRUE if current screen is mono */ bool sizeable; /* TRUE if adapter is resizeable */ bool resized; /* TRUE if TERM has been resized */ @@ -670,9 +669,10 @@ typedef struct #endif #ifdef DOS - int video_page; /* Current PC video page */ - unsigned video_seg; /* video base segment */ - unsigned video_ofs; /* video base offset */ + bool direct_video; /* Allow Direct Screen Memory writes */ + int video_page; /* Current PC video page */ + unsigned video_seg; /* video base segment */ + unsigned video_ofs; /* video base offset */ #endif #ifdef XCURSES diff --git a/os2/pdcdisp.c b/os2/pdcdisp.c index 51a73423..6121f189 100644 --- a/os2/pdcdisp.c +++ b/os2/pdcdisp.c @@ -21,7 +21,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCdisp = - "$Id: pdcdisp.c,v 1.21 2006/03/25 13:49:31 wmcbrine Exp $"; + "$Id: pdcdisp.c,v 1.22 2006/03/27 04:35:41 wmcbrine Exp $"; #endif extern unsigned char atrtab[MAX_ATRTAB]; @@ -321,6 +321,10 @@ int PDC_scroll(int urow, int lcol, int lrow, int rcol, int nlines, chtype attr) bool PDC_transform_line(int lineno) { + /* this should be enough for the maximum width of a screen. */ + + unsigned short temp_line[256]; + chtype *srcp; int j, x, len; @@ -333,34 +337,18 @@ bool PDC_transform_line(int lineno) len = curscr->_lastch[lineno] - x + 1; srcp = curscr->_y[lineno] + x; - if (SP->direct_video) - { - /* this should be enough for the maximum width of a - screen. */ + /* replace the attribute part of the chtype with the + actual colour value for each chtype in the line */ - unsigned short temp_line[256]; + for (j = 0; j < len; j++) + temp_line[j] = chtype_attr(srcp[j]) | (srcp[j] & A_CHARTEXT); - /* replace the attribute part of the chtype with the - actual colour value for each chtype in the line */ - - for (j = 0; j < len; j++) - temp_line[j] = chtype_attr(srcp[j]) | - (srcp[j] & A_CHARTEXT); #ifdef EMXVIDEO - v_putline((char*)temp_line, x, lineno, len); + v_putline((char*)temp_line, x, lineno, len); #else - VioWrtCellStr((PCH)temp_line, - (USHORT)(len * sizeof(unsigned short)), - (USHORT)lineno, (USHORT)x, 0); + VioWrtCellStr((PCH)temp_line, (USHORT)(len * sizeof(unsigned short)), + (USHORT)lineno, (USHORT)x, 0); #endif - } - else - for (j = 0; j < len; j++) - { - PDC_gotoxy(lineno, j + x); - PDC_putc((srcp[j] & A_CHARTEXT), - chtype_attr(srcp[j]) >> 8); - } curscr->_firstch[lineno] = _NO_CHANGE; curscr->_lastch[lineno] = _NO_CHANGE; diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index 3f3fb2ca..d11a5259 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -22,7 +22,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCscrn = - "$Id: pdcscrn.c,v 1.22 2006/03/26 01:48:49 wmcbrine Exp $"; + "$Id: pdcscrn.c,v 1.23 2006/03/27 04:35:41 wmcbrine Exp $"; #endif #ifdef EMXVIDEO @@ -157,7 +157,6 @@ int PDC_scr_open(SCREEN *internal, bool echo) PDC_get_cursor_pos(&internal->cursrow, &internal->curscol); - internal->direct_video = TRUE; /* Assume that we can */ internal->autocr = TRUE; /* cr -> lf by default */ internal->raw_out = FALSE; /* tty I/O modes */ internal->raw_inp = FALSE; /* tty I/O modes */ diff --git a/pdcurses/termattr.c b/pdcurses/termattr.c index 2671dfe9..3b2df7f1 100644 --- a/pdcurses/termattr.c +++ b/pdcurses/termattr.c @@ -33,7 +33,7 @@ #ifdef PDCDEBUG const char *rcsid_termattr = - "$Id: termattr.c,v 1.25 2006/03/20 23:49:44 wmcbrine Exp $"; + "$Id: termattr.c,v 1.26 2006/03/27 04:35:41 wmcbrine Exp $"; #endif /*man-start************************************************************** @@ -128,7 +128,11 @@ int baudrate(void) { PDC_LOG(("baudrate() - called\n")); +#ifdef DOS return SP->direct_video ? INT_MAX : 19200; +#else + return INT_MAX; +#endif } char erasechar(void) diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index 0c26124f..e0950665 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -21,7 +21,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCscrn = - "$Id: pdcscrn.c,v 1.31 2006/03/26 01:48:53 wmcbrine Exp $"; + "$Id: pdcscrn.c,v 1.32 2006/03/27 04:35:41 wmcbrine Exp $"; #endif #define PDC_RESTORE_NONE 0 @@ -302,7 +302,6 @@ int PDC_scr_open(SCREEN *internal, bool echo) PDC_get_cursor_pos(&internal->cursrow, &internal->curscol); - internal->direct_video = TRUE; /* Assume that we can */ internal->autocr = TRUE; /* cr -> lf by default */ internal->raw_out = FALSE; /* tty I/O modes */ internal->raw_inp = FALSE; /* tty I/O modes */ diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index dfcf5b03..3b5de1a6 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -20,7 +20,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCscrn = - "$Id: pdcscrn.c,v 1.20 2006/03/26 01:17:14 wmcbrine Exp $"; + "$Id: pdcscrn.c,v 1.21 2006/03/27 04:35:41 wmcbrine Exp $"; #endif bool GLOBAL_sb_on = FALSE; @@ -107,7 +107,6 @@ int PDC_scr_open(SCREEN *internal, bool echo) PDC_LOG(("PDC_scr_open() - called\n")); internal->cursrow = internal->curscol = 0; - internal->direct_video = FALSE; /* Assume that we can't */ internal->autocr = TRUE; /* cr -> lf by default */ internal->raw_out = FALSE; /* tty I/O modes */ internal->raw_inp = FALSE; /* tty I/O modes */