diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 17 | ||||
-rw-r--r-- | src/app.h | 1 | ||||
-rw-r--r-- | src/fontpack.c | 8 |
3 files changed, 20 insertions, 6 deletions
@@ -1362,6 +1362,10 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
1362 | dispatchCommands_Periodic(&d->periodic); | 1362 | dispatchCommands_Periodic(&d->periodic); |
1363 | continue; | 1363 | continue; |
1364 | } | 1364 | } |
1365 | if (ev.type == SDL_USEREVENT && ev.user.code == releaseObject_UserEventCode) { | ||
1366 | iRelease(ev.user.data1); | ||
1367 | continue; | ||
1368 | } | ||
1365 | #if defined (LAGRANGE_ENABLE_IDLE_SLEEP) | 1369 | #if defined (LAGRANGE_ENABLE_IDLE_SLEEP) |
1366 | if (ev.type == SDL_USEREVENT && ev.user.code == asleep_UserEventCode) { | 1370 | if (ev.type == SDL_USEREVENT && ev.user.code == asleep_UserEventCode) { |
1367 | if (SDL_GetTicks() - d->lastEventTime > idleThreshold_App_ && | 1371 | if (SDL_GetTicks() - d->lastEventTime > idleThreshold_App_ && |
@@ -2394,12 +2398,19 @@ iBool handleCommand_App(const char *cmd) { | |||
2394 | setCStr_String(src, "# ${heading.glyphfinder.results}\n\n"); | 2398 | setCStr_String(src, "# ${heading.glyphfinder.results}\n\n"); |
2395 | iRangecc path = iNullRange; | 2399 | iRangecc path = iNullRange; |
2396 | iBool isFirst = iTrue; | 2400 | iBool isFirst = iTrue; |
2397 | while (nextSplit_Rangecc(range_Command(cmd, "packs"), ";", &path)) { | 2401 | while (nextSplit_Rangecc(range_Command(cmd, "packs"), ",", &path)) { |
2398 | if (isFirst) { | 2402 | if (isFirst) { |
2399 | appendCStr_String(src, "${glyphfinder.results}\n\n"); | 2403 | appendCStr_String(src, "${glyphfinder.results}\n\n"); |
2400 | } | 2404 | } |
2401 | const char *fp = cstr_Rangecc(path); | 2405 | iRangecc fpath = path; |
2402 | appendFormat_String(src, "=> gemini://skyjake.fi/fonts/%s %s\n", fp, fp); | 2406 | iRangecc fsize = path; |
2407 | fpath.end = strchr(fpath.start, ';'); | ||
2408 | fsize.start = fpath.end + 1; | ||
2409 | const uint32_t size = strtoul(fsize.start, NULL, 10); | ||
2410 | appendFormat_String(src, "=> gemini://skyjake.fi/fonts/%s %s (%.1f MB)\n", | ||
2411 | cstr_Rangecc(fpath), | ||
2412 | cstr_Rangecc(fpath), | ||
2413 | (double) size / 1.0e6); | ||
2403 | isFirst = iFalse; | 2414 | isFirst = iFalse; |
2404 | } | 2415 | } |
2405 | if (isFirst) { | 2416 | if (isFirst) { |
@@ -67,6 +67,7 @@ enum iUserEventCode { | |||
67 | take, it could turn into a tap-and-hold for example. */ | 67 | take, it could turn into a tap-and-hold for example. */ |
68 | widgetTapBegins_UserEventCode, | 68 | widgetTapBegins_UserEventCode, |
69 | widgetTouchEnds_UserEventCode, /* finger lifted, but momentum may continue */ | 69 | widgetTouchEnds_UserEventCode, /* finger lifted, but momentum may continue */ |
70 | releaseObject_UserEventCode, /* object that needs releasing in the main thread */ | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | const iString *execPath_App (void); | 73 | const iString *execPath_App (void); |
diff --git a/src/fontpack.c b/src/fontpack.c index 3faf0e92..924d4781 100644 --- a/src/fontpack.c +++ b/src/fontpack.c | |||
@@ -1114,7 +1114,7 @@ static void findCharactersInCMap_(iGmRequest *d, iGmRequest *req) { | |||
1114 | format_String(&result, "font.found chars:%s packs:", cstr_String(missingChars)); | 1114 | format_String(&result, "font.found chars:%s packs:", cstr_String(missingChars)); |
1115 | iConstForEach(StringList, s, matchingPacks) { | 1115 | iConstForEach(StringList, s, matchingPacks) { |
1116 | if (s.pos != 0) { | 1116 | if (s.pos != 0) { |
1117 | appendCStr_String(&result, ";"); | 1117 | appendCStr_String(&result, ","); |
1118 | } | 1118 | } |
1119 | append_String(&result, s.value); | 1119 | append_String(&result, s.value); |
1120 | } | 1120 | } |
@@ -1131,9 +1131,11 @@ static void findCharactersInCMap_(iGmRequest *d, iGmRequest *req) { | |||
1131 | cstr_String(meta_GmRequest(d)), | 1131 | cstr_String(meta_GmRequest(d)), |
1132 | cstr_String(url_GmRequest(d))); | 1132 | cstr_String(url_GmRequest(d))); |
1133 | } | 1133 | } |
1134 | fflush(stdout); | 1134 | // fflush(stdout); |
1135 | delete_String(userData_Object(d)); | 1135 | delete_String(userData_Object(d)); |
1136 | iReleaseLater(d); | 1136 | /* We can't delete ourselves; threads must be joined from another thread. */ |
1137 | SDL_PushEvent((SDL_Event *) &(SDL_UserEvent){ | ||
1138 | .type = SDL_USEREVENT, .code = releaseObject_UserEventCode, .data1 = d }); | ||
1137 | } | 1139 | } |
1138 | 1140 | ||
1139 | void searchOnlineLibraryForCharacters_Fonts(const iString *chars) { | 1141 | void searchOnlineLibraryForCharacters_Fonts(const iString *chars) { |