Mercurial > dwindows
comparison mac/dw.m @ 2352:360f3cb6bd57
Mac: Revert the HAVE_AVAILABLE portion of that last commit...
@available() only seems to work when running on older versions of MacOS.
It does not work for building on older versions.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 05 Mar 2021 06:03:55 +0000 |
parents | 0c8d769df97e |
children | 29cc92d4218b |
comparison
equal
deleted
inserted
replaced
2351:0c8d769df97e | 2352:360f3cb6bd57 |
---|---|
99 #define DWEventMaskLeftMouseDown NSEventMaskLeftMouseDown | 99 #define DWEventMaskLeftMouseDown NSEventMaskLeftMouseDown |
100 #define DWEventMaskRightMouseUp NSEventMaskRightMouseUp | 100 #define DWEventMaskRightMouseUp NSEventMaskRightMouseUp |
101 #define DWEventMaskRightMouseDown NSEventMaskRightMouseDown | 101 #define DWEventMaskRightMouseDown NSEventMaskRightMouseDown |
102 #define DWWindowStyleMaskResizable NSWindowStyleMaskResizable | 102 #define DWWindowStyleMaskResizable NSWindowStyleMaskResizable |
103 #define BUILDING_FOR_SIERRA | 103 #define BUILDING_FOR_SIERRA |
104 #define HAVE_AVAILABLE | |
105 #else | 104 #else |
106 #define DWButtonTypeSwitch NSSwitchButton | 105 #define DWButtonTypeSwitch NSSwitchButton |
107 #define DWButtonTypeRadio NSRadioButton | 106 #define DWButtonTypeRadio NSRadioButton |
108 #define DWButtonTypeMomentaryPushIn NSMomentaryPushInButton | 107 #define DWButtonTypeMomentaryPushIn NSMomentaryPushInButton |
109 #define DWBezelStyleRegularSquare NSRegularSquareBezelStyle | 108 #define DWBezelStyleRegularSquare NSRegularSquareBezelStyle |
435 } | 434 } |
436 | 435 |
437 /* Returns TRUE of Mojave or later is in Dark Mode */ | 436 /* Returns TRUE of Mojave or later is in Dark Mode */ |
438 BOOL _is_dark(id object) | 437 BOOL _is_dark(id object) |
439 { | 438 { |
440 #ifdef HAVE_AVAILABLE | 439 #ifdef BUILDING_FOR_MOJAVE |
441 NSAppearance *appearance = [object effectiveAppearance]; | 440 NSAppearance *appearance = [object effectiveAppearance]; |
442 | 441 |
443 if(@available(macOS 10.14, *)) | 442 if(@available(macOS 10.14, *)) |
444 { | 443 { |
445 NSAppearanceName basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[ | 444 NSAppearanceName basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[ |
1464 return NSTerminateNow; | 1463 return NSTerminateNow; |
1465 } | 1464 } |
1466 #if defined(BUILDING_FOR_MOUNTAIN_LION) && !defined(BUILDING_FOR_BIG_SUR) | 1465 #if defined(BUILDING_FOR_MOUNTAIN_LION) && !defined(BUILDING_FOR_BIG_SUR) |
1467 -(void)applicationDidFinishLaunching:(NSNotification *)aNotification | 1466 -(void)applicationDidFinishLaunching:(NSNotification *)aNotification |
1468 { | 1467 { |
1469 #ifdef HAVE_AVAILABLE | 1468 #ifdef BUILDING_FOR_MOJAVE |
1470 if (@available(macOS 10.14, *)) {} else | 1469 if (@available(macOS 10.14, *)) {} else |
1471 #endif | 1470 #endif |
1472 { | 1471 { |
1473 NSUserNotificationCenter* unc = [NSUserNotificationCenter defaultUserNotificationCenter]; | 1472 NSUserNotificationCenter* unc = [NSUserNotificationCenter defaultUserNotificationCenter]; |
1474 unc.delegate = self; | 1473 unc.delegate = self; |
11146 va_start(args, description); | 11145 va_start(args, description); |
11147 vsnprintf(outbuf, 1024, description, args); | 11146 vsnprintf(outbuf, 1024, description, args); |
11148 va_end(args); | 11147 va_end(args); |
11149 } | 11148 } |
11150 | 11149 |
11151 #ifdef HAVE_AVAILABLE | 11150 #ifdef BUILDING_FOR_MOJAVE |
11152 /* Configure the notification's payload. */ | 11151 /* Configure the notification's payload. */ |
11153 if (@available(macOS 10.14, *)) | 11152 if (@available(macOS 10.14, *)) |
11154 { | 11153 { |
11155 if([[NSBundle mainBundle] bundleIdentifier] != nil) | 11154 if([[NSBundle mainBundle] bundleIdentifier] != nil) |
11156 { | 11155 { |
11211 #ifdef BUILDING_FOR_MOUNTAIN_LION | 11210 #ifdef BUILDING_FOR_MOUNTAIN_LION |
11212 if(notification) | 11211 if(notification) |
11213 { | 11212 { |
11214 NSString *notid = [NSString stringWithFormat:@"dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification)]; | 11213 NSString *notid = [NSString stringWithFormat:@"dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification)]; |
11215 | 11214 |
11216 #ifdef HAVE_AVAILABLE | 11215 #ifdef BUILDING_FOR_MOJAVE |
11217 /* Schedule the notification. */ | 11216 /* Schedule the notification. */ |
11218 if (@available(macOS 10.14, *)) | 11217 if (@available(macOS 10.14, *)) |
11219 { | 11218 { |
11220 if([[NSBundle mainBundle] bundleIdentifier] != nil) | 11219 if([[NSBundle mainBundle] bundleIdentifier] != nil) |
11221 { | 11220 { |
12526 [DWMainMenu retain]; | 12525 [DWMainMenu retain]; |
12527 [DWApp setMainMenu:DWMainMenu]; | 12526 [DWApp setMainMenu:DWMainMenu]; |
12528 DWObj = [[DWObject alloc] init]; | 12527 DWObj = [[DWObject alloc] init]; |
12529 DWDefaultFont = nil; | 12528 DWDefaultFont = nil; |
12530 DWFontManager = [NSFontManager sharedFontManager]; | 12529 DWFontManager = [NSFontManager sharedFontManager]; |
12531 #ifdef HAVE_AVAILABLE | 12530 #ifdef BUILDING_FOR_MOJAVE |
12532 if (@available(macOS 10.14, *)) | 12531 if (@available(macOS 10.14, *)) |
12533 { | 12532 { |
12534 if([[NSBundle mainBundle] bundleIdentifier] != nil) | 12533 if([[NSBundle mainBundle] bundleIdentifier] != nil) |
12535 { | 12534 { |
12536 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; | 12535 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; |
12755 NSString *nsprogram = [NSString stringWithUTF8String:program]; | 12754 NSString *nsprogram = [NSString stringWithUTF8String:program]; |
12756 NSWorkspace *ws = [NSWorkspace sharedWorkspace]; | 12755 NSWorkspace *ws = [NSWorkspace sharedWorkspace]; |
12757 | 12756 |
12758 if(params && params[0] && params[1]) | 12757 if(params && params[0] && params[1]) |
12759 { | 12758 { |
12760 #ifdef HAVE_AVAILABLE | 12759 #ifdef BUILDING_FOR_CATALINA |
12761 if(@available(macOS 10.15, *)) | 12760 if(@available(macOS 10.15, *)) |
12762 { | 12761 { |
12763 NSURL *url = _dw_url_from_program(nsprogram, ws); | 12762 NSURL *url = _dw_url_from_program(nsprogram, ws); |
12764 NSMutableArray *array = [[NSMutableArray alloc] init]; | 12763 NSMutableArray *array = [[NSMutableArray alloc] init]; |
12765 __block DWDialog *dialog = dw_dialog_new(NULL); | 12764 __block DWDialog *dialog = dw_dialog_new(NULL); |
12808 } | 12807 } |
12809 } | 12808 } |
12810 } | 12809 } |
12811 else | 12810 else |
12812 { | 12811 { |
12813 #ifdef HAVE_AVAILABLE | 12812 #ifdef BUILDING_FOR_CATALINA |
12814 if(@available(macOS 10.15, *)) | 12813 if(@available(macOS 10.15, *)) |
12815 { | 12814 { |
12816 NSURL *url = _dw_url_from_program(nsprogram, ws); | 12815 NSURL *url = _dw_url_from_program(nsprogram, ws); |
12817 __block DWDialog *dialog = dw_dialog_new(NULL); | 12816 __block DWDialog *dialog = dw_dialog_new(NULL); |
12818 | 12817 |
13146 case DW_FEATURE_HTML_RESULT: | 13145 case DW_FEATURE_HTML_RESULT: |
13147 case DW_FEATURE_CONTAINER_STRIPE: | 13146 case DW_FEATURE_CONTAINER_STRIPE: |
13148 case DW_FEATURE_MLE_WORD_WRAP: | 13147 case DW_FEATURE_MLE_WORD_WRAP: |
13149 case DW_FEATURE_UTF8_UNICODE: | 13148 case DW_FEATURE_UTF8_UNICODE: |
13150 return DW_FEATURE_ENABLED; | 13149 return DW_FEATURE_ENABLED; |
13151 #ifdef HAVE_AVAILABLE | 13150 #ifdef BUILDING_FOR_MOJAVE |
13152 case DW_FEATURE_DARK_MODE: | 13151 case DW_FEATURE_DARK_MODE: |
13153 { | 13152 { |
13154 if(@available(macOS 10.14, *)) | 13153 if(@available(macOS 10.14, *)) |
13155 { | 13154 { |
13156 /* Make sure DWApp is initialized */ | 13155 /* Make sure DWApp is initialized */ |
13209 case DW_FEATURE_CONTAINER_STRIPE: | 13208 case DW_FEATURE_CONTAINER_STRIPE: |
13210 case DW_FEATURE_MLE_WORD_WRAP: | 13209 case DW_FEATURE_MLE_WORD_WRAP: |
13211 case DW_FEATURE_UTF8_UNICODE: | 13210 case DW_FEATURE_UTF8_UNICODE: |
13212 return DW_ERROR_GENERAL; | 13211 return DW_ERROR_GENERAL; |
13213 /* These features are supported and configurable */ | 13212 /* These features are supported and configurable */ |
13214 #ifdef HAVE_AVAILABLE | 13213 #ifdef BUILDING_FOR_MOJAVE |
13215 case DW_FEATURE_DARK_MODE: | 13214 case DW_FEATURE_DARK_MODE: |
13216 { | 13215 { |
13217 if(@available(macOS 10.14, *)) | 13216 if(@available(macOS 10.14, *)) |
13218 { | 13217 { |
13219 /* Make sure DWApp is initialized */ | 13218 /* Make sure DWApp is initialized */ |