History

Merge pull request #20 from kode54/master

Minor quality of life improvements for macOS, now it works on Big Sur

Olav Sørensen committed 5 years ago

Commit 425cabf2 parents fdfa2bc 3c4a36a2 files · +10 −1Browse files

Unified · Split

2 files
  1. src/ft2_audioselector.c +9 −0
  2. src/ft2_diskop.c +1 −1
src/ft2_audioselector.c+9−0
@@ -24,6 +24,9 @@ char *getAudioOutputDeviceFromConfig(void) · 23 unmodified lines
2424 FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "r");
2525 if (f == NULL)
2626 {
27+#if defined(__APPLE__)
28+ return NULL; // SDL doesn't return devices in any appreciable order, and device 0 is most certainly not guaranteed to be the current default device
29+#else
2730 const char *devStringTmp = SDL_GetAudioDeviceName(0, false);
2831 if (devStringTmp == NULL)
2932 {
@@ -35,6 +38,7 @@ char *getAudioOutputDeviceFromConfig(void) · 5 unmodified lines
3538 if (devStringLen > 0)
3639 strncpy(devString, devStringTmp, MAX_DEV_STR_LEN);
3740 devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination
41+#endif
3842 }
3943 else
4044 {
@@ -50,6 +54,11 @@ char *getAudioOutputDeviceFromConfig(void) · 9 unmodified lines
5054 devString[devStringLen-1] = '\0';
5155 devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination
5256
57+#if defined(__APPLE__)
58+ if (devString[0] == '\0')
59+ return NULL; // macOS SDL2 locks up indefinitely if fed an empty string for device name
60+#endif
61+
5362 fclose(f);
5463 }
5564
src/ft2_diskop.c+1−1
@@ -2106,7 +2106,7 @@ static void setDiskOpItem(uint8_t item) · 2105 unmodified lines
21062106 }
21072107
21082108 const int32_t pathLen = (int32_t)UNICHAR_STRLEN(FReq_CurPathU);
2109− if (pathLen == 0)
2109+ if (pathLen == 0 && FReq_ModCurPathU[0] != '\0')
21102110 {
21112111 memset(FReq_CurPathU, 0, (PATH_MAX + 2) * sizeof (UNICHAR));
21122112 UNICHAR_STRCPY(FReq_CurPathU, FReq_ModCurPathU);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t