mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-23 07:15:05 +00:00
Hold back screen updates due to palette changes in X11 until paused.
This relies on a general screen "dirtying" mechanism that might have other uses.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
# include <poll.h>
|
||||
#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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
# include <poll.h>
|
||||
#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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user