Skip to content

Commit

Permalink
Merge pull request #2594 from andydotxyz/fix/2478
Browse files Browse the repository at this point in the history
'Fix' the Sierra build error by adding -tags legacy
  • Loading branch information
andydotxyz committed Oct 31, 2021
2 parents 5ace18d + b757268 commit 729a478
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/app_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package app

/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Foundation -framework UserNotifications
#cgo LDFLAGS: -framework Foundation
#include <stdbool.h>
#include <stdlib.h>
Expand Down
17 changes: 13 additions & 4 deletions app/app_darwin.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
// +build !ci

#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
#import <UserNotifications/UserNotifications.h>
#endif

static int notifyNum = 0;

extern void fallbackSend(char *cTitle, char *cBody);

bool isBundled() {
return [[NSBundle mainBundle] bundleIdentifier] != nil;
}

#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
void doSendNotification(UNUserNotificationCenter *center, NSString *title, NSString *body) {
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
[content autorelease];
Expand All @@ -24,10 +32,6 @@ void doSendNotification(UNUserNotificationCenter *center, NSString *title, NSStr
}];
}

bool isBundled() {
return [[NSBundle mainBundle] bundleIdentifier] != nil;
}

void sendNotification(char *cTitle, char *cBody) {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
NSString *title = [NSString stringWithUTF8String:cTitle];
Expand All @@ -49,3 +53,8 @@ void sendNotification(char *cTitle, char *cBody) {
}
}];
}
#else
void sendNotification(char *cTitle, char *cBody) {
fallbackSend(cTitle, cBody);
}
#endif
9 changes: 9 additions & 0 deletions app/app_notlegacy_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build !ci
// +build !legacy

package app

/*
#cgo LDFLAGS: -framework Foundation -framework UserNotifications
*/
import "C"
4 changes: 2 additions & 2 deletions internal/driver/glfw/menu_darwin.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
NSControlStateValue STATE_ON = NSControlStateValueOn;
NSControlStateValue STATE_OFF = NSControlStateValueOff;
#else
NSControlStateValue STATE_ON = NSOnState;
NSControlStateValue STATE_OFF = NSOffState;
NSCellStateValue STATE_ON = NSOnState;
NSCellStateValue STATE_OFF = NSOffState;
#endif


Expand Down

0 comments on commit 729a478

Please sign in to comment.