diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index 35f125d8..2aa92ba4 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -144,5 +144,7 @@ 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 db80547f..36c03c75 100644 --- a/x11/pdcutil.c +++ b/x11/pdcutil.c @@ -6,6 +6,8 @@ # include #endif +bool pdc_dirty = FALSE; + void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -17,6 +19,12 @@ 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 abaece07..741e8543 100644 --- a/x11/pdcx11.h +++ b/x11/pdcx11.h @@ -183,7 +183,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_EXIT + CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_DISPLAY_ALL, CURSES_EXIT }; extern short *xc_atrtab; + +extern bool pdc_dirty; diff --git a/x11/x11.c b/x11/x11.c index 425677ea..172752e8 100644 --- a/x11/x11.c +++ b/x11/x11.c @@ -2303,11 +2303,7 @@ static void _set_color(void) _exit_process(4, SIGKILL, "exiting from _set_color"); if (XAllocColor(XCURSESDISPLAY, cmap, tmp)) - { colors[index] = tmp->pixel; - - _display_screen(); - } } /* For PDC_getclipboard() */ @@ -2652,6 +2648,11 @@ 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 2cdb863a..ae69ecea 100644 --- a/x11new/pdcscrn.c +++ b/x11new/pdcscrn.c @@ -130,5 +130,7 @@ 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 8072bd49..f415b123 100644 --- a/x11new/pdcutil.c +++ b/x11new/pdcutil.c @@ -6,6 +6,8 @@ # include #endif +bool pdc_dirty = FALSE; + void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -17,6 +19,12 @@ 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 1e30ecf4..0a38157a 100644 --- a/x11new/pdcx11.h +++ b/x11new/pdcx11.h @@ -170,9 +170,10 @@ 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_EXIT + CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_DISPLAY_ALL, 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 ec5c217a..2edac67f 100644 --- a/x11new/x11.c +++ b/x11new/x11.c @@ -2087,11 +2087,7 @@ static void _set_color(void) _exit_process(4, SIGKILL, "exiting from _set_color"); if (XAllocColor(XCURSESDISPLAY, cmap, tmp)) - { colors[index] = tmp->pixel; - - _display_screen(); - } } /* For PDC_getclipboard() */ @@ -2294,6 +2290,11 @@ 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)); }