From 39b10e2ac2ab19cfd1e9159e67339a8e80e81430 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sat, 15 Jul 2006 20:46:24 +0000 Subject: [PATCH] flash() was not implemented for Win32 or X (despite much code to that effect). Here's a nice portable implementation, which also allows me to remove PDC_scroll() (this is the last place it was used). To Do: Should the delay be longer? --- curspriv.h | 9 +++---- doc/intro.man | 1 - dos/pdcdisp.c | 52 +------------------------------------- os2/pdcdisp.c | 59 +------------------------------------------- pdcurses/beep.c | 24 +++++++++++------- win32/curses.def | 1 - win32/curses_lcc.def | 1 - win32/pdcdisp.c | 32 +----------------------- x11/process/x11.c | 21 +--------------- 9 files changed, 23 insertions(+), 177 deletions(-) diff --git a/curspriv.h b/curspriv.h index 8256afc5..c2893f04 100644 --- a/curspriv.h +++ b/curspriv.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curspriv.h,v 1.85 2006/07/15 15:13:40 wmcbrine Exp $ */ +/* $Id: curspriv.h,v 1.86 2006/07/15 20:46:23 wmcbrine Exp $ */ /* CURSPRIV.H @@ -118,7 +118,6 @@ int PDC_reset_shell_mode(void); int PDC_resize_screen(int, int); int PDC_scr_close(void); int PDC_scr_open(SCREEN *, bool); -int PDC_scroll(int, int, int, int, int, chtype); int PDC_set_ctrl_break(bool); int PDC_set_cursor_mode(int, int); int PDC_set_font(int); @@ -176,11 +175,11 @@ void PDC_debug(const char *, ...); #ifdef XCURSES enum { - CURSES_CLEAR_SELECTION = 999985, CURSES_DISPLAY_CURSOR, + CURSES_CLEAR_SELECTION, CURSES_DISPLAY_CURSOR, CURSES_SET_SELECTION, CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR, CURSES_RESIZE, CURSES_CLEAR, - CURSES_FLASH, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR, - CURSES_CHILD, CURSES_REFRESH, CURSES_EXIT + CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR, CURSES_CHILD, + CURSES_REFRESH, CURSES_EXIT }; #endif diff --git a/doc/intro.man b/doc/intro.man index 989d96d2..0cd112c7 100644 --- a/doc/intro.man +++ b/doc/intro.man @@ -555,7 +555,6 @@ FUNCTIONS PDC_query_adapter_type pdcgetsc PDC_rawgetch pdckbd PDC_scrn_modes_equal pdcscrn - PDC_scroll pdcdisp PDC_scr_close pdcscrn PDC_scr_open pdcscrn PDC_set_ctrl_break pdckbd diff --git a/dos/pdcdisp.c b/dos/pdcdisp.c index 8987a709..3c17e3e2 100644 --- a/dos/pdcdisp.c +++ b/dos/pdcdisp.c @@ -19,7 +19,7 @@ #include -RCSID("$Id: pdcdisp.c,v 1.33 2006/07/15 15:38:24 wmcbrine Exp $"); +RCSID("$Id: pdcdisp.c,v 1.34 2006/07/15 20:46:23 wmcbrine Exp $"); extern unsigned char atrtab[MAX_ATRTAB]; @@ -279,56 +279,6 @@ int PDC_putctty(chtype character, chtype color) return OK; } -/*man-start************************************************************** - - PDC_scroll() - low level screen scroll - - PDCurses Description: - Scrolls a window in the current page up or down. Urow, lcol, - lrow, rcol are the window coordinates. Lines is the number of - lines to scroll. If 0, clears the window, if < 0 scrolls down, - if > 0 scrolls up. Blanks areas that are left, and sets - character attributes to attr. If in a colour graphics mode, - fills them with the colour 'attr' instead. - - PDCurses Return Value: - The PDC_scroll() function returns OK on success otherwise ERR is - returned. - - Portability: - PDCurses int PDC_scroll(int urow, int lcol, int rcol, - int nlines, chtype attr); - -**man-end****************************************************************/ - -int PDC_scroll(int urow, int lcol, int lrow, int rcol, int nlines, chtype attr) -{ - int phys_attr = chtype_attr(attr); - - PDC_LOG(("PDC_scroll() - called: urow %d lcol %d lrow %d " - "rcol %d nlines %d\n", urow, lcol, lrow, rcol, nlines)); - - if (nlines >= 0) - { - regs.h.ah = 0x06; - regs.h.al = (unsigned char) nlines; - } - else - { - regs.h.ah = 0x07; - regs.h.al = (unsigned char) (-nlines); - } - - regs.h.bh = (unsigned char)(phys_attr >> 8); - regs.h.ch = (unsigned char) urow; - regs.h.cl = (unsigned char) lcol; - regs.h.dh = (unsigned char) lrow; - regs.h.dl = (unsigned char) rcol; - int86(0x10, ®s, ®s); - - return OK; -} - /*man-start************************************************************** PDC_transform_line() - display a physical line of the screen diff --git a/os2/pdcdisp.c b/os2/pdcdisp.c index 3386b31f..7fd11b2d 100644 --- a/os2/pdcdisp.c +++ b/os2/pdcdisp.c @@ -19,7 +19,7 @@ #include #include -RCSID("$Id: pdcdisp.c,v 1.26 2006/07/15 16:07:05 wmcbrine Exp $"); +RCSID("$Id: pdcdisp.c,v 1.27 2006/07/15 20:46:23 wmcbrine Exp $"); extern unsigned char atrtab[MAX_ATRTAB]; @@ -192,63 +192,6 @@ int PDC_putctty(chtype character, chtype color) return OK; } -/*man-start************************************************************** - - PDC_scroll() - low level screen scroll - - PDCurses Description: - Scrolls a window in the current page up or down. Urow, lcol, - lrow, rcol are the window coordinates. Lines is the number of - lines to scroll. If 0, clears the window, if < 0 scrolls down, - if > 0 scrolls up. Blanks areas that are left, and sets - character attributes to attr. If in a colour graphics mode, - fills them with the colour 'attr' instead. - - PDCurses Return Value: - The PDC_scroll() function returns OK on success otherwise ERR is - returned. - - Portability: - PDCurses int PDC_scroll(int urow, int lcol, int rcol, - int nlines, chtype attr); - -**man-end****************************************************************/ - -int PDC_scroll(int urow, int lcol, int lrow, int rcol, int nlines, chtype attr) -{ - int phys_attr = chtype_attr(attr); - -#ifndef EMXVIDEO - USHORT ch = (phys_attr | SP->blank); -#endif - - PDC_LOG(("PDC_scroll() - called: urow %d lcol %d lrow %d " - "rcol %d nlines %d\n", urow, lcol, lrow, rcol, nlines)); - -#ifdef EMXVIDEO - v_attrib(phys_attr); - - if (nlines > 0) - v_scroll(lcol, urow, rcol, lrow, nlines, V_SCROLL_UP); - else - if (nlines < 0) - v_scroll(lcol, urow, rcol, lrow, -nlines, - V_SCROLL_DOWN); - else /* this clears the whole screen */ - v_scroll(lcol, urow, rcol, lrow, -1, V_SCROLL_CLEAR); -#else - if (nlines > 0) - VioScrollUp(urow, lcol, lrow, rcol, nlines, (PBYTE)&ch, 0); - else - if (nlines < 0) - VioScrollDn(urow, lcol, lrow, rcol, nlines, - (PBYTE)&ch, 0); - else /* this clears the whole screen ?? */ - VioScrollUp(0, 0, -1, -1, -1, (PBYTE)&ch, 0); -#endif - return OK; -} - /*man-start************************************************************** PDC_transform_line() - display a physical line of the screen diff --git a/pdcurses/beep.c b/pdcurses/beep.c index 2c0f7703..a8256c0a 100644 --- a/pdcurses/beep.c +++ b/pdcurses/beep.c @@ -27,7 +27,7 @@ # undef wrefresh #endif -RCSID("$Id: beep.c,v 1.20 2006/07/15 15:38:24 wmcbrine Exp $"); +RCSID("$Id: beep.c,v 1.21 2006/07/15 20:46:23 wmcbrine Exp $"); /*man-start************************************************************** @@ -73,15 +73,21 @@ int beep(void) int flash(void) { + int z, y, x; + PDC_LOG(("flash() - called\n")); -#ifdef XCURSES - XCursesInstructAndWait(CURSES_FLASH); -#else - PDC_scroll(0, 0, LINES - 1, COLS - 1, 0, A_NORMAL); - napms(50); - PDC_scroll(0, 0, LINES - 1, COLS - 1, 0, A_REVERSE); - wrefresh(curscr); -#endif + for (z = 0; z < 2; z++) { + + for (y = 0; y < LINES; y++) + for (x = 0; x < COLS; x++) + curscr->_y[y][x] ^= A_REVERSE; + + wrefresh(curscr); + + if (!z) + napms(50); + } + return OK; } diff --git a/win32/curses.def b/win32/curses.def index e52ebdf1..cb2a2226 100644 --- a/win32/curses.def +++ b/win32/curses.def @@ -295,7 +295,6 @@ EXPORTS PDC_putc EXPORTS PDC_putctty EXPORTS PDC_query_adapter_type EXPORTS PDC_rawgetch -EXPORTS PDC_scroll EXPORTS PDC_scr_close EXPORTS PDC_scr_open EXPORTS PDC_setclipboard diff --git a/win32/curses_lcc.def b/win32/curses_lcc.def index 34486228..602fbab0 100644 --- a/win32/curses_lcc.def +++ b/win32/curses_lcc.def @@ -288,7 +288,6 @@ PDC_putc PDC_putctty PDC_query_adapter_type PDC_rawgetch -PDC_scroll PDC_scr_close PDC_scr_open PDC_setclipboard diff --git a/win32/pdcdisp.c b/win32/pdcdisp.c index e0f7a3ea..8a10f4ac 100644 --- a/win32/pdcdisp.c +++ b/win32/pdcdisp.c @@ -24,7 +24,7 @@ extern HANDLE hConOut; extern unsigned char atrtab[MAX_ATRTAB]; -RCSID("$Id: pdcdisp.c,v 1.25 2006/07/15 16:07:06 wmcbrine Exp $"); +RCSID("$Id: pdcdisp.c,v 1.26 2006/07/15 20:46:23 wmcbrine Exp $"); /*man-start************************************************************** @@ -195,36 +195,6 @@ int PDC_putctty(chtype character, chtype color) return PDC_putc(character, color); } -/*man-start************************************************************** - - PDC_scroll() - low level screen scroll - - PDCurses Description: - Scrolls a window in the current page up or down. Urow, lcol, - lrow, rcol are the window coordinates. Lines is the number of - lines to scroll. If 0, clears the window, if < 0 scrolls down, - if > 0 scrolls up. Blanks areas that are left, and sets - character attributes to attr. If in a colour graphics mode, - fills them with the colour 'attr' instead. - - PDCurses Return Value: - The PDC_scroll() function returns OK on success otherwise ERR is - returned. - - Portability: - PDCurses int PDC_scroll(int urow, int lcol, int rcol, - int nlines, chtype attr); - -**man-end****************************************************************/ - -int PDC_scroll(int urow, int lcol, int lrow, int rcol, int nlines, chtype attr) -{ - PDC_LOG(("PDC_scroll() - called: urow %d lcol %d lrow %d " - "rcol %d nlines %d\n", urow, lcol, lrow, rcol, nlines)); - - return OK; -} - /*man-start************************************************************** PDC_transform_line() - display a physical line of the screen diff --git a/x11/process/x11.c b/x11/process/x11.c index 63d7594b..309b84ae 100644 --- a/x11/process/x11.c +++ b/x11/process/x11.c @@ -19,7 +19,7 @@ #include -RCSID("$Id: x11.c,v 1.49 2006/07/08 00:21:41 wmcbrine Exp $"); +RCSID("$Id: x11.c,v 1.50 2006/07/15 20:46:24 wmcbrine Exp $"); int visible_cursor = 0; int windowEntered = 1; @@ -211,25 +211,6 @@ void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid, XClearWindow(XCURSESDISPLAY, XCURSESWIN); break; - case CURSES_FLASH: - XC_LOG(("CURSES_FLASH received from child\n")); -#if 0 - XFillRectangle(XCURSESDISPLAY, XCURSESWIN, - normal_highlight_gc, 10, 10, - XCursesWindowWidth - 10, XCursesWindowHeight - 10); - - napms(50); - - XFillRectangle(XCURSESDISPLAY, XCURSESWIN, - normal_highlight_gc, 10, 10, - XCursesWindowWidth - 10, XCursesWindowHeight - 10); - - XCursesDisplayCursor(SP->cursrow, SP->curscol, - SP->cursrow, SP->curscol); -#endif - XCursesContinue(); - break; - /* request from curses to confirm completion of display */ case CURSES_REFRESH: