summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2020-07-31 20:34:29 (GMT)
committerculler <culler>2020-07-31 20:34:29 (GMT)
commit76f6c8ed20f1b31eb53111b9ad3363f3998c271c (patch)
tree5a765af95a899b0b23a04f288e352b4aafe82d5e /macosx
parentf75f4370274d507d9b3488cece85d3e49df019e4 (diff)
downloadtk-76f6c8ed20f1b31eb53111b9ad3363f3998c271c.zip
tk-76f6c8ed20f1b31eb53111b9ad3363f3998c271c.tar.gz
tk-76f6c8ed20f1b31eb53111b9ad3363f3998c271c.tar.bz2
Remove an unused function. Deal with colors which are not supported on older systems (10.9)
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXColor.c31
-rw-r--r--macosx/tkMacOSXColor.h8
2 files changed, 14 insertions, 25 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 370e8a5..b77adf3 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -1,5 +1,5 @@
/*
- * tkMacOSXColor.c --
+ * TkMacOSXColor.c --
*
* This file maintains a database of color values for the Tk
* toolkit, in order to avoid round-trips to the server to
@@ -59,6 +59,8 @@ void initColorTable()
if ([colorName isEqualToString:@"controlAccentColor"]) {
useFakeAccentColor = YES;
} else {
+ /* Uncomment to print all unsupported colors: */
+ /* printf("Unsupported color %s\n", colorName.UTF8String); */
continue;
}
}
@@ -83,6 +85,9 @@ void initColorTable()
for (hPtr = Tcl_FirstHashEntry(&systemColors, &search); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&search)) {
entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ if (entry == NULL) {
+ Tcl_Panic("Unsupported semantic color with no supported backup!");
+ }
systemColorIndex[entry->index] = entry;
}
@@ -639,30 +644,6 @@ TkMacOSXSetColorInContext(
}
}
-
-/*
- * Recompute the red, green and blue values of an XColor from its pixel value.
- * To do this we need to know which window the color is being used in, so we
- * can figure out if that window is in dark mode or not. And we will probably
- * need to involve drawRect somehow since the correct color values are only
- * available when a valid graphics context is available.
- */
-
-MODULE_SCOPE
-void TkMacOSXUpdateXColor(
- XColor *color,
- Tk_Window tkwin)
-{
- MacPixel p;
- SystemColorDatum *entry = GetEntryFromPixel(color->pixel);
-
- p.ulong = color->pixel;
- if (p.pixel.colortype == semantic || p.pixel.colortype == ttkBackground) {
- printf("Updating %s in window %s for %s Mode\n",
- entry->name, Tk_PathName(tkwin),
- TkMacOSXInDarkMode(tkwin) ? "Dark" : "Light");
- }
-}
/*
*----------------------------------------------------------------------
*
diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h
index 9cbe8a3..82c88c9 100644
--- a/macosx/tkMacOSXColor.h
+++ b/macosx/tkMacOSXColor.h
@@ -80,6 +80,13 @@ typedef struct {
NSString *selector;
} SystemColorDatum;
+/*
+ * WARNING: Semantic colors which are not supported on all systems must be
+ * preceded by a backup color with the same name which *is* supported. Systems
+ * which do support the color will replace the backup value when the table is
+ * constructed. Failing to ensure this will result in a Tcl_Panic abort.
+ */
+
static SystemColorDatum systemColorData[] = {
{"Pixel", rgbColor, 0 },
{"Transparent", clearColor, 0 },
@@ -237,6 +244,7 @@ static SystemColorDatum systemColorData[] = {
{"TextColor", semantic, 0, "textColor" },
{"SelectedTextColor", semantic, 0, "selectedTextColor" },
+{"LabelColor", semantic, 0, "textColor"},
{"LabelColor", semantic, 0, "labelColor"},
{"ControlTextColor", semantic, 0, "controlTextColor" },
{"DisabledControlTextColor", semantic, 0, "disabledControlTextColor" },