Remote changes at Mon Aug 7 14:17:12 EDT 2017 by chuan on vivaldi

This commit is contained in:
Chuan Chen 2017-08-07 14:17:12 -04:00
parent 01b1832e23
commit 9bd159f1c8
1 changed files with 761 additions and 759 deletions

View File

@ -58,8 +58,9 @@ XVisualInfo *grVisualInfo;
//TOGL_CURRENT toglCurrent= {(Tk_Font)0, 0, 0, 0, 0, //TOGL_CURRENT toglCurrent= {(Tk_Font)0, 0, 0, 0, 0,
// (Tk_Window)0, (Window)0, (MagWindow *)NULL}; // (Tk_Window)0, (Window)0, (MagWindow *)NULL};
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
};
/* This is kind of a long story, and very kludgy, but the following /* This is kind of a long story, and very kludgy, but the following
* things need to be defined as externals because of the way lint * things need to be defined as externals because of the way lint
@ -95,8 +96,8 @@ extern void toglSetProjection();
void void
grtoglSetWMandC (mask, c) grtoglSetWMandC (mask, c)
int mask; /* New value for write mask */ int mask; /* New value for write mask */
int c; /* New value for current color */ int c; /* New value for current color */
{ {
static int oldColor = -1; static int oldColor = -1;
static int oldMask = -1; static int oldMask = -1;
@ -158,7 +159,7 @@ grtoglSetWMandC (mask, c)
void void
grtoglSetLineStyle (style) grtoglSetLineStyle (style)
int style; /* New stipple pattern for lines. */ int style; /* New stipple pattern for lines. */
{ {
static int oldStyle = -1; static int oldStyle = -1;
GLushort glstyle; GLushort glstyle;
@ -196,8 +197,8 @@ grtoglSetLineStyle (style)
void void
grtoglSetSPattern (sttable, numstipples) grtoglSetSPattern (sttable, numstipples)
int **sttable; /* The table of patterns */ int **sttable; /* The table of patterns */
int numstipples; /* Number of stipples */ int numstipples; /* Number of stipples */
{ {
int i, j, k, n; int i, j, k, n;
GLubyte *pdata; GLubyte *pdata;
@ -233,7 +234,7 @@ grtoglSetSPattern (sttable, numstipples)
void void
grtoglSetStipple (stipple) grtoglSetStipple (stipple)
int stipple; /* The stipple number to be used. */ int stipple; /* The stipple number to be used. */
{ {
static int oldStip = -1; static int oldStip = -1;
if (stipple == oldStip) return; if (stipple == oldStip) return;
@ -332,7 +333,7 @@ GrTCairoInit ()
grNumBitPlanes = tcairoCurrent.depth; grNumBitPlanes = tcairoCurrent.depth;
grBitPlaneMask = (1 << tcairoCurrent.depth) - 1; grBitPlaneMask = (1 << tcairoCurrent.depth) - 1;
HashInit(&grTOGLWindowTable,8,HT_WORDKEYS); HashInit(&grTOGLWindowTable, 8, HT_WORDKEYS);
return grTkLoadFont(); return grTkLoadFont();
} }
@ -397,9 +398,9 @@ Pixmap cairopmap = (Pixmap)NULL;
void void
tcairoSetProjection(llx, lly, width, height) tcairoSetProjection(llx, lly, width, height)
int llx, lly, width, height; int llx, lly, width, height;
{ {
if (toglCurrent.mw->w_flags & WIND_OFFSCREEN) if (tcairoCurrent.mw->w_flags & WIND_OFFSCREEN)
{ {
/* /*
if (glpmap != None) glXDestroyGLXPixmap(grXdpy, glpmap); if (glpmap != None) glXDestroyGLXPixmap(grXdpy, glpmap);
@ -407,8 +408,9 @@ tcairoSetProjection(llx, lly, width, height)
(Pixmap)toglCurrent.windowid); (Pixmap)toglCurrent.windowid);
glXMakeCurrent(grXdpy, (GLXDrawable)glpmap, grXcontext); glXMakeCurrent(grXdpy, (GLXDrawable)glpmap, grXcontext);
*/ */
cairopmap = XCreatePixmap(grXdpy, grXscrn, width, height, toglCurrent.depth); cairopmap = XCreatePixmap(grXdpy, grXscrn, width, height, tcairoCurrent.depth);
cairo_set_source(grCairoContext); grCairoSurface = cairo_xlib_surface_create(grXdpy, cairopmap, grVisualInfo->visual, width, height);
//cairo_set_source(grCairoContext);
} }
else else
glXMakeCurrent(grXdpy, (GLXDrawable)toglCurrent.windowid, grXcontext); glXMakeCurrent(grXdpy, (GLXDrawable)toglCurrent.windowid, grXcontext);
@ -468,8 +470,8 @@ tcairoSetProjection(llx, lly, width, height)
void void
TOGLEventProc(clientData, xevent) TOGLEventProc(clientData, xevent)
ClientData clientData; ClientData clientData;
XEvent *xevent; XEvent *xevent;
{ {
TxInputEvent *event; TxInputEvent *event;
HashEntry *entry; HashEntry *entry;
@ -518,7 +520,7 @@ TOGLEventProc(clientData, xevent)
nbytes = 0; nbytes = 0;
entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind); entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind);
mw = (entry)?(MagWindow *)HashGetValue(entry):0; mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0;
if (mw && (mw->w_flags & WIND_SCROLLBARS)) if (mw && (mw->w_flags & WIND_SCROLLBARS))
if (WindButtonInFrame(mw, ButtonEvent->x, if (WindButtonInFrame(mw, ButtonEvent->x,
@ -541,7 +543,7 @@ TOGLEventProc(clientData, xevent)
if (IsModifierKey(keysym)) break; /* Don't handle modifiers */ if (IsModifierKey(keysym)) break; /* Don't handle modifiers */
entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind); entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind);
mw = (entry)?(MagWindow *)HashGetValue(entry):0; mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0;
keys_and_buttons: keys_and_buttons:
@ -808,7 +810,7 @@ keys_and_buttons:
height = ConfigureEvent->height; height = ConfigureEvent->height;
entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind); entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind);
mw = (entry)?(MagWindow *)HashGetValue(entry):0; mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0;
screenRect.r_xbot = ConfigureEvent->x; screenRect.r_xbot = ConfigureEvent->x;
screenRect.r_xtop = ConfigureEvent->x + width; screenRect.r_xtop = ConfigureEvent->x + width;
@ -832,9 +834,9 @@ keys_and_buttons:
XVisibilityEvent *VisEvent = (XVisibilityEvent*) xevent; XVisibilityEvent *VisEvent = (XVisibilityEvent*) xevent;
entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind); entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind);
mw = (entry)?(MagWindow *)HashGetValue(entry):0; mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0;
switch(VisEvent->state) switch (VisEvent->state)
{ {
case VisibilityUnobscured: case VisibilityUnobscured:
mw->w_flags &= ~WIND_OBSCURED; mw->w_flags &= ~WIND_OBSCURED;
@ -861,11 +863,11 @@ keys_and_buttons:
Rect screenRect; Rect screenRect;
entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind); entry = HashLookOnly(&grTOGLWindowTable, (char *)tkwind);
mw = (entry)?(MagWindow *)HashGetValue(entry):0; mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0;
screenRect.r_xbot = ExposeEvent->x; screenRect.r_xbot = ExposeEvent->x;
screenRect.r_xtop = ExposeEvent->x+ExposeEvent->width; screenRect.r_xtop = ExposeEvent->x + ExposeEvent->width;
screenRect.r_ytop = mw->w_allArea.r_ytop-ExposeEvent->y; screenRect.r_ytop = mw->w_allArea.r_ytop - ExposeEvent->y;
screenRect.r_ybot = mw->w_allArea.r_ytop - screenRect.r_ybot = mw->w_allArea.r_ytop -
(ExposeEvent->y + ExposeEvent->height); (ExposeEvent->y + ExposeEvent->height);
@ -919,9 +921,9 @@ keys_and_buttons:
bool bool
oglSetDisplay (dispType, outFileName, mouseFileName) oglSetDisplay (dispType, outFileName, mouseFileName)
char *dispType; char *dispType;
char *outFileName; char *outFileName;
char *mouseFileName; char *mouseFileName;
{ {
char *planecount; char *planecount;
char *fullname; char *fullname;
@ -1002,7 +1004,7 @@ oglSetDisplay (dispType, outFileName, mouseFileName)
return FALSE; return FALSE;
} }
if(!GrTOGLInit()){ if (!GrTOGLInit()) {
return FALSE; return FALSE;
}; };
@ -1035,8 +1037,8 @@ extern void MakeWindowCommand();
bool bool
GrTOGLCreate(w, name) GrTOGLCreate(w, name)
MagWindow *w; MagWindow *w;
char *name; char *name;
{ {
Tk_Window tkwind, tktop; Tk_Window tkwind, tktop;
Window wind; Window wind;
@ -1056,19 +1058,19 @@ GrTOGLCreate(w, name)
sprintf(windowname, ".magic%d", WindowNumber + 1); sprintf(windowname, ".magic%d", WindowNumber + 1);
if (windowplace = XGetDefault(grXdpy, "magic", windowname)) if (windowplace = XGetDefault(grXdpy, "magic", windowname))
{ {
XParseGeometry(windowplace,&x,&y, XParseGeometry(windowplace, &x, &y,
(unsigned int *)&width,(unsigned int *)&height); (unsigned int *)&width, (unsigned int *)&height);
w->w_frameArea.r_xbot = x; w->w_frameArea.r_xbot = x;
w->w_frameArea.r_xtop = x+width; w->w_frameArea.r_xtop = x + width;
w->w_frameArea.r_ytop = glTransYs(y); w->w_frameArea.r_ytop = glTransYs(y);
w->w_frameArea.r_ybot = glTransYs(y+height); w->w_frameArea.r_ybot = glTransYs(y + height);
WindReframe(w,&(w->w_frameArea),FALSE,FALSE); WindReframe(w, &(w->w_frameArea), FALSE, FALSE);
} }
grAttributes.colormap = XCreateColormap(grXdpy, RootWindow(grXdpy, grXscrn), grAttributes.colormap = XCreateColormap(grXdpy, RootWindow(grXdpy, grXscrn),
grVisualInfo->visual, AllocNone); grVisualInfo->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);
if (tktop = Tk_MainWindow(magicinterp)) if (tktop = Tk_MainWindow(magicinterp))
{ {
@ -1118,7 +1120,7 @@ GrTOGLCreate(w, name)
w->w_grdata = (ClientData) tkwind; w->w_grdata = (ClientData) tkwind;
entry = HashFind(&grTOGLWindowTable, (char *)tkwind); entry = HashFind(&grTOGLWindowTable, (char *)tkwind);
HashSetValue(entry,w); HashSetValue(entry, w);
/* ensure that the visual is what we wanted, if possible to change */ /* ensure that the visual is what we wanted, if possible to change */
@ -1184,14 +1186,14 @@ GrTOGLCreate(w, name)
void void
GrTOGLDelete(w) GrTOGLDelete(w)
MagWindow *w; MagWindow *w;
{ {
Tk_Window xw; Tk_Window xw;
HashEntry *entry; HashEntry *entry;
xw = (Tk_Window) w->w_grdata; xw = (Tk_Window) w->w_grdata;
entry = HashLookOnly(&grTOGLWindowTable, (char *)xw); entry = HashLookOnly(&grTOGLWindowTable, (char *)xw);
HashSetValue(entry,NULL); HashSetValue(entry, NULL);
Tcl_DeleteCommand(magicinterp, Tk_PathName(xw)); Tcl_DeleteCommand(magicinterp, Tk_PathName(xw));
Tk_DestroyWindow(xw); Tk_DestroyWindow(xw);
@ -1214,7 +1216,7 @@ GrTOGLDelete(w)
void void
GrTOGLConfigure(w) GrTOGLConfigure(w)
MagWindow *w; MagWindow *w;
{ {
if (w->w_flags & WIND_OFFSCREEN) return; if (w->w_flags & WIND_OFFSCREEN) return;
@ -1242,7 +1244,7 @@ GrTOGLConfigure(w)
void void
GrTOGLRaise(w) GrTOGLRaise(w)
MagWindow *w; MagWindow *w;
{ {
Tk_Window tkwind; Tk_Window tkwind;
@ -1270,7 +1272,7 @@ GrTOGLRaise(w)
void void
GrTOGLLower(w) GrTOGLLower(w)
MagWindow *w; MagWindow *w;
{ {
Tk_Window tkwind; Tk_Window tkwind;
@ -1299,8 +1301,8 @@ GrTOGLLower(w)
void void
GrTOGLLock(w, flag) GrTOGLLock(w, flag)
MagWindow *w; MagWindow *w;
bool flag; bool flag;
{ {
Window wind; Window wind;
@ -1344,7 +1346,7 @@ GrTOGLLock(w, flag)
void void
GrTOGLUnlock(w) GrTOGLUnlock(w)
MagWindow *w; MagWindow *w;
{ {
/* GR_TOGL_FLUSH_BATCH(); */ /* GR_TOGL_FLUSH_BATCH(); */
GrTOGLFlush(); /* (?) Adds glFlush and glFinish to the above. */ GrTOGLFlush(); /* (?) Adds glFlush and glFinish to the above. */
@ -1397,9 +1399,9 @@ GrTOGLEventPending()
*/ */
void void
GrTOGLIconUpdate(w,text) /* See Blt code */ GrTOGLIconUpdate(w, text) /* See Blt code */
MagWindow *w; MagWindow *w;
char *text; char *text;
{ {
Tk_Window tkwind; Tk_Window tkwind;
Window wind; Window wind;
@ -1422,18 +1424,18 @@ GrTOGLIconUpdate(w,text) /* See Blt code */
XSetClassHint( grXdpy, wind, &class); XSetClassHint( grXdpy, wind, &class);
if (text) if (text)
{ {
if (brack = strchr(text,'[')) if (brack = strchr(text, '['))
{ {
brack--; brack--;
*brack = 0; *brack = 0;
XSetIconName(grXdpy,wind,text); XSetIconName(grXdpy, wind, text);
XStoreName(grXdpy,wind,text); XStoreName(grXdpy, wind, text);
*brack = ' '; *brack = ' ';
return; return;
} }
if (brack = strrchr(text,' ')) text = brack+1; if (brack = strrchr(text, ' ')) text = brack + 1;
XSetIconName(grXdpy,wind,text); XSetIconName(grXdpy, wind, text);
XStoreName(grXdpy,wind,text); XStoreName(grXdpy, wind, text);
} }
} }
@ -1453,7 +1455,7 @@ GrTOGLIconUpdate(w,text) /* See Blt code */
int int
GrTOGLWindowId(tkname) GrTOGLWindowId(tkname)
char *tkname; char *tkname;
{ {
Tk_Window tkwind; Tk_Window tkwind;
MagWindow *mw; MagWindow *mw;