1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-15 15:57:13 +00:00

Implement foreground/background reversal for X displays on the (VIDEOCOLOR T) function, as it works on D-machines.

Ref: https://github.com/Interlisp/maiko/issues/12

	modified:   src/xlspwin.c
This commit is contained in:
Nick Briggs 2020-08-13 18:14:34 -07:00
parent fe32f6bf09
commit f4024ab126

View File

@ -276,16 +276,38 @@ void Create_LispWindow(DspInterface dsp)
void lisp_Xvideocolor(int flag)
{
XLOCK;
XCopyArea(currentdsp->display_id, currentdsp->DisplayWindow, currentdsp->DisplayWindow,
currentdsp->Copy_GC, 0, 0, currentdsp->Visible.width, currentdsp->Visible.height, 0,
0);
Screen *screen;
XEvent event;
unsigned long newForeground;
XLOCK;
screen = ScreenOfDisplay(currentdsp->display_id, DefaultScreen(currentdsp->display_id));
newForeground = flag ? WhitePixelOfScreen(screen) : BlackPixelOfScreen(screen);
/* window -- are we making a change? */
XGetGCValues(currentdsp->display_id, currentdsp->Copy_GC, GCForeground | GCBackground, &gcv);
if (newForeground != gcv.foreground) {
/* swap foreground and background in the graphics context*/
gcv.background = gcv.foreground;
gcv.foreground = newForeground;
XChangeGC(currentdsp->display_id, currentdsp->Copy_GC, GCForeground | GCBackground, &gcv);
/* notify the display code to refresh the visible screen with new fg/bg colors */
event.type = Expose;
event.xexpose.window = currentdsp->DisplayWindow;
event.xexpose.x = 0;
event.xexpose.y = 0;
event.xexpose.width = currentdsp->Visible.width;
event.xexpose.height = currentdsp->Visible.height;
XSendEvent(currentdsp->display_id, currentdsp->DisplayWindow, True, 0, &event);
}
#if 0
/* Cursor */
gcv.function = GXcopy;
XChangeGC(currentdsp->display_id, cursor_source_gc, GCFunction, &gcv);
/* JDS 011213: Remember set_xcursor does 15-y val, so do it here! */
Set_XCursor(Current_Hot_X, 15 - Current_Hot_Y);
#endif
XFlush(currentdsp->display_id);
XUNLOCK;