From 9bfddf13686ef635722a5e1d4044205eb937c696 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Fri, 2 Aug 2019 18:27:09 -0400 Subject: [PATCH] Consolidate the dirtying. --- curspriv.h | 1 + pdcurses/color.c | 2 ++ pdcurses/kernel.c | 7 +++++++ sdl1/pdcscrn.c | 2 -- sdl1/pdcsdl.h | 1 - sdl1/pdcutil.c | 8 -------- sdl2/pdcscrn.c | 2 -- sdl2/pdcsdl.h | 1 - sdl2/pdcutil.c | 8 -------- wincon/pdcscrn.c | 2 -- wincon/pdcutil.c | 8 -------- wincon/pdcwin.h | 2 +- x11/pdcscrn.c | 2 -- x11/pdcutil.c | 8 -------- x11/pdcx11.h | 4 +--- x11/x11.c | 5 ----- x11new/pdcscrn.c | 2 -- x11new/pdcutil.c | 8 -------- x11new/pdcx11.h | 3 +-- x11new/x11.c | 5 ----- 20 files changed, 13 insertions(+), 68 deletions(-) diff --git a/curspriv.h b/curspriv.h index 5697a42d..4f8e6981 100644 --- a/curspriv.h +++ b/curspriv.h @@ -47,6 +47,7 @@ extern FILE *pdc_dbfp; /* tracing file pointer (NULL = off) */ extern bool pdc_color_started; extern unsigned long pdc_key_modifiers; extern MOUSE_STATUS pdc_mouse_status; +extern bool pdc_dirty; /* redraw on napms() after init_color() */ /*----------------------------------------------------------------------*/ diff --git a/pdcurses/color.c b/pdcurses/color.c index 48b38031..9ee5bf4e 100644 --- a/pdcurses/color.c +++ b/pdcurses/color.c @@ -186,6 +186,8 @@ int init_color(short color, short red, short green, short blue) blue < -1 || blue > 1000) return ERR; + pdc_dirty = TRUE; + return PDC_init_color(color, red, green, blue); } diff --git a/pdcurses/kernel.c b/pdcurses/kernel.c index 6b88d8fe..29b246f5 100644 --- a/pdcurses/kernel.c +++ b/pdcurses/kernel.c @@ -87,6 +87,7 @@ kernel RIPPEDOFFLINE linesripped[5]; char linesrippedoff = 0; +bool pdc_dirty = FALSE; static struct cttyset { @@ -227,6 +228,12 @@ int napms(int ms) if (!SP) return ERR; + if (pdc_dirty) + { + pdc_dirty = FALSE; + wrefresh(curscr); + } + if (ms) PDC_napms(ms); diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index 96535c28..928c5915 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -384,8 +384,6 @@ int PDC_color_content(short color, short *red, short *green, short *blue) int PDC_init_color(short color, short red, short green, short blue) { - pdc_dirty = TRUE; - pdc_color[color].r = DIVROUND(red * 255, 1000); pdc_color[color].g = DIVROUND(green * 255, 1000); pdc_color[color].b = DIVROUND(blue * 255, 1000); diff --git a/sdl1/pdcsdl.h b/sdl1/pdcsdl.h index 7371532b..25209275 100644 --- a/sdl1/pdcsdl.h +++ b/sdl1/pdcsdl.h @@ -28,7 +28,6 @@ extern bool pdc_own_screen; /* if pdc_screen was not set before initscr(), PDCurses is responsible for (owns) it */ extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ -extern bool pdc_dirty; /* redraw on napms() after init_color() */ PDCEX void PDC_update_rects(void); PDCEX void PDC_retile(void); diff --git a/sdl1/pdcutil.c b/sdl1/pdcutil.c index 0f3138dd..78b06ad4 100644 --- a/sdl1/pdcutil.c +++ b/sdl1/pdcutil.c @@ -2,8 +2,6 @@ #include "pdcsdl.h" -bool pdc_dirty = FALSE; - void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -13,12 +11,6 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); - if (pdc_dirty) - { - pdc_dirty = FALSE; - wrefresh(curscr); - } - PDC_update_rects(); SDL_PumpEvents(); SDL_Delay(ms); diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index 13ea1f4d..5d8afdd1 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -418,8 +418,6 @@ int PDC_color_content(short color, short *red, short *green, short *blue) int PDC_init_color(short color, short red, short green, short blue) { - pdc_dirty = TRUE; - pdc_color[color].r = DIVROUND(red * 255, 1000); pdc_color[color].g = DIVROUND(green * 255, 1000); pdc_color[color].b = DIVROUND(blue * 255, 1000); diff --git a/sdl2/pdcsdl.h b/sdl2/pdcsdl.h index 0eac62f7..357b4429 100644 --- a/sdl2/pdcsdl.h +++ b/sdl2/pdcsdl.h @@ -29,7 +29,6 @@ extern bool pdc_own_window; /* if pdc_window was not set before initscr(), PDCurses is responsible for (owns) it */ extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ -extern bool pdc_dirty; /* redraw on napms() after init_color() */ PDCEX void PDC_update_rects(void); PDCEX void PDC_retile(void); diff --git a/sdl2/pdcutil.c b/sdl2/pdcutil.c index 0df45fef..3f0e9dc3 100644 --- a/sdl2/pdcutil.c +++ b/sdl2/pdcutil.c @@ -2,8 +2,6 @@ #include "pdcsdl.h" -bool pdc_dirty = FALSE; - void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -13,12 +11,6 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); - if (pdc_dirty) - { - pdc_dirty = FALSE; - wrefresh(curscr); - } - PDC_update_rects(); SDL_PumpEvents(); SDL_Delay(ms); diff --git a/wincon/pdcscrn.c b/wincon/pdcscrn.c index d2584a0a..e6640a37 100644 --- a/wincon/pdcscrn.c +++ b/wincon/pdcscrn.c @@ -699,8 +699,6 @@ int PDC_color_content(short color, short *red, short *green, short *blue) int PDC_init_color(short color, short red, short green, short blue) { - pdc_dirty = TRUE; - if (red == -1 && green == -1 && blue == -1) { pdc_color[color].mapped = FALSE; diff --git a/wincon/pdcutil.c b/wincon/pdcutil.c index 08a9efc7..a40cf451 100644 --- a/wincon/pdcutil.c +++ b/wincon/pdcutil.c @@ -2,8 +2,6 @@ #include "pdcwin.h" -bool pdc_dirty = FALSE; - void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -16,12 +14,6 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); - if (pdc_dirty) - { - pdc_dirty = FALSE; - wrefresh(curscr); - } - if ((SP->termattrs & A_BLINK) && (GetTickCount() >= pdc_last_blink + 500)) PDC_blink_text(); diff --git a/wincon/pdcwin.h b/wincon/pdcwin.h index b065155f..dab1f76b 100644 --- a/wincon/pdcwin.h +++ b/wincon/pdcwin.h @@ -22,6 +22,6 @@ extern DWORD pdc_quick_edit; extern DWORD pdc_last_blink; extern short pdc_curstoreal[16], pdc_curstoansi[16]; extern short pdc_oldf, pdc_oldb, pdc_oldu; -extern bool pdc_conemu, pdc_ansi, pdc_dirty; +extern bool pdc_conemu, pdc_ansi; extern void PDC_blink_text(void); diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index 2aa92ba4..35f125d8 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -144,7 +144,5 @@ int PDC_init_color(short color, short red, short green, short blue) XCursesInstructAndWait(CURSES_SET_COLOR); - pdc_dirty = TRUE; - return OK; } diff --git a/x11/pdcutil.c b/x11/pdcutil.c index 36c03c75..db80547f 100644 --- a/x11/pdcutil.c +++ b/x11/pdcutil.c @@ -6,8 +6,6 @@ # include #endif -bool pdc_dirty = FALSE; - void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -19,12 +17,6 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); - if (pdc_dirty) - { - pdc_dirty = FALSE; - XCursesInstruct(CURSES_DISPLAY_ALL); - } - #if defined(HAVE_USLEEP) usleep(1000 * ms); diff --git a/x11/pdcx11.h b/x11/pdcx11.h index 930e4004..fa5fd22c 100644 --- a/x11/pdcx11.h +++ b/x11/pdcx11.h @@ -182,9 +182,7 @@ enum CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR, CURSES_RESIZE, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR, CURSES_CHILD, CURSES_REFRESH, CURSES_GET_COLOR, CURSES_SET_COLOR, - CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_DISPLAY_ALL, CURSES_EXIT + CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_EXIT }; extern short *xc_atrtab; - -extern bool pdc_dirty; diff --git a/x11/x11.c b/x11/x11.c index 84acf0ed..6bac006e 100644 --- a/x11/x11.c +++ b/x11/x11.c @@ -2631,11 +2631,6 @@ static void _process_curses_requests(XtPointer client_data, int *fid, _resume_curses(); break; - case CURSES_DISPLAY_ALL: - XC_LOG(("CURSES_DISPLAY_ALL recieved from child\n")); - _display_screen(); - break; - default: PDC_LOG(("%s:Unknown request %d\n", XCLOGMSG, num_cols)); } diff --git a/x11new/pdcscrn.c b/x11new/pdcscrn.c index ae69ecea..2cdb863a 100644 --- a/x11new/pdcscrn.c +++ b/x11new/pdcscrn.c @@ -130,7 +130,5 @@ int PDC_init_color(short color, short red, short green, short blue) XCursesInstructAndWait(CURSES_SET_COLOR); - pdc_dirty = TRUE; - return OK; } diff --git a/x11new/pdcutil.c b/x11new/pdcutil.c index f415b123..8072bd49 100644 --- a/x11new/pdcutil.c +++ b/x11new/pdcutil.c @@ -6,8 +6,6 @@ # include #endif -bool pdc_dirty = FALSE; - void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -19,12 +17,6 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); - if (pdc_dirty) - { - pdc_dirty = FALSE; - XCursesInstruct(CURSES_DISPLAY_ALL); - } - XSync(XtDisplay(topLevel), False); #if defined(HAVE_USLEEP) diff --git a/x11new/pdcx11.h b/x11new/pdcx11.h index 389ddace..228a8a90 100644 --- a/x11new/pdcx11.h +++ b/x11new/pdcx11.h @@ -169,10 +169,9 @@ enum CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR, CURSES_RESIZE, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR, CURSES_CHILD, CURSES_REFRESH, CURSES_GET_COLOR, CURSES_SET_COLOR, - CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_DISPLAY_ALL, CURSES_EXIT + CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_EXIT }; extern short *xc_atrtab; extern bool xc_resize_now; -extern bool pdc_dirty; diff --git a/x11new/x11.c b/x11new/x11.c index 34a5c54d..1923d293 100644 --- a/x11new/x11.c +++ b/x11new/x11.c @@ -2278,11 +2278,6 @@ void XCursesProcessRequest(int req) _set_color(); break; - case CURSES_DISPLAY_ALL: - XC_LOG(("CURSES_DISPLAY_ALL recieved from child\n")); - _display_screen(); - break; - default: PDC_LOG(("%s:Unknown request %d\n", XCLOGMSG, num_cols)); }