Merge branch 'work' into tomerge

This commit is contained in:
Tim Edwards 2017-10-12 10:42:45 -04:00
commit 0e3825ef75
1 changed files with 16 additions and 14 deletions

View File

@ -47,7 +47,7 @@
uint8_t **grTCairoStipples; uint8_t **grTCairoStipples;
HashTable grTCairoWindowTable; HashTable grTCairoWindowTable;
XVisualInfo *grVisualInfo; XVisualInfo *grTCairoVisualInfo;
TCAIRO_CURRENT tcairoCurrent = {(Tk_Font)0, 0, 0, 0, 0, TCAIRO_CURRENT tcairoCurrent = {(Tk_Font)0, 0, 0, 0, 0,
(Tk_Window)0, (Window)0, (MagWindow *)NULL (Tk_Window)0, (Window)0, (MagWindow *)NULL
@ -274,16 +274,17 @@ GrTCairoInit ()
int gritems; int gritems;
grtemplate.screen = grXscrn; grtemplate.screen = grXscrn;
grtemplate.depth = 0; grtemplate.depth = 0;
grVisualInfo = XGetVisualInfo(grXdpy, VisualScreenMask, &grtemplate, &gritems); grTCairoVisualInfo = XGetVisualInfo(grXdpy, VisualScreenMask,
&grtemplate, &gritems);
if (!grVisualInfo) if (!grTCairoVisualInfo)
{ {
TxError("No suitable visual!\n"); TxError("No suitable visual!\n");
return FALSE; return FALSE;
} }
grXscrn = grVisualInfo->screen; grXscrn = grTCairoVisualInfo->screen;
tcairoCurrent.depth = grVisualInfo->depth; tcairoCurrent.depth = grTCairoVisualInfo->depth;
/* Use OpenGL names for colormap and dstyle file types */ /* Use OpenGL names for colormap and dstyle file types */
grCMapType = "OpenGL"; grCMapType = "OpenGL";
@ -311,7 +312,7 @@ void
GrTCairoClose () GrTCairoClose ()
{ {
if (grXdpy == NULL) return; if (grXdpy == NULL) return;
if (grVisualInfo != NULL) XFree(grVisualInfo); if (grTCairoVisualInfo != NULL) XFree(grTCairoVisualInfo);
grTkFreeFonts(); grTkFreeFonts();
/* Pop down Tk window but let Tcl/Tk */ /* Pop down Tk window but let Tcl/Tk */
@ -362,7 +363,7 @@ int llx, lly, width, height;
if (tcairodata == NULL) { if (tcairodata == NULL) {
tcairodata = (TCairoData *)mallocMagic(sizeof(TCairoData)); tcairodata = (TCairoData *)mallocMagic(sizeof(TCairoData));
tcairodata->surface = cairo_xlib_surface_create(grXdpy, tcairodata->surface = cairo_xlib_surface_create(grXdpy,
tcairoCurrent.windowid, grVisualInfo->visual, tcairoCurrent.windowid, grTCairoVisualInfo->visual,
width, height); width, height);
tcairodata->context = cairo_create(tcairodata->surface); tcairodata->context = cairo_create(tcairodata->surface);
tcairodata->backing_context = (ClientData)NULL; tcairodata->backing_context = (ClientData)NULL;
@ -1022,7 +1023,7 @@ char *name;
} }
grAttributes.colormap = XCreateColormap(grXdpy, RootWindow(grXdpy, grXscrn), grAttributes.colormap = XCreateColormap(grXdpy, RootWindow(grXdpy, grXscrn),
grVisualInfo->visual, AllocNone); grTCairoVisualInfo->visual, AllocNone);
grAttributes.background_pixel = WhitePixel(grXdpy, grXscrn); grAttributes.background_pixel = WhitePixel(grXdpy, grXscrn);
grAttributes.border_pixel = BlackPixel(grXdpy, grXscrn); grAttributes.border_pixel = BlackPixel(grXdpy, grXscrn);
@ -1030,13 +1031,14 @@ char *name;
{ {
if (!WindowNumber) if (!WindowNumber)
{ {
/* To do: deal with grVisualInfo---destroy and recreate top */ /* To do: deal with grTCairoVisualInfo---destroy and recreate top */
/* frame if necessary */ /* frame if necessary */
if (Tk_WindowId(tktop) == 0) if (Tk_WindowId(tktop) == 0)
{ {
Tk_SetWindowVisual(tktop, grVisualInfo->visual, Tk_SetWindowVisual(tktop, grTCairoVisualInfo->visual,
tcairoCurrent.depth, grAttributes.colormap); tcairoCurrent.depth,
grAttributes.colormap);
} }
else else
{ {
@ -1084,8 +1086,8 @@ char *name;
/* ensure that the visual is what we wanted, if possible to change */ /* ensure that the visual is what we wanted, if possible to change */
Tk_SetWindowVisual(tkwind, grVisualInfo->visual, tcairoCurrent.depth, Tk_SetWindowVisual(tkwind, grTCairoVisualInfo->visual,
grAttributes.colormap); tcairoCurrent.depth, grAttributes.colormap);
/* map the window, if necessary */ /* map the window, if necessary */
@ -1099,7 +1101,7 @@ char *name;
wind = Tk_WindowId(tkwind); wind = Tk_WindowId(tkwind);
tcairoCurrent.windowid = wind; tcairoCurrent.windowid = wind;
tcairodata->surface = cairo_xlib_surface_create(grXdpy, tcairodata->surface = cairo_xlib_surface_create(grXdpy,
tcairoCurrent.windowid, grVisualInfo->visual, tcairoCurrent.windowid, grTCairoVisualInfo->visual,
Tk_Width(tcairoCurrent.window), Tk_Width(tcairoCurrent.window),
Tk_Height(tcairoCurrent.window)); Tk_Height(tcairoCurrent.window));
tcairodata->context = cairo_create(tcairodata->surface); tcairodata->context = cairo_create(tcairodata->surface);