summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXButton.c4
-rw-r--r--macosx/tkMacOSXColor.c12
-rw-r--r--macosx/tkMacOSXDialog.c2
-rw-r--r--macosx/tkMacOSXInit.c10
-rw-r--r--macosx/tkMacOSXMenus.c2
-rw-r--r--macosx/tkMacOSXMouseEvent.c2
-rw-r--r--macosx/tkMacOSXPrivate.h4
-rw-r--r--macosx/tkMacOSXScrlbr.c4
-rw-r--r--macosx/tkMacOSXTest.c2
-rw-r--r--macosx/tkMacOSXWindowEvent.c2
-rw-r--r--macosx/tkMacOSXWm.c12
-rw-r--r--macosx/ttkMacOSXTheme.c32
12 files changed, 46 insertions, 42 deletions
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index aa45895..7ca8c10 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -399,7 +399,7 @@ TkpComputeButtonGeometry(
width += butPtr->inset*2;
height += butPtr->inset*2;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
width += 12;
}
if (mbPtr->btnkind == kThemePushButton) {
@@ -1063,7 +1063,7 @@ TkMacOSXComputeButtonParams(
* the button periodically.
*/
- if (!mbPtr->defaultPulseHandler && ([NSApp macMinorVersion] <= 9)) {
+ if (!mbPtr->defaultPulseHandler && ([NSApp macOSVersion] <= 100900)) {
mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler(
PULSE_TIMER_MSECS, PulseDefaultButtonProc, butPtr);
}
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 40b537e..80f3b21 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -308,7 +308,7 @@ SetCGColorComponents(
* windowBackGroundColor.
*/
- if ([NSApp macMinorVersion] < 14) {
+ if ([NSApp macOSVersion] < 101400) {
for (int i=0; i<3; i++) {
rgba[i] = windowBackground[i];
}
@@ -335,7 +335,7 @@ SetCGColorComponents(
color = [[NSColor selectedTextColor] colorUsingColorSpace:sRGB];
break;
case 2:
- if ([NSApp macMinorVersion] > 9) {
+ if ([NSApp macOSVersion] > 100900) {
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
color = [[NSColor labelColor] colorUsingColorSpace:sRGB];
#endif
@@ -351,7 +351,7 @@ SetCGColorComponents(
colorUsingColorSpace:sRGB];
break;
case 5:
- if ([NSApp macMinorVersion] > 6) {
+ if ([NSApp macOSVersion] > 100600) {
color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
} else {
color = [[NSColor blackColor] colorUsingColorSpace:sRGB];
@@ -378,7 +378,7 @@ SetCGColorComponents(
}
break;
case 9:
- if ([NSApp macMinorVersion] >= 10) {
+ if ([NSApp macOSVersion] >= 101000) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
color = [[NSColor linkColor] colorUsingColorSpace:sRGB];
#endif
@@ -387,7 +387,7 @@ SetCGColorComponents(
}
break;
default:
- if ([NSApp macMinorVersion] >= 10) {
+ if ([NSApp macOSVersion] >= 101000) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
color = [[NSColor labelColor] colorUsingColorSpace:sRGB];
#endif
@@ -442,7 +442,7 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
static NSAppearanceName darkAqua = @"NSAppearanceNameDarkAqua";
- if ([NSApp macMinorVersion] >= 14) {
+ if ([NSApp macOSVersion] >= 101400) {
TkWindow *winPtr = (TkWindow*) tkwin;
NSView *view = nil;
if (winPtr && winPtr->privatePtr) {
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 898547e..d1e2372 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -729,7 +729,7 @@ Tk_GetOpenFileObjCmd(
* panel. Prepend the title to the message in this case.
*/
- if ([NSApp macMinorVersion] > 10) {
+ if ([NSApp macOSVersion] > 101000) {
if (message) {
NSString *fullmessage =
[[NSString alloc] initWithFormat:@"%@\n%@", title, message];
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 881fb1b..447f033 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -39,7 +39,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
@implementation TKApplication
@synthesize poolLock = _poolLock;
-@synthesize macMinorVersion = _macMinorVersion;
+@synthesize macOSVersion = _macOSVersion;
@synthesize isDrawing = _isDrawing;
@end
@@ -164,15 +164,19 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
/*
* Record the OS version we are running on.
*/
- int minorVersion;
+
+ int minorVersion, majorVersion;
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion);
+ majorVersion = 10;
#else
NSOperatingSystemVersion systemVersion;
systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
+ majorVersion = systemVersion.majorVersion;
minorVersion = systemVersion.minorVersion;
#endif
- [NSApp setMacMinorVersion: minorVersion];
+ printf("Major: %d; Minor: %d\n", majorVersion, minorVersion);
+ [NSApp setMacOSVersion: 10000*majorVersion + 100*minorVersion];
/*
* We are not drawing right now.
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index 1029704..71b99db 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -112,7 +112,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
* On OS X 10.12 we get duplicate tab control items if we create them here.
*/
- if ([NSApp macMinorVersion] > 12) {
+ if ([NSApp macOSVersion] > 101200) {
_defaultWindowsMenuItems = [_defaultWindowsMenuItems
arrayByAddingObjectsFromArray:
[NSArray arrayWithObjects:
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 7dcfa10..c8754e8 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -105,7 +105,7 @@ enum {
if (eventType == NSLeftMouseDown &&
([eventWindow styleMask] & NSResizableWindowMask) &&
- [NSApp macMinorVersion] > 6) {
+ [NSApp macOSVersion] > 100600) {
NSRect frame = [eventWindow frame];
if (local.x < 3 || local.x > frame.size.width - 3 || local.y < 3) {
return theEvent;
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 079e033..b48e68a 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -340,12 +340,12 @@ VISIBILITY_HIDDEN
#ifdef __i386__
/* The Objective C runtime used on i386 requires this. */
int _poolLock;
- int _macMinorVersion;
+ int _macOSVersion; /* 10000 * major + 100*minor */
Bool _isDrawing;
#endif
}
@property int poolLock;
-@property int macMinorVersion;
+@property int macOSVersion;
@property Bool isDrawing;
@end
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index a49ec55..3f73b18 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -316,7 +316,7 @@ TkpDisplayScrollbar(
if (SNOW_LEOPARD_STYLE) {
HIThemeDrawTrack(&msPtr->info, 0, dc.context,
kHIThemeOrientationInverted);
- } else if ([NSApp macMinorVersion] <= 8) {
+ } else if ([NSApp macOSVersion] <= 100800) {
HIThemeDrawTrack(&msPtr->info, 0, dc.context,
kHIThemeOrientationNormal);
} else {
@@ -377,7 +377,7 @@ TkpComputeScrollbarGeometry(
scrollPtr->highlightWidth = 0;
}
scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
scrollPtr->arrowLength = scrollPtr->width;
} else {
scrollPtr->arrowLength = 0;
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 2d22824..09dc0b9 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -119,7 +119,7 @@ DebuggerObjCmd(
*/
MODULE_SCOPE Bool
TkTestLogDisplay(void) {
- if ([NSApp macMinorVersion] >= 14) {
+ if ([NSApp macOSVersion] >= 101400) {
return [NSApp isDrawing];
} else {
return ![NSApp isDrawing];
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 05e2ac2..cc3a8f8 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -979,7 +979,7 @@ RedisplayView(
*/
if ([NSApp isDrawing]) {
- if ([NSApp macMinorVersion] > 13) {
+ if ([NSApp macOSVersion] > 101300) {
TKLog(@"WARNING: a recursive call to drawRect was aborted.");
}
return;
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 98100e9..e318ce8 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -5584,7 +5584,7 @@ TkUnsupported1ObjCmd(
}
return WmWinStyle(interp, winPtr, objc, objv);
case TKMWS_TABID:
- if ([NSApp macMinorVersion] < 12) {
+ if ([NSApp macOSVersion] < 101200) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Tabbing identifiers did not exist until OSX 10.12.", -1));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "TABBINGID", NULL);
@@ -5596,7 +5596,7 @@ TkUnsupported1ObjCmd(
}
return WmWinTabbingId(interp, winPtr, objc, objv);
case TKMWS_APPEARANCE:
- if ([NSApp macMinorVersion] < 9) {
+ if ([NSApp macOSVersion] < 100900) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Window appearances did not exist until OSX 10.9.", -1));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL);
@@ -5606,7 +5606,7 @@ TkUnsupported1ObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "window ?appearancename?");
return TCL_ERROR;
}
- if (objc == 4 && [NSApp macMinorVersion] < 14) {
+ if (objc == 4 && [NSApp macOSVersion] < 101400) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Window appearances cannot be changed before OSX 10.14.",
-1));
@@ -6885,7 +6885,7 @@ ApplyWindowAttributeFlagChanges(
* window. To work around this we make the max size equal
* to the screen size. (For 10.11 and up, only)
*/
- if ([NSApp macMinorVersion] > 10) {
+ if ([NSApp macOSVersion] > 101000) {
[macWindow setMaxFullScreenContentSize:screenSize];
}
}
@@ -6969,7 +6969,7 @@ ApplyMasterOverrideChanges(
wmPtr->attributes = macClassAttrs[kSimpleWindowClass].defaultAttrs;
}
wmPtr->attributes |= kWindowNoActivatesAttribute;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
styleMask = 0;
} else {
styleMask &= ~NSTitledWindowMask;
@@ -6982,7 +6982,7 @@ ApplyMasterOverrideChanges(
macClassAttrs[kDocumentWindowClass].defaultAttrs;
}
wmPtr->attributes &= ~kWindowNoActivatesAttribute;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
styleMask = NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask |
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 72649f6..1ba49a5 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -270,7 +270,7 @@ static void GetBackgroundColor(
rgba[i] = masterPtr->privatePtr->fillRGBA[i];
}
} else {
- if ([NSApp macMinorVersion] > 13) {
+ if ([NSApp macOSVersion] > 101300) {
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *windowColor = [[NSColor windowBackgroundColor]
colorUsingColorSpace: deviceRGB];
@@ -1412,7 +1412,7 @@ static void ButtonElementDraw(
} else if (info.kind == kThemePushButton &&
(state & TTK_STATE_PRESSED)) {
bounds.size.height += 2;
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
GradientFillRoundedRectangle(dc.context, bounds, 4,
pressedPushButtonGradient, 2);
}
@@ -1606,7 +1606,7 @@ static void PaneElementDraw(
bounds.origin.y -= kThemeMetricTabFrameOverlap;
bounds.size.height += kThemeMetricTabFrameOverlap;
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
DrawGroupBox(bounds, dc.context, tkwin);
} else {
HIThemeTabPaneDrawInfo info = {
@@ -1665,7 +1665,7 @@ static void GroupElementDraw(
CGRect bounds = BoxToRect(d, b);
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
DrawGroupBox(bounds, dc.context, tkwin);
} else {
const HIThemeGroupBoxDrawInfo info = {
@@ -1788,7 +1788,7 @@ static void EntryElementDraw(
}
BEGIN_DRAWING(d)
if (backgroundPtr == NULL) {
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
background = [NSColor textBackgroundColor];
CGContextSetFillColorWithColor(dc.context, CGCOLOR(background));
} else {
@@ -1866,7 +1866,7 @@ static void ComboboxElementDraw(
if (TkMacOSXInDarkMode(tkwin)) {
bounds.size.height += 1;
DrawDarkButton(bounds, info.kind, state, dc.context);
- } else if ([NSApp macMinorVersion] > 8) {
+ } else if ([NSApp macOSVersion] > 100800) {
if ((state & TTK_STATE_BACKGROUND) &&
!(state & TTK_STATE_DISABLED)) {
NSColor *background = [NSColor textBackgroundColor];
@@ -2313,12 +2313,12 @@ static void TroughElementSize(
ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness);
if (orientation == TTK_ORIENT_HORIZONTAL) {
*minHeight = thickness;
- if ([NSApp macMinorVersion] > 7) {
+ if ([NSApp macOSVersion] > 100700) {
*paddingPtr = Ttk_MakePadding(4, 4, 4, 3);
}
} else {
*minWidth = thickness;
- if ([NSApp macMinorVersion] > 7) {
+ if ([NSApp macOSVersion] > 100700) {
*paddingPtr = Ttk_MakePadding(4, 4, 3, 4);
}
}
@@ -2363,7 +2363,7 @@ static void TroughElementDraw(
components: rgba
count: 4];
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
CGContextSetFillColorWithColor(dc.context, CGCOLOR(troughColor));
} else {
ChkErr(HIThemeSetFill, kThemeBrushDocumentWindowBackground, NULL,
@@ -2426,7 +2426,7 @@ static void ThumbElementDraw(
* draw the thumb directly.
*/
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
CGRect thumbBounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *thumbColor;
@@ -2486,7 +2486,7 @@ static void ThumbElementDraw(
visibleSize = (thumbSize / trackSize) * factor;
info.max = factor - visibleSize;
info.trackInfo.scrollbar.viewsize = visibleSize;
- if ([NSApp macMinorVersion] < 8 ||
+ if ([NSApp macOSVersion] < 100800 ||
orientation == TTK_ORIENT_HORIZONTAL) {
info.value = factor * fraction;
} else {
@@ -2524,7 +2524,7 @@ static void ArrowElementSize(
int *minHeight,
TCL_UNUSED(Ttk_Padding *))
{
- if ([NSApp macMinorVersion] < 8) {
+ if ([NSApp macOSVersion] < 100800) {
*minHeight = *minWidth = 14;
} else {
*minHeight = *minWidth = -1;
@@ -2708,7 +2708,7 @@ static void FillElementDraw(
{
CGRect bounds = BoxToRect(d, b);
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *bgColor;
CGFloat fill[4];
@@ -2880,7 +2880,7 @@ static void TreeAreaElementSize (
* widget expects the heading to be the same height as a row.
*/
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
paddingPtr->top = 4;
}
}
@@ -2900,7 +2900,7 @@ static void TreeHeaderElementSize(
int *minHeight,
Ttk_Padding *paddingPtr)
{
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
*minHeight = 24;
} else {
ButtonElementSize(clientData, elementRecord, tkwin, minWidth,
@@ -2927,7 +2927,7 @@ static void TreeHeaderElementDraw(
};
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
/*
* Compensate for the padding added in TreeHeaderElementSize, so