summaryrefslogtreecommitdiffstats
path: root/win/tkWinColor.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-12-12 16:24:28 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-12-12 16:24:28 (GMT)
commit871d0ab87051648f1dcc4fc86445dcde3527c7b2 (patch)
tree3913fec9e26d903dd2d66da3c9010d72391394be /win/tkWinColor.c
parentefae1b799e7c55c25fcda6f682415a8fd6e2a25f (diff)
downloadtk-871d0ab87051648f1dcc4fc86445dcde3527c7b2.zip
tk-871d0ab87051648f1dcc4fc86445dcde3527c7b2.tar.gz
tk-871d0ab87051648f1dcc4fc86445dcde3527c7b2.tar.bz2
WIP: Add support for C++
Diffstat (limited to 'win/tkWinColor.c')
-rw-r--r--win/tkWinColor.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index 8a1273a..78e3b6c 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -173,7 +173,7 @@ TkpGetColor(
&& FindSystemColor(name+6, &color, &index))
|| TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), name,
&color)) {
- winColPtr = ckalloc(sizeof(WinColor));
+ winColPtr = (WinColor *)ckalloc(sizeof(WinColor));
winColPtr->info.color = color;
winColPtr->index = index;
@@ -211,7 +211,7 @@ TkpGetColorByValue(
XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
- WinColor *tkColPtr = ckalloc(sizeof(WinColor));
+ WinColor *tkColPtr = (WinColor *)ckalloc(sizeof(WinColor));
tkColPtr->info.color.red = colorPtr->red;
tkColPtr->info.color.green = colorPtr->green;
@@ -307,6 +307,7 @@ XAllocColor(
TkWinColormap *cmap = (TkWinColormap *) colormap;
PALETTEENTRY entry, closeEntry;
HDC dc = GetDC(NULL);
+ (void)display;
entry.peRed = (color->red) >> 8;
entry.peGreen = (color->green) >> 8;
@@ -316,7 +317,7 @@ XAllocColor(
if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
unsigned long sizePalette = GetDeviceCaps(dc, SIZEPALETTE);
UINT newPixel, closePixel;
- int new;
+ int isNew;
size_t refCount;
Tcl_HashEntry *entryPtr;
UINT index;
@@ -358,8 +359,8 @@ XAllocColor(
color->pixel = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue);
entryPtr = Tcl_CreateHashEntry(&cmap->refCounts,
- INT2PTR(color->pixel), &new);
- if (new) {
+ INT2PTR(color->pixel), &isNew);
+ if (isNew) {
refCount = 1;
} else {
refCount = (size_t)Tcl_GetHashValue(entryPtr) + 1;
@@ -414,6 +415,8 @@ XFreeColors(
PALETTEENTRY entry, *entries;
Tcl_HashEntry *entryPtr;
HDC dc = GetDC(NULL);
+ (void)display;
+ (void)planes;
/*
* We don't have to do anything for non-palette devices.
@@ -436,7 +439,7 @@ XFreeColors(
GetPaletteEntries(cmap->palette, index, 1, &entry);
if (cref == RGB(entry.peRed, entry.peGreen, entry.peBlue)) {
count = cmap->size - index;
- entries = ckalloc(sizeof(PALETTEENTRY) * count);
+ entries = (PALETTEENTRY *)ckalloc(sizeof(PALETTEENTRY) * count);
GetPaletteEntries(cmap->palette, index+1, count, entries);
SetPaletteEntries(cmap->palette, index, count, entries);
ckfree(entries);
@@ -482,9 +485,13 @@ XCreateColormap(
PALETTEENTRY *entryPtr;
TkWinColormap *cmap;
Tcl_HashEntry *hashPtr;
- int new;
+ int isNew;
UINT i;
HPALETTE sysPal;
+ (void)display;
+ (void)w;
+ (void)visual;
+ (void)alloc;
/*
* Allocate a starting palette with all of the reserved colors.
@@ -496,7 +503,7 @@ XCreateColormap(
logPalettePtr->palNumEntries = GetPaletteEntries(sysPal, 0, 256,
logPalettePtr->palPalEntry);
- cmap = ckalloc(sizeof(TkWinColormap));
+ cmap = (TkWinColormap *)ckalloc(sizeof(TkWinColormap));
cmap->size = logPalettePtr->palNumEntries;
cmap->stale = 0;
cmap->palette = CreatePalette(logPalettePtr);
@@ -509,7 +516,7 @@ XCreateColormap(
for (i = 0; i < logPalettePtr->palNumEntries; i++) {
entryPtr = logPalettePtr->palPalEntry + i;
hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(PALETTERGB(
- entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &new);
+ entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &isNew);
Tcl_SetHashValue(hashPtr, INT2PTR(1));
}
@@ -539,6 +546,7 @@ XFreeColormap(
Colormap colormap)
{
TkWinColormap *cmap = (TkWinColormap *) colormap;
+ (void)display;
if (!DeleteObject(cmap->palette)) {
Tcl_Panic("Unable to free colormap, palette is still selected");