From 94182c8cfab3be677b6a0f7175e80cec5b5ca63d Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sun, 28 Jan 2018 11:26:09 -0500 Subject: [PATCH] The standard-defined behavior of A_PROTECT (though rarely implemented) is nothing like what PDCurses was doing, which IMHO was not useful. --- curses.h | 4 +--- demos/testcurs.c | 4 ---- doc/intro.md | 3 +-- sdl1/pdcscrn.c | 5 ++--- sdl2/pdcscrn.c | 5 ++--- win32/pdcscrn.c | 2 +- x11/x11.c | 3 ++- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/curses.h b/curses.h index 31e820c6..38c225d7 100644 --- a/curses.h +++ b/curses.h @@ -411,8 +411,6 @@ bits), 8 bits for other attributes, and 16 bits for character data. # define A_CHARTEXT (chtype)0x0000ffff # define A_COLOR (chtype)0xff000000 -# define A_PROTECT (A_UNDERLINE | A_LEFT | A_RIGHT) - # define PDC_COLOR_SHIFT 24 #else # define A_BOLD (chtype)0x0100 /* X/Open */ @@ -424,7 +422,6 @@ bits), 8 bits for other attributes, and 16 bits for character data. # define A_COLOR (chtype)0xf800 /* System V */ # define A_ALTCHARSET A_NORMAL /* X/Open */ -# define A_PROTECT A_NORMAL /* X/Open */ # define A_UNDERLINE A_NORMAL /* X/Open */ # define A_LEFT A_NORMAL @@ -440,6 +437,7 @@ bits), 8 bits for other attributes, and 16 bits for character data. #define A_DIM A_NORMAL #define A_INVIS A_NORMAL +#define A_PROTECT A_NORMAL #define CHR_MSK A_CHARTEXT /* Obsolete */ #define ATR_MSK A_ATTRIBUTES /* Obsolete */ diff --git a/demos/testcurs.c b/demos/testcurs.c index b7c09cba..88d25632 100644 --- a/demos/testcurs.c +++ b/demos/testcurs.c @@ -1066,10 +1066,6 @@ void attrTest(WINDOW *win) attrset(A_NORMAL); #endif - attrset(A_PROTECT); - mvaddstr(tmarg + 13, col2, "A_PROTECT"); - attrset(A_NORMAL); - mvaddstr(tmarg + 16, 3, "Press any key to continue"); getch(); diff --git a/doc/intro.md b/doc/intro.md index a36f8df9..04541229 100644 --- a/doc/intro.md +++ b/doc/intro.md @@ -129,8 +129,7 @@ For chtype: A_INVIS invisible -- no effect in PDCurses A_ITALIC italic A_LEFT line along the left edge - A_PROTECT protected (?) -- PDCurses renders this as a - combination of the *LINE attributes + A_PROTECT protected -- no effect in PDCurses A_REVERSE reverse video A_RIGHT line along the right edge A_STANDOUT terminal's best highlighting mode diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index 8c369e6a..f8e7801d 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -293,10 +293,9 @@ int PDC_scr_open(int argc, char **argv) SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = FALSE; + SP->termattrs = A_COLOR | A_UNDERLINE | A_LEFT | A_RIGHT | A_REVERSE; #ifdef PDC_WIDE - SP->termattrs = A_COLOR | A_ITALIC | A_PROTECT | A_REVERSE; -#else - SP->termattrs = A_COLOR | A_PROTECT | A_REVERSE; + SP->termattrs |= A_ITALIC; #endif PDC_reset_prog_mode(); diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index cce8f1f2..d46f71c4 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -307,10 +307,9 @@ int PDC_scr_open(int argc, char **argv) SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = FALSE; + SP->termattrs = A_COLOR | A_UNDERLINE | A_LEFT | A_RIGHT | A_REVERSE; #ifdef PDC_WIDE - SP->termattrs = A_COLOR | A_ITALIC | A_PROTECT | A_REVERSE; -#else - SP->termattrs = A_COLOR | A_PROTECT | A_REVERSE; + SP->termattrs |= A_ITALIC; #endif PDC_reset_prog_mode(); diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index f8203589..75c0b6fc 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -446,7 +446,7 @@ int PDC_scr_open(int argc, char **argv) /* ENABLE_LVB_GRID_WORLDWIDE */ result = SetConsoleMode(pdc_con_out, 0x0010); if (result) - SP->termattrs |= A_PROTECT|A_REVERSE; + SP->termattrs |= A_UNDERLINE | A_LEFT | A_RIGHT | A_REVERSE; PDC_reset_prog_mode(); diff --git a/x11/x11.c b/x11/x11.c index a2f3984a..c4673a52 100644 --- a/x11/x11.c +++ b/x11/x11.c @@ -3155,7 +3155,8 @@ int XCursesSetupX(int argc, char *argv[]) SP->mouse_wait = xc_app_data.clickPeriod; SP->audible = TRUE; - SP->termattrs = A_COLOR | A_ITALIC | A_PROTECT | A_REVERSE; + SP->termattrs = A_COLOR | A_ITALIC | A_UNDERLINE | A_LEFT | A_RIGHT | + A_REVERSE; PDC_LOG(("%s:SHM size for curscr %d\n", XCLOGMSG, SP->XcurscrSize));