summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/tkMacOSXButton.c5
-rw-r--r--macosx/tkMacOSXColor.c64
-rw-r--r--tests/frame.test7
3 files changed, 43 insertions, 33 deletions
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index ac3c122..1b40e5e 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -185,7 +185,10 @@ TkpDisplayButton(
Pixmap pixmap;
DrawParams* dpPtr = &macButtonPtr->drawParams;
int needhighlight = 0;
-
+
+ if (butPtr->flags & BUTTON_DELETED) {
+ return;
+ }
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
return;
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 8372ccc..cb3bde3 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -265,9 +265,9 @@ GetEntryFromPixelCode(
*/
static NSColorSpace* deviceRGB = NULL;
-static CGFloat blueAccentRGBA[4] = {0, 122.0/255, 1.0, 1.0};
-static CGFloat graphiteAccentRGBA[4] = {152.0/255, 152.0/255, 152.0/255, 1.0};
-static CGFloat windowBackground[4] = {236.0/255, 236.0/255, 236.0/255, 1.0};
+static CGFloat blueAccentRGBA[4] = {0, 122.0 / 255, 1.0, 1.0};
+static CGFloat windowBackground[4] =
+ {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
static OSStatus
SetCGColorComponents(
@@ -278,7 +278,11 @@ SetCGColorComponents(
OSStatus err = noErr;
NSColor *bgColor, *color;
CGFloat rgba[4] = {0, 0, 0, 1};
- NSInteger colorVariant = 1;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
+ NSInteger colorVariant;
+ static CGFloat graphiteAccentRGBA[4] =
+ {152.0 / 255, 152.0 / 255, 152.0 / 255, 1.0};
+#endif
if (!deviceRGB) {
deviceRGB = [NSColorSpace deviceRGBColorSpace];
@@ -318,11 +322,11 @@ SetCGColorComponents(
}
if (rgba[0] + rgba[1] + rgba[2] < 1.5) {
for (int i=0; i<3; i++) {
- rgba[i] += entry.value*8.0/255.0;
+ rgba[i] += entry.value*8.0 / 255.0;
}
} else {
for (int i=0; i<3; i++) {
- rgba[i] -= entry.value*8.0/255.0;
+ rgba[i] -= entry.value*8.0 / 255.0;
}
}
break;
@@ -335,7 +339,7 @@ SetCGColorComponents(
color = [[NSColor selectedTextColor] colorUsingColorSpace: deviceRGB];
break;
case 2:
-#if MAC_OS_X_VERSION_MIN_REQUIRED > 101000
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
color = [[NSColor labelColor] colorUsingColorSpace: deviceRGB];
#else
color = [[NSColor textColor] colorUsingColorSpace: deviceRGB];
@@ -367,31 +371,28 @@ SetCGColorComponents(
deviceRGB];
break;
case 8:
- if ([NSApp macMinorVersion] >= 14) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
- if (@available(macOS 10.14, *)) {
- color = [[NSColor controlAccentColor] colorUsingColorSpace:
- deviceRGB];
- break;
- } else {
- color = [NSColor colorWithColorSpace: deviceRGB
- components: blueAccentRGBA
- count: 4];
- }
-#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ if (@available(macOS 10.14, *)) {
+ color = [[NSColor controlAccentColor] colorUsingColorSpace:
+ deviceRGB];
} else {
- colorVariant = [[NSUserDefaults standardUserDefaults]
- integerForKey:@"AppleAquaColorVariant"];
- if (colorVariant == 6) {
- color = [NSColor colorWithColorSpace: deviceRGB
- components: graphiteAccentRGBA
- count: 4];
- } else {
- color = [NSColor colorWithColorSpace: deviceRGB
- components: blueAccentRGBA
- count: 4];
- }
+ color = [NSColor colorWithColorSpace: deviceRGB
+ components: blueAccentRGBA
+ count: 4];
}
+#else
+ colorVariant = [[NSUserDefaults standardUserDefaults]
+ integerForKey:@"AppleAquaColorVariant"];
+ if (colorVariant == 6) {
+ color = [NSColor colorWithColorSpace: deviceRGB
+ components: graphiteAccentRGBA
+ count: 4];
+ } else {
+ color = [NSColor colorWithColorSpace: deviceRGB
+ components: blueAccentRGBA
+ count: 4];
+ }
+#endif
break;
default:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
@@ -674,7 +675,7 @@ TkMacOSXSetColorInContext(
struct SystemColorMapEntry entry;
CGRect rect;
int code = (pixel >> 24) & 0xff;
- HIThemeBackgroundDrawInfo info = { 0, kThemeStateActive, entry.value };
+ HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};;
static CGColorSpaceRef deviceRGBSpace = NULL;
if (!deviceRGBSpace) {
@@ -698,6 +699,7 @@ TkMacOSXSetColorInContext(
kHIThemeOrientationNormal);
break;
case HIBackground:
+ info.kind = entry.value;
rect = CGContextGetClipBoundingBox(context);
err = ChkErr(HIThemeApplyBackground, &rect, &info,
context, kHIThemeOrientationNormal);
diff --git a/tests/frame.test b/tests/frame.test
index 45a91b3..e374326 100644
--- a/tests/frame.test
+++ b/tests/frame.test
@@ -664,11 +664,16 @@ test frame-3.9 {TkCreateFrame procedure, -use option} -constraints {
wm geometry .t +0+0
toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green
tkwait visibility .x
- update idletasks
list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
[expr {[winfo rooty .x] - [winfo rooty .t]}] \
[winfo width .t] [winfo height .t]
} -cleanup {
+# This call to update idletasks was added to prevent a crash that was
+# observed on OSX 10.12 (Sierra) only. Any change, such as using the
+# Development version to make debugging symbols available, adding a print
+# statement, or calling update idletasks here, would make the test pass
+# with no segfault.
+ update idletasks
deleteWindows
} -result {0 0 140 300}
test frame-3.10 {TkCreateFrame procedure, -use option} -constraints {