mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-05 06:24:18 +01:00
Global (macOS): makes fastfetch compile and work on macOS Mojave (10.14)
Ref: #2697
This commit is contained in:
@@ -289,6 +289,7 @@ static FFBluetoothResult* findByName(FFlist* devices, const char* name) {
|
||||
}
|
||||
|
||||
static const char* detectLe(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */, NSDictionary<NSString*, NSString*>* classicAddressByIdentifier) {
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
CBManagerAuthorization authorization = CBCentralManager.authorization;
|
||||
if (authorization == CBManagerAuthorizationDenied || authorization == CBManagerAuthorizationRestricted) {
|
||||
return nullptr; // The user said no. `NotDetermined` is left to the manager below, which asks.
|
||||
@@ -377,6 +378,7 @@ static const char* detectLe(FFBluetoothOptions* options, FFlist* devices /* FFBl
|
||||
target->signalQuality = ffRssiToSignalQuality(rssi.intValue);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ typedef struct FFFindGamepadContext {
|
||||
// The GameController framework's own devices, and how many of them there were. `set` is the IOKit
|
||||
// side, used only to borrow the serial -- see `findHIDDeviceForController()`.
|
||||
static uint32_t findGameControllerDevices(FFlist* devices, NSSet* set) {
|
||||
#ifdef MAC_OS_VERSION_11_0
|
||||
if (@available(macOS 11.0, *)) {
|
||||
// See the note at the top: the list stays empty until the run loop has been pumped once, and
|
||||
// the timeout only bounds the case where the framework has nothing to report at all. The
|
||||
@@ -222,6 +223,8 @@ static uint32_t findGameControllerDevices(FFlist* devices, NSSet* set) {
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -234,6 +237,7 @@ static uint32_t findGameControllerDevices(FFlist* devices, NSSet* set) {
|
||||
// Apple's whitelist, fails this and skips the wait entirely instead of sitting through a timeout for
|
||||
// a list that will never contain it.
|
||||
static bool anyDeviceIsClaimedByGameController(NSSet* set) {
|
||||
#ifdef MAC_OS_VERSION_11_0
|
||||
if (@available(macOS 11.0, *)) {
|
||||
for (id value in set) {
|
||||
if ([GCController supportsHIDDevice: (__bridge IOHIDDeviceRef) value]) {
|
||||
@@ -241,12 +245,15 @@ static bool anyDeviceIsClaimedByGameController(NSSet* set) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void enumSet(IOHIDDeviceRef value, FFFindGamepadContext* ctx) {
|
||||
// A device the framework owns is already in the list under its own name; see the note at the
|
||||
// top for why this is conditional on the framework having contributed anything at all.
|
||||
#ifdef MAC_OS_VERSION_11_0
|
||||
if (ctx->gameControllerCount > 0) {
|
||||
if (@available(macOS 11.0, *)) {
|
||||
if ([GCController supportsHIDDevice:value]) {
|
||||
@@ -254,6 +261,7 @@ static void enumSet(IOHIDDeviceRef value, FFFindGamepadContext* ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
FFGamepadDevice* device = FF_LIST_ADD(FFGamepadDevice, *ctx->devices);
|
||||
ffStrbufInit(&device->serial);
|
||||
|
||||
Reference in New Issue
Block a user