summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-24 15:23:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-24 15:23:16 (GMT)
commit97a31b80b8c9dd4d9a19984a9b709af0265d4c43 (patch)
treefcea170d4a9247efb33059020fe52f2c61643194 /generic
parent473ed169135beac6352af2c5f61cca5d404ccf51 (diff)
parentc1d2b9d95856fe913236eec23533b0bd522726d3 (diff)
downloadtk-97a31b80b8c9dd4d9a19984a9b709af0265d4c43.zip
tk-97a31b80b8c9dd4d9a19984a9b709af0265d4c43.tar.gz
tk-97a31b80b8c9dd4d9a19984a9b709af0265d4c43.tar.bz2
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvPs.c4
-rw-r--r--generic/tkCmds.c14
-rw-r--r--generic/tkImgPhInstance.c22
-rw-r--r--generic/tkInt.h4
-rw-r--r--generic/tkVisual.c20
5 files changed, 34 insertions, 30 deletions
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 6cfcf52..2598d4e 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -1279,7 +1279,7 @@ TkPostscriptImage(
cdata.colors = ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
- if (visual->class == DirectColor || visual->class == TrueColor) {
+ if (visual->c_class == DirectColor || visual->c_class == TrueColor) {
cdata.separated = 1;
cdata.red_mask = visual->red_mask;
cdata.green_mask = visual->green_mask;
@@ -1311,7 +1311,7 @@ TkPostscriptImage(
}
}
- if (visual->class == StaticGray || visual->class == GrayScale) {
+ if (visual->c_class == StaticGray || visual->c_class == GrayScale) {
cdata.color = 0;
} else {
cdata.color = 1;
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index f0abd70..3de0078 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -1285,7 +1285,7 @@ Tk_WinfoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int index, x, y, width, height, useX, useY, class, skip;
+ int index, x, y, width, height, useX, useY, c_class, skip;
const char *string;
TkWindow *winPtr;
Tk_Window tkwin = clientData;
@@ -1496,7 +1496,7 @@ Tk_WinfoObjCmd(
Tcl_NewWideIntObj(WidthMMOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENVISUAL:
- class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class;
+ c_class = DefaultVisualOfScreen(Tk_Screen(tkwin))->c_class;
goto visual;
case WIN_SERVER:
TkGetServerInfo(interp, tkwin);
@@ -1524,10 +1524,10 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUAL:
- class = Tk_Visual(tkwin)->class;
+ c_class = Tk_Visual(tkwin)->c_class;
visual:
- string = TkFindStateString(visualMap, class);
+ string = TkFindStateString(visualMap, c_class);
if (string == NULL) {
string = "unknown";
}
@@ -1790,15 +1790,15 @@ Tk_WinfoObjCmd(
}
resultPtr = Tcl_NewObj();
for (i = 0; i < count; i++) {
- string = TkFindStateString(visualMap, visInfoPtr[i].class);
+ string = TkFindStateString(visualMap, visInfoPtr[i].c_class);
if (string == NULL) {
strcpy(buf, "unknown");
} else {
sprintf(buf, "%s %d", string, visInfoPtr[i].depth);
}
if (includeVisualId) {
- sprintf(visualIdString, " 0x%x",
- (unsigned) visInfoPtr[i].visualid);
+ sprintf(visualIdString, " 0x%lx",
+ (unsigned long) visInfoPtr[i].visualid);
strcat(buf, visualIdString);
}
strPtr = Tcl_NewStringObj(buf, -1);
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 1360d1e..edb6cd5 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -309,7 +309,7 @@ TkImgPhotoGet(
nGreen = nBlue = 0;
mono = 1;
instancePtr->visualInfo = *visInfoPtr;
- switch (visInfoPtr->class) {
+ switch (visInfoPtr->c_class) {
case DirectColor:
case TrueColor:
nRed = 1 << CountBits(visInfoPtr->red_mask);
@@ -645,7 +645,7 @@ TkImgPhotoDisplay(
if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
- && (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
+ && (visInfo.c_class == DirectColor || visInfo.c_class == TrueColor)) {
Tk_ErrorHandler handler;
XImage *bgImg = NULL;
@@ -948,7 +948,7 @@ IsValidPalette(
mono = 0;
}
- switch (instancePtr->visualInfo.class) {
+ switch (instancePtr->visualInfo.c_class) {
case DirectColor:
case TrueColor:
if ((nRed > (1 << CountBits(instancePtr->visualInfo.red_mask)))
@@ -1212,8 +1212,8 @@ AllocateColors(
* store them in *colors.
*/
- if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ if ((colorPtr->visualInfo.c_class == DirectColor)
+ || (colorPtr->visualInfo.c_class == TrueColor)) {
/*
* Direct/True Color: allocate shades of red, green, blue
@@ -1367,8 +1367,8 @@ AllocateColors(
*/
#ifndef _WIN32
- if ((colorPtr->visualInfo.class != DirectColor)
- && (colorPtr->visualInfo.class != TrueColor)) {
+ if ((colorPtr->visualInfo.c_class != DirectColor)
+ && (colorPtr->visualInfo.c_class != TrueColor)) {
colorPtr->flags |= MAP_COLORS;
}
#endif /* _WIN32 */
@@ -1394,8 +1394,8 @@ AllocateColors(
} else {
g = (i * (nGreen - 1) + 127) / 255;
b = (i * (nBlue - 1) + 127) / 255;
- if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ if ((colorPtr->visualInfo.c_class == DirectColor)
+ || (colorPtr->visualInfo.c_class == TrueColor)) {
colorPtr->redValues[i] =
colors[r].pixel & colorPtr->visualInfo.red_mask;
colorPtr->greenValues[i] =
@@ -1653,8 +1653,8 @@ TkImgDitherInstance(
* DirectColor with many colors).
*/
- if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ if ((colorPtr->visualInfo.c_class == DirectColor)
+ || (colorPtr->visualInfo.c_class == TrueColor)) {
int nRed, nGreen, nBlue, result;
result = sscanf(colorPtr->id.palette, "%d/%d/%d", &nRed,
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 608ee74..889700c 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1334,6 +1334,10 @@ MODULE_SCOPE Status TkParseColor (Display * display,
MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
#endif
+#if !defined(__cplusplus) && !defined(c_plusplus)
+# define c_class class
+#endif
+
#if TCL_UTF_MAX > 4
# define TkUtfToUniChar (size_t)Tcl_UtfToUniChar
# define TkUniCharToUtf (size_t)Tcl_UniCharToUtf
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 427e946..51ae3be 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -20,10 +20,10 @@
*/
typedef struct VisualDictionary {
- const char *name; /* Textual name of class. */
+ char name[12]; /* Textual name of class. */
unsigned short minLength; /* Minimum # characters that must be specified
* for an unambiguous match. */
- short class; /* X symbol for class. */
+ short c_class; /* X symbol for class. */
} VisualDictionary;
static const VisualDictionary visualNames[] = {
{"best", 1, 0},
@@ -35,7 +35,7 @@ static const VisualDictionary visualNames[] = {
{"staticgray", 7, StaticGray},
{"staticgrey", 7, StaticGray},
{"truecolor", 1, TrueColor},
- {NULL, 0, 0},
+ {"", 0, 0},
};
/*
@@ -145,7 +145,7 @@ Tk_GetVisual(
return visual;
}
template.depth = Tk_Depth(tkwin2);
- template.class = visual->class;
+ template.c_class = visual->c_class;
template.red_mask = visual->red_mask;
template.green_mask = visual->green_mask;
template.blue_mask = visual->blue_mask;
@@ -192,20 +192,20 @@ Tk_GetVisual(
}
}
length = p - string;
- template.class = -1;
- for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
+ template.c_class = -1;
+ for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) {
if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength)
&& (strncmp(string, dictPtr->name, length) == 0)) {
- template.class = dictPtr->class;
+ template.c_class = dictPtr->c_class;
break;
}
}
- if (template.class == -1) {
+ if (template.c_class == -1) {
Tcl_Obj *msgObj = Tcl_ObjPrintf(
"unknown or ambiguous visual name \"%s\": class must be ",
string);
- for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
+ for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) {
Tcl_AppendPrintfToObj(msgObj, "%s, ", dictPtr->name);
}
Tcl_AppendToObj(msgObj, "or default", -1);
@@ -261,7 +261,7 @@ Tk_GetVisual(
bestPrio = 0;
bestPtr = NULL;
for (i = 0; i < numVisuals; i++) {
- switch (visInfoList[i].class) {
+ switch (visInfoList[i].c_class) {
case DirectColor:
prio = 5; break;
case GrayScale: