comparison mac/dw.m @ 2073:cf70a52f702e

Mac: Changes to actively display the notification on versions prior to Mojave 10.14.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 15 May 2020 11:25:07 +0000
parents b7514ecd6305
children 1a196ada0bc9
comparison
equal deleted inserted replaced
2072:b7514ecd6305 2073:cf70a52f702e
1339 DWObject *DWObj; 1339 DWObject *DWObj;
1340 1340
1341 /* Subclass for the application class */ 1341 /* Subclass for the application class */
1342 @interface DWAppDel : NSObject 1342 @interface DWAppDel : NSObject
1343 #ifdef BUILDING_FOR_SNOW_LEOPARD 1343 #ifdef BUILDING_FOR_SNOW_LEOPARD
1344 <NSApplicationDelegate> 1344 <NSApplicationDelegate, NSUserNotificationCenterDelegate>
1345 #endif 1345 #endif
1346 { 1346 {
1347 } 1347 }
1348 -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; 1348 -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
1349 -(void)applicationDidFinishLaunching:(NSNotification *)aNotification;
1350 -(BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification;
1349 @end 1351 @end
1350 1352
1351 /* Apparently the WKWebKit API is only enabled on intel 64bit... 1353 /* Apparently the WKWebKit API is only enabled on intel 64bit...
1352 * Causing build failures on 32bit builds, so this should allow 1354 * Causing build failures on 32bit builds, so this should allow
1353 * WKWebKit on intel 64 and the old WebKit on intel 32 bit and earlier. 1355 * WKWebKit on intel 64 and the old WebKit on intel 32 bit and earlier.
1429 -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender 1431 -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
1430 { 1432 {
1431 if(_event_handler(sender, nil, 6) > 0) 1433 if(_event_handler(sender, nil, 6) > 0)
1432 return NSTerminateCancel; 1434 return NSTerminateCancel;
1433 return NSTerminateNow; 1435 return NSTerminateNow;
1436 }
1437 -(void)applicationDidFinishLaunching:(NSNotification *)aNotification
1438 {
1439 #ifdef BUILDING_FOR_MOJAVE
1440 if (!@available(macOS 10.14, *))
1441 #endif
1442 {
1443 NSUserNotificationCenter* unc = [NSUserNotificationCenter defaultUserNotificationCenter];
1444 unc.delegate = self;
1445 }
1446 }
1447 -(BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification
1448 {
1449 return YES;
1434 } 1450 }
1435 @end 1451 @end
1436 1452
1437 /* Subclass for a top-level window */ 1453 /* Subclass for a top-level window */
1438 @interface DWView : DWBox 1454 @interface DWView : DWBox