summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2019-03-20 20:05:29 (GMT)
committerculler <culler>2019-03-20 20:05:29 (GMT)
commit9aba30314f2d23fe5a6ac36d7c12d056fa286ab9 (patch)
treede28c077e24962230cb1936dbb7eca6a16b9450a /macosx
parent91c351387c0e9dbfa5f5ae1c32a1c05bb88959cc (diff)
downloadtk-9aba30314f2d23fe5a6ac36d7c12d056fa286ab9.zip
tk-9aba30314f2d23fe5a6ac36d7c12d056fa286ab9.tar.gz
tk-9aba30314f2d23fe5a6ac36d7c12d056fa286ab9.tar.bz2
Avoid caching semantic colors so they will respond to appearance changes
when used, e.g, in a canvas.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXColor.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 5f3264b..3ca813c 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -202,6 +202,7 @@ static const struct SystemColorMapEntry systemColorMap[] = {
{ "DisabledControlTextColor", ttkForeground, 2 }, /* 176 */
{ NULL, 0, 0 }
};
+#define FIRST_SEMANTIC_COLOR 166
#define MAX_PIXELCODE 176
/*
@@ -404,7 +405,7 @@ TkSetMacColor(
* Results:
* None resp. retained CGColorRef for CopyCachedColor()
*
- * Side effects:
+ * Side effects:M
* None.
*
*----------------------------------------------------------------------
@@ -568,16 +569,19 @@ TkMacOSXSetColorInContext(
CGContextRef context)
{
OSStatus err = noErr;
- CGColorRef cgColor = CopyCachedColor(gc, pixel);
+ CGColorRef cgColor = nil;
struct SystemColorMapEntry entry;
CGRect rect;
+ int code = (pixel >> 24) & 0xff;
HIThemeBackgroundDrawInfo info = { 0, kThemeStateActive, entry.value };
static CGColorSpaceRef deviceRGBSpace = NULL;
if (!deviceRGBSpace) {
deviceRGBSpace = CGColorSpaceCreateDeviceRGB();
}
-
- if (!cgColor && GetEntryFromPixelCode((pixel >> 24) & 0xff, &entry)) {
+ if (code < FIRST_SEMANTIC_COLOR) {
+ cgColor = CopyCachedColor(gc, pixel);
+ }
+ if (!cgColor && GetEntryFromPixelCode(code, &entry)) {
switch (entry.type) {
case HIBrush:
err = ChkErr(HIThemeSetFill, entry.value, NULL, context,